Upload README.md
Browse files
README.md
CHANGED
@@ -1,12 +1,9 @@
|
|
1 |
-
---
|
2 |
-
license: cc-by-4.0
|
3 |
-
---
|
4 |
# tokenspace directory
|
5 |
|
6 |
This directory contains utilities for the purpose of browsing the
|
7 |
"token space" of CLIP ViT-L/14
|
8 |
|
9 |
-
Long term goal is to be able to literally browse from word to
|
10 |
"nearby" word
|
11 |
|
12 |
|
@@ -15,15 +12,29 @@ Long term goal is to be able to literally browse from word to
|
|
15 |
|
16 |
Generates the "embeddings.safetensor" file!
|
17 |
|
18 |
-
Basically goes through the fullword.json file, and
|
19 |
generates a standalone embedding object for each word.
|
20 |
Shape of the embeddings tensor, is
|
21 |
[number-of-words][768]
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
## fullword.json
|
24 |
|
25 |
This file contains a collection of "one word, one CLIP token id" pairings.
|
26 |
The file was taken from vocab.sdturbo.json
|
27 |
-
First all the non
|
28 |
Then all the garbage punctuation and foreign characters were stripped out.
|
29 |
-
Finally, the actual
|
|
|
|
|
|
|
|
|
1 |
# tokenspace directory
|
2 |
|
3 |
This directory contains utilities for the purpose of browsing the
|
4 |
"token space" of CLIP ViT-L/14
|
5 |
|
6 |
+
Long term goal is to be able to literally browse from word to
|
7 |
"nearby" word
|
8 |
|
9 |
|
|
|
12 |
|
13 |
Generates the "embeddings.safetensor" file!
|
14 |
|
15 |
+
Basically goes through the fullword.json file, and
|
16 |
generates a standalone embedding object for each word.
|
17 |
Shape of the embeddings tensor, is
|
18 |
[number-of-words][768]
|
19 |
|
20 |
+
Note that it is possible to directly pull a tensor from the CLIP model,
|
21 |
+
key of text_model.embeddings.token_embedding.weight
|
22 |
+
|
23 |
+
This will NOT GIVE YOU THE RIGHT DISTANCES!
|
24 |
+
Hence why we are calculating and then storing the embedding weights actually
|
25 |
+
used by the CLIP process
|
26 |
+
|
27 |
+
|
28 |
+
## generate-distances.py
|
29 |
+
|
30 |
+
Loads the prior generated embeddings, and then tries to calculate a full matrix
|
31 |
+
of distances between all tokens
|
32 |
+
|
33 |
+
|
34 |
## fullword.json
|
35 |
|
36 |
This file contains a collection of "one word, one CLIP token id" pairings.
|
37 |
The file was taken from vocab.sdturbo.json
|
38 |
+
First all the non-(/w) entries were stripped out.
|
39 |
Then all the garbage punctuation and foreign characters were stripped out.
|
40 |
+
Finally, the actual (/w) was stripped out, for ease of use.
|