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
c272e1ae
Commit
c272e1ae
authored
Sep 29, 2022
by
kurumuz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
a1a34f99
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
hydra_node/models.py
hydra_node/models.py
+9
-9
No files found.
hydra_node/models.py
View file @
c272e1ae
...
...
@@ -703,13 +703,13 @@ class EmbedderModel(nn.Module):
#check if text is a substring in tag_count.keys()
found
=
[]
for
tag
,
count
in
self
.
tag_count_sorted
:
if
len
(
tag
)
>
len
(
text
)
and
tag
.
startswith
(
text
):
if
len
(
tag
)
>
=
len
(
text
)
and
tag
.
startswith
(
text
):
found
.
append
([
tag
,
count
,
0
])
results
=
[]
embedding
=
self
([
text
])
#print(embedding.dtype)
k
=
1
0
k
=
2
0
D
,
I
=
self
.
knn
.
search
(
embedding
,
k
)
D
,
I
=
D
.
squeeze
(),
I
.
squeeze
()
for
i
,
id
in
enumerate
(
I
):
...
...
@@ -718,16 +718,16 @@ class EmbedderModel(nn.Module):
prob
=
D
[
i
]
results
.
append
([
tag
,
count
,
prob
])
print
(
results
)
#sort results by count and prob after
results
=
sorted
(
results
,
key
=
lambda
x
:
x
[
1
],
reverse
=
True
)
found
=
found
[:
5
]
for
result
in
found
:
if
result
[
0
]
in
results
:
results
.
remove
(
result
)
for
i
,
result
in
enumerate
(
found
)
:
if
result
[
0
]
in
[
x
[
0
]
for
x
in
results
]
:
found
.
remove
(
result
)
if
len
(
found
)
>
0
:
results
=
results
[:
-
len
(
found
)]
results
=
found
+
results
#max 10 results
results
=
results
[:
10
]
results
=
sorted
(
results
,
key
=
lambda
x
:
x
[
1
],
reverse
=
True
)
return
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