tboquet commited on
Commit
4887b39
·
verified ·
1 Parent(s): 42d0172

Upload folder using huggingface_hub

Browse files
Files changed (6) hide show
  1. .gitattributes +1 -0
  2. README.md +153 -0
  3. config.json +12 -0
  4. model.safetensors +3 -0
  5. modules.json +8 -0
  6. tokenizer.json +3 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Alibaba-NLP/gte-multilingual-base
3
+ language:
4
+ - af
5
+ - ar
6
+ - az
7
+ - be
8
+ - bg
9
+ - bn
10
+ - ca
11
+ - ceb
12
+ - cs
13
+ - cy
14
+ - da
15
+ - de
16
+ - el
17
+ - en
18
+ - es
19
+ - et
20
+ - eu
21
+ - fa
22
+ - fi
23
+ - fr
24
+ - gl
25
+ - gu
26
+ - he
27
+ - hi
28
+ - hr
29
+ - ht
30
+ - hu
31
+ - hy
32
+ - id
33
+ - is
34
+ - it
35
+ - ja
36
+ - jv
37
+ - ka
38
+ - kk
39
+ - km
40
+ - kn
41
+ - ko
42
+ - ky
43
+ - lo
44
+ - lt
45
+ - lv
46
+ - mk
47
+ - ml
48
+ - mn
49
+ - mr
50
+ - ms
51
+ - my
52
+ - ne
53
+ - nl
54
+ - 'no'
55
+ - pa
56
+ - pl
57
+ - pt
58
+ - qu
59
+ - ro
60
+ - ru
61
+ - si
62
+ - sk
63
+ - sl
64
+ - so
65
+ - sq
66
+ - sr
67
+ - sv
68
+ - sw
69
+ - ta
70
+ - te
71
+ - th
72
+ - tl
73
+ - tr
74
+ - uk
75
+ - ur
76
+ - vi
77
+ - yo
78
+ - zh
79
+ library_name: model2vec
80
+ license: mit
81
+ model_name: tboquet/m2v-gte-multilingual-base-pca-128
82
+ tags:
83
+ - embeddings
84
+ - static-embeddings
85
+ - sentence-transformers
86
+ ---
87
+
88
+ # tboquet/m2v-gte-multilingual-base-pca-128 Model Card
89
+
90
+ This [Model2Vec](https://github.com/MinishLab/model2vec) model is a distilled version of the [Alibaba-NLP/gte-multilingual-base](https://huggingface.co/Alibaba-NLP/gte-multilingual-base) Sentence Transformer. It uses static embeddings, allowing text embeddings to be computed orders of magnitude faster on both GPU and CPU. It is designed for applications where computational resources are limited or where real-time performance is critical.
91
+
92
+
93
+ ## Installation
94
+
95
+ Install model2vec using pip:
96
+ ```
97
+ pip install model2vec
98
+ ```
99
+
100
+ ## Usage
101
+ Load this model using the `from_pretrained` method:
102
+ ```python
103
+ from model2vec import StaticModel
104
+
105
+ # Load a pretrained Model2Vec model
106
+ model = StaticModel.from_pretrained("tboquet/m2v-gte-multilingual-base-pca-128")
107
+
108
+ # Compute text embeddings
109
+ embeddings = model.encode(["Example sentence"])
110
+ ```
111
+
112
+ Alternatively, you can distill your own model using the `distill` method:
113
+ ```python
114
+ from model2vec.distill import distill
115
+
116
+ # Choose a Sentence Transformer model
117
+ model_name = "BAAI/bge-base-en-v1.5"
118
+
119
+ # Distill the model
120
+ m2v_model = distill(model_name=model_name, pca_dims=256)
121
+
122
+ # Save the model
123
+ m2v_model.save_pretrained("m2v_model")
124
+ ```
125
+
126
+ ## How it works
127
+
128
+ Model2vec creates a small, fast, and powerful model that outperforms other static embedding models by a large margin on all tasks we could find, while being much faster to create than traditional static embedding models such as GloVe. Best of all, you don't need any data to distill a model using Model2Vec.
129
+
130
+ It works by passing a vocabulary through a sentence transformer model, then reducing the dimensionality of the resulting embeddings using PCA, and finally weighting the embeddings using zipf weighting. During inference, we simply take the mean of all token embeddings occurring in a sentence.
131
+
132
+ ## Additional Resources
133
+
134
+ - [All Model2Vec models on the hub](https://huggingface.co/models?library=model2vec)
135
+ - [Model2Vec Repo](https://github.com/MinishLab/model2vec)
136
+ - [Model2Vec Results](https://github.com/MinishLab/model2vec?tab=readme-ov-file#results)
137
+ - [Model2Vec Tutorials](https://github.com/MinishLab/model2vec/tree/main/tutorials)
138
+
139
+ ## Library Authors
140
+
141
+ Model2Vec was developed by the [Minish Lab](https://github.com/MinishLab) team consisting of [Stephan Tulkens](https://github.com/stephantul) and [Thomas van Dongen](https://github.com/Pringled).
142
+
143
+ ## Citation
144
+
145
+ Please cite the [Model2Vec repository](https://github.com/MinishLab/model2vec) if you use this model in your work.
146
+ ```
147
+ @software{minishlab2024model2vec,
148
+ authors = {Stephan Tulkens, Thomas van Dongen},
149
+ title = {Model2Vec: Turn any Sentence Transformer into a Small Fast Model},
150
+ year = {2024},
151
+ url = {https://github.com/MinishLab/model2vec},
152
+ }
153
+ ```
config.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model_type": "model2vec",
3
+ "architectures": [
4
+ "StaticModel"
5
+ ],
6
+ "tokenizer_name": "Alibaba-NLP/gte-multilingual-base",
7
+ "apply_pca": 128,
8
+ "apply_zipf": true,
9
+ "hidden_dim": 128,
10
+ "seq_length": 1000000,
11
+ "normalize": false
12
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:29efc0fbf31685bac275dd3098fd126e430ae9521d6575cf1e3eb19b3321337b
3
+ size 128001112
modules.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "idx": 0,
4
+ "name": "0",
5
+ "path": ".",
6
+ "type": "sentence_transformers.models.StaticEmbedding"
7
+ }
8
+ ]
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3a56def25aa40facc030ea8b0b87f3688e4b3c39eb8b45d5702b3a1300fe2a20
3
+ size 17082734