Spaces:
Runtime error
Runtime error
lllchenlll
commited on
Commit
•
2a52946
1
Parent(s):
054d7f8
Delete tag_data
Browse files- tag_data/cal.py +0 -35
- tag_data/tags.txt +0 -0
tag_data/cal.py
DELETED
@@ -1,35 +0,0 @@
|
|
1 |
-
import numpy as np
|
2 |
-
from sentence_transformers import SentenceTransformer
|
3 |
-
|
4 |
-
|
5 |
-
encoder = SentenceTransformer("../model/")
|
6 |
-
|
7 |
-
tags = []
|
8 |
-
f = open('tags.txt', 'r')
|
9 |
-
for line in f.readlines():
|
10 |
-
tags.append(line.strip())
|
11 |
-
f.close()
|
12 |
-
|
13 |
-
tags_embed = encoder.encode(tags)
|
14 |
-
tags_dis = [np.sqrt(np.dot(_, _.T)) for _ in tags_embed]
|
15 |
-
|
16 |
-
print(tags_embed.shape, tags_dis.shape)
|
17 |
-
|
18 |
-
with open('./tags_embed.npy', 'wb') as f:
|
19 |
-
np.save(f, tags_embed)
|
20 |
-
|
21 |
-
with open('./tags_dis.npy', 'wb') as f:
|
22 |
-
np.save(f, tags_dis)
|
23 |
-
|
24 |
-
# f = open('gpttag.txt', 'r')
|
25 |
-
# data = eval(f.readline())
|
26 |
-
# f.close()
|
27 |
-
#
|
28 |
-
# out = ""
|
29 |
-
# f = open('tags.txt', 'w')
|
30 |
-
# for tmp in data:
|
31 |
-
# if tmp[1] > 2:
|
32 |
-
# out += tmp[0] + '\n'
|
33 |
-
#
|
34 |
-
# f.write(out)
|
35 |
-
# f.close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tag_data/tags.txt
DELETED
The diff for this file is too large to render.
See raw diff
|
|