sayed0am commited on
Commit
c1e3f0c
·
verified ·
1 Parent(s): 3bf183a

Upload folder using huggingface_hub

Browse files
Files changed (5) hide show
  1. README.md +174 -3
  2. config.json +14 -0
  3. model.safetensors +3 -0
  4. modules.json +14 -0
  5. tokenizer.json +0 -0
README.md CHANGED
@@ -1,3 +1,174 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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: gte-multilingual-base-m2v-768
82
+ tags:
83
+ - embeddings
84
+ - static-embeddings
85
+ - sentence-transformers
86
+ ---
87
+
88
+ # gte-multilingual-base-m2v-768 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. Model2Vec models are the smallest, fastest, and most performant static embedders available. The distilled models are up to 50 times smaller and 500 times faster than traditional Sentence Transformers.
91
+
92
+
93
+ ## Installation
94
+
95
+ Install model2vec using pip:
96
+ ```
97
+ pip install model2vec
98
+ ```
99
+
100
+ ## Usage
101
+
102
+ ### Using Model2Vec
103
+
104
+ The [Model2Vec library](https://github.com/MinishLab/model2vec) is the fastest and most lightweight way to run Model2Vec models.
105
+
106
+ Load this model using the `from_pretrained` method:
107
+ ```python
108
+ from model2vec import StaticModel
109
+
110
+ # Load a pretrained Model2Vec model
111
+ model = StaticModel.from_pretrained("gte-multilingual-base-m2v-768")
112
+
113
+ # Compute text embeddings
114
+ embeddings = model.encode(["Example sentence"])
115
+ ```
116
+
117
+ ### Using Sentence Transformers
118
+
119
+ You can also use the [Sentence Transformers library](https://github.com/UKPLab/sentence-transformers) to load and use the model:
120
+
121
+ ```python
122
+ from sentence_transformers import SentenceTransformer
123
+
124
+ # Load a pretrained Sentence Transformer model
125
+ model = SentenceTransformer("gte-multilingual-base-m2v-768")
126
+
127
+ # Compute text embeddings
128
+ embeddings = model.encode(["Example sentence"])
129
+ ```
130
+
131
+ ### Distilling a Model2Vec model
132
+
133
+ You can distill a Model2Vec model from a Sentence Transformer model using the `distill` method. First, install the `distill` extra with `pip install model2vec[distill]`. Then, run the following code:
134
+
135
+ ```python
136
+ from model2vec.distill import distill
137
+
138
+ # Distill a Sentence Transformer model, in this case the BAAI/bge-base-en-v1.5 model
139
+ m2v_model = distill(model_name="BAAI/bge-base-en-v1.5", pca_dims=256)
140
+
141
+ # Save the model
142
+ m2v_model.save_pretrained("m2v_model")
143
+ ```
144
+
145
+ ## How it works
146
+
147
+ 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.
148
+
149
+ 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 [SIF weighting](https://openreview.net/pdf?id=SyK00v5xx). During inference, we simply take the mean of all token embeddings occurring in a sentence.
150
+
151
+ ## Additional Resources
152
+
153
+ - [Model2Vec Repo](https://github.com/MinishLab/model2vec)
154
+ - [Model2Vec Base Models](https://huggingface.co/collections/minishlab/model2vec-base-models-66fd9dd9b7c3b3c0f25ca90e)
155
+ - [Model2Vec Results](https://github.com/MinishLab/model2vec/tree/main/results)
156
+ - [Model2Vec Tutorials](https://github.com/MinishLab/model2vec/tree/main/tutorials)
157
+ - [Website](https://minishlab.github.io/)
158
+
159
+
160
+ ## Library Authors
161
+
162
+ 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).
163
+
164
+ ## Citation
165
+
166
+ Please cite the [Model2Vec repository](https://github.com/MinishLab/model2vec) if you use this model in your work.
167
+ ```
168
+ @article{minishlab2024model2vec,
169
+ author = {Tulkens, Stephan and {van Dongen}, Thomas},
170
+ title = {Model2Vec: Fast State-of-the-Art Static Embeddings},
171
+ year = {2024},
172
+ url = {https://github.com/MinishLab/model2vec}
173
+ }
174
+ ```
config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model_type": "model2vec",
3
+ "architectures": [
4
+ "StaticModel"
5
+ ],
6
+ "tokenizer_name": "Alibaba-NLP/gte-multilingual-base",
7
+ "apply_pca": 768,
8
+ "sif_coefficient": 1e-05,
9
+ "hidden_dim": 768,
10
+ "seq_length": 1000000,
11
+ "normalize": true,
12
+ "pooling": "last",
13
+ "embedding_dtype": "int8"
14
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4adbf76d473bb68f8e9b5770a7958401f11b7e252c5495ff722c39d5509e29a0
3
+ size 194100272
modules.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "idx": 0,
4
+ "name": "0",
5
+ "path": ".",
6
+ "type": "sentence_transformers.models.StaticEmbedding"
7
+ },
8
+ {
9
+ "idx": 1,
10
+ "name": "1",
11
+ "path": "1_Normalize",
12
+ "type": "sentence_transformers.models.Normalize"
13
+ }
14
+ ]
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff