CISCai commited on
Commit
f82e4b7
1 Parent(s): 54cf499

Upload 4 files

Browse files
Files changed (5) hide show
  1. .gitattributes +1 -0
  2. README.md +185 -3
  3. config.json +1 -0
  4. model.safetensors +3 -0
  5. 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 CHANGED
@@ -1,3 +1,185 @@
1
- ---
2
- license: cc-by-nc-4.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: jinaai/jina-embeddings-v3
3
+ language:
4
+ - multilingual
5
+ - af
6
+ - am
7
+ - ar
8
+ - as
9
+ - az
10
+ - be
11
+ - bg
12
+ - bn
13
+ - br
14
+ - bs
15
+ - ca
16
+ - cs
17
+ - cy
18
+ - da
19
+ - de
20
+ - el
21
+ - en
22
+ - eo
23
+ - es
24
+ - et
25
+ - eu
26
+ - fa
27
+ - fi
28
+ - fr
29
+ - fy
30
+ - ga
31
+ - gd
32
+ - gl
33
+ - gu
34
+ - ha
35
+ - he
36
+ - hi
37
+ - hr
38
+ - hu
39
+ - hy
40
+ - id
41
+ - is
42
+ - it
43
+ - ja
44
+ - jv
45
+ - ka
46
+ - kk
47
+ - km
48
+ - kn
49
+ - ko
50
+ - ku
51
+ - ky
52
+ - la
53
+ - lo
54
+ - lt
55
+ - lv
56
+ - mg
57
+ - mk
58
+ - ml
59
+ - mn
60
+ - mr
61
+ - ms
62
+ - my
63
+ - ne
64
+ - nl
65
+ - 'no'
66
+ - om
67
+ - or
68
+ - pa
69
+ - pl
70
+ - ps
71
+ - pt
72
+ - ro
73
+ - ru
74
+ - sa
75
+ - sd
76
+ - si
77
+ - sk
78
+ - sl
79
+ - so
80
+ - sq
81
+ - sr
82
+ - su
83
+ - sv
84
+ - sw
85
+ - ta
86
+ - te
87
+ - th
88
+ - tl
89
+ - tr
90
+ - ug
91
+ - uk
92
+ - ur
93
+ - uz
94
+ - vi
95
+ - xh
96
+ - yi
97
+ - zh
98
+ library_name: model2vec
99
+ model_name: jina-embeddings-v3-query-distilled
100
+ license: cc-by-nc-4.0
101
+ tags:
102
+ - embeddings
103
+ - static-embeddings
104
+ - feature-extraction
105
+ - sentence-similarity
106
+ - sentence-transformers
107
+ ---
108
+
109
+ # jina-embeddings-v3-query-distilled Model Card
110
+
111
+ This [Model2Vec](https://github.com/MinishLab/model2vec) model is a distilled version of the [jinaai/jina-embeddings-v3](https://huggingface.co/jinaai/jina-embeddings-v3) Sentence Transformer with the `retrieval.query` task LoRA applied. 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.
112
+
113
+
114
+ ## Installation
115
+
116
+ Install model2vec using pip:
117
+ ```
118
+ pip install model2vec
119
+ ```
120
+
121
+ ## Usage
122
+ Load this model using the `from_pretrained` method:
123
+ ```python
124
+ from model2vec import StaticModel
125
+
126
+ # Load a pretrained Model2Vec model
127
+ model = StaticModel.from_pretrained("CISCai/jina-embeddings-v3-query-distilled")
128
+
129
+ # Compute text embeddings
130
+ embeddings = model.encode(["Example sentence"])
131
+ ```
132
+
133
+ The following code snippet shows how to load a Model2Vec model into a Sentence Transformer model:
134
+ ```python
135
+ from sentence_transformers import SentenceTransformer
136
+ from sentence_transformers.models import StaticEmbedding
137
+
138
+ # Initialize a StaticEmbedding module
139
+ static_embedding = StaticEmbedding.from_model2vec("CISCai/jina-embeddings-v3-query-distilled")
140
+ model = SentenceTransformer(modules=[static_embedding])
141
+ embeddings = model.encode(["Example sentence"])
142
+ ```
143
+
144
+ Alternatively, you can distill your own model using the `distill` method:
145
+ ```python
146
+ from model2vec.distill import distill
147
+
148
+ # Choose a Sentence Transformer model
149
+ model_name = "BAAI/bge-base-en-v1.5"
150
+
151
+ # Distill the model
152
+ m2v_model = distill(model_name=model_name, pca_dims=256)
153
+
154
+ # Save the model
155
+ m2v_model.save_pretrained("m2v_model")
156
+ ```
157
+
158
+ ## How it works
159
+
160
+ 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.
161
+
162
+ 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.
163
+
164
+ ## Additional Resources
165
+
166
+ - [All Model2Vec models on the hub](https://huggingface.co/models?library=model2vec)
167
+ - [Model2Vec Repo](https://github.com/MinishLab/model2vec)
168
+ - [Model2Vec Results](https://github.com/MinishLab/model2vec?tab=readme-ov-file#results)
169
+ - [Model2Vec Tutorials](https://github.com/MinishLab/model2vec/tree/main/tutorials)
170
+
171
+ ## Library Authors
172
+
173
+ 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).
174
+
175
+ ## Citation
176
+
177
+ Please cite the [Model2Vec repository](https://github.com/MinishLab/model2vec) if you use this model in your work.
178
+ ```
179
+ @software{minishlab2024model2vec,
180
+ authors = {Stephan Tulkens, Thomas van Dongen},
181
+ title = {Model2Vec: Turn any Sentence Transformer into a Small Fast Model},
182
+ year = {2024},
183
+ url = {https://github.com/MinishLab/model2vec},
184
+ }
185
+ ```
config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"tokenizer_name": "jinaai/jina-embeddings-v3", "apply_pca": 256, "apply_zipf": true, "hidden_dim": 256, "seq_length": 1000000, "normalize": false}
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:302c52c2888df6ef361d45d20b7c490d9c9a0d83a1bad56f9e171a529ad3e060
3
+ size 256002136
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3a56def25aa40facc030ea8b0b87f3688e4b3c39eb8b45d5702b3a1300fe2a20
3
+ size 17082734