meh
Browse files- compare-allids-embeds.py +9 -6
compare-allids-embeds.py
CHANGED
@@ -1,16 +1,18 @@
|
|
1 |
#!/bin/env python
|
2 |
|
3 |
-
"""
|
4 |
-
temp utility.
|
5 |
Load in two pre-calculated embeddings files.
|
6 |
(eg: *.allid.*)
|
|
|
|
|
|
|
7 |
|
8 |
-
|
|
|
9 |
|
10 |
-
|
|
|
11 |
|
12 |
-
This covers the full official range of tokenids,
|
13 |
-
0-49405
|
14 |
|
15 |
"""
|
16 |
|
@@ -63,6 +65,7 @@ embs2_avg=torch.mean(embs2,dim=0)
|
|
63 |
avg_dist= torch.cdist( embs1_avg.unsqueeze(0),embs2_avg.unsqueeze(0), p=2)
|
64 |
print("However, the distance between the avg-point of each is:",avg_dist)
|
65 |
|
|
|
66 |
|
67 |
######################################
|
68 |
|
|
|
1 |
#!/bin/env python
|
2 |
|
3 |
+
"""
|
|
|
4 |
Load in two pre-calculated embeddings files.
|
5 |
(eg: *.allid.*)
|
6 |
+
Typically, I generate files that cover the full range of tokenids,
|
7 |
+
0-49405
|
8 |
+
(using generate-allid-embeddings.py(XL).py )
|
9 |
|
10 |
+
This then goes through the full range and calculate distances
|
11 |
+
between each.
|
12 |
|
13 |
+
Display a graph of the distances.
|
14 |
+
Also print out things like the mean distance
|
15 |
|
|
|
|
|
16 |
|
17 |
"""
|
18 |
|
|
|
65 |
avg_dist= torch.cdist( embs1_avg.unsqueeze(0),embs2_avg.unsqueeze(0), p=2)
|
66 |
print("However, the distance between the avg-point of each is:",avg_dist)
|
67 |
|
68 |
+
print("Mean of all the distances:" + str(torch.mean(targetdistances,dim=0)))
|
69 |
|
70 |
######################################
|
71 |
|