Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
H
Hydra Node Http
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Hydra Node Http
Commits
4b5d5964
You need to sign in or sign up before continuing.
Commit
4b5d5964
authored
Sep 29, 2022
by
kurumuz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changes to search
parent
16a0c79d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
hydra_node/models.py
hydra_node/models.py
+13
-6
No files found.
hydra_node/models.py
View file @
4b5d5964
...
@@ -726,7 +726,7 @@ class EmbedderModel(nn.Module):
...
@@ -726,7 +726,7 @@ class EmbedderModel(nn.Module):
results
=
[]
results
=
[]
embedding
=
self
([
text
])
embedding
=
self
([
text
])
#print(embedding.dtype)
#print(embedding.dtype)
k
=
20
k
=
15
D
,
I
=
self
.
knn
.
search
(
embedding
,
k
)
D
,
I
=
self
.
knn
.
search
(
embedding
,
k
)
D
,
I
=
D
.
squeeze
(),
I
.
squeeze
()
D
,
I
=
D
.
squeeze
(),
I
.
squeeze
()
for
i
,
id
in
enumerate
(
I
):
for
i
,
id
in
enumerate
(
I
):
...
@@ -736,12 +736,19 @@ class EmbedderModel(nn.Module):
...
@@ -736,12 +736,19 @@ class EmbedderModel(nn.Module):
results
.
append
([
tag
,
count
,
prob
])
results
.
append
([
tag
,
count
,
prob
])
found
=
found
[:
5
]
found
=
found
[:
5
]
for
i
,
result
in
enumerate
(
found
):
results_tags
=
[
x
[
0
]
for
x
in
found
]
if
result
[
0
]
in
[
x
[
0
]
for
x
in
results
]:
for
result
in
results
.
copy
():
found
.
remove
(
result
)
if
result
[
0
]
in
results_tags
:
results
.
remove
(
result
)
results
=
sorted
(
results
,
key
=
lambda
x
:
x
[
2
],
reverse
=
True
)
#filter results for >0.5 confidence unless it has the search text in it and confidence is >0.4
results
=
[
x
for
x
in
results
if
x
[
2
]
>
0.5
or
(
x
[
2
]
>
0.4
and
text
in
x
[
0
])]
found
=
sorted
(
found
,
key
=
lambda
x
:
x
[
1
],
reverse
=
True
)
print
(
found
)
print
(
results
)
if
len
(
found
)
>
0
:
if
len
(
found
)
>
0
:
results
=
results
[:
-
len
(
found
)]
#
results = results[:-len(found)]
results
=
found
+
results
results
=
found
+
results
#max 10 results
#max 10 results
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment