Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,58 @@
|
|
1 |
---
|
2 |
license: mit
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
+
language:
|
4 |
+
- en
|
5 |
---
|
6 |
+
# Visually Grounded embeddings for Fast-text and GloVe
|
7 |
+
|
8 |
+
This repository contains multiple visually grounded word embedding models.
|
9 |
+
All of these embeddings have been effectively infused with visual information from images.<br>
|
10 |
+
They have been proven to show stronger correlations (compared to textual embeddings)
|
11 |
+
to human judgments on various word similarities and relatedness benchmarks.
|
12 |
+
|
13 |
+
# Usage
|
14 |
+
|
15 |
+
All of the models are encoded in [gensim](https://pypi.org/project/gensim/) format.
|
16 |
+
Loading the model:
|
17 |
+
```python
|
18 |
+
import gensim
|
19 |
+
|
20 |
+
model_g = gensim.models.KeyedVectors.load_word2vec_format('path_to_embeddings' , binary=True)
|
21 |
+
|
22 |
+
#retrieve the most similar words
|
23 |
+
print(model_g.most_similar('together',topn=10))
|
24 |
+
|
25 |
+
[('togther', 0.6425853967666626), ('togehter', 0.6374243497848511), ('togeather', 0.6196791529655457),
|
26 |
+
('togather', 0.5998020172119141), ('togheter', 0.5819681882858276),('toghether', 0.5738174319267273),
|
27 |
+
('2gether', 0.5187329053878784), ('togethor', 0.501663088798523), ('gether', 0.49128714203834534),
|
28 |
+
('toegther', 0.48457157611846924)]
|
29 |
+
|
30 |
+
print(model_g.most_similar('sad',topn=10))
|
31 |
+
|
32 |
+
[('saddening', 0.6763913631439209), ('depressing', 0.6676110029220581), ('saddened', 0.6352651715278625),
|
33 |
+
('sorrowful', 0.6336953043937683), ('heartbreaking', 0.6180269122123718), ('heartbroken', 0.6099187135696411),
|
34 |
+
('tragic', 0.6039361953735352), ('pathetic', 0.5848405361175537), ('Sad', 0.5826965570449829),
|
35 |
+
('mournful', 0.5742306709289551)]
|
36 |
+
|
37 |
+
#find the outlier word
|
38 |
+
print(model_g.doesnt_match(['fire', 'water', 'land', 'sea', 'air', 'car']))
|
39 |
+
|
40 |
+
car
|
41 |
+
```
|
42 |
+
|
43 |
+
where 'path_to_embeddings' is the path to the embeddings you intend to use.
|
44 |
+
|
45 |
+
# Which embeddings to use
|
46 |
+
Under the **Files and Versions** tab, you can see the list of 4 available embeddings.
|
47 |
+
|
48 |
+
The following embedding files are from the paper [Learning Zero-Shot Multifaceted Visually Grounded Word Embeddings via Multi-Task Training](https://aclanthology.org/2021.conll-1.12/):
|
49 |
+
- v_glove_1024d_1.0
|
50 |
+
- v_fasttext_1024d_1.0
|
51 |
+
|
52 |
+
The following embedding files are from the paper [Language with Vision: a Study on Grounded Word and Sentence Embeddings](https://arxiv.org/pdf/2206.08823.pdf):
|
53 |
+
|
54 |
+
- v_glove_1024d_2.0
|
55 |
+
- v_glove_300_d_2.0
|
56 |
+
|
57 |
+
All of them come with 1024-dimensional word vectors except v_glove_300_d_2.0 which contains 300 1024-dimensional word vectors.
|
58 |
+
|