tomaarsen HF staff commited on
Commit
6b211a2
1 Parent(s): c7c8195

Upload folder using huggingface_hub

Browse files
Files changed (4) hide show
  1. README.md +69 -0
  2. config.json +1 -0
  3. embeddings.safetensors +3 -0
  4. tokenizer.json +0 -0
README.md ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: mixedbread-ai/mxbai-embed-large-v1
3
+ language:
4
+ - en
5
+ library_name: model2vec
6
+ license: mit
7
+ model_name: tomaarsen/mxbai-embed-large-v1-distilled
8
+ tags:
9
+ - embeddings
10
+ - static-embeddings
11
+ ---
12
+
13
+ # tomaarsen/mxbai-embed-large-v1-distilled Model Card
14
+
15
+ Model2Vec distills a Sentence Transformer into a small, static model.
16
+ This model is ideal for applications requiring fast, lightweight embeddings.
17
+
18
+
19
+
20
+ ## Installation
21
+
22
+ Install model2vec using pip:
23
+ ```
24
+ pip install model2vec
25
+ ```
26
+
27
+ ## Usage
28
+ A StaticModel can be loaded using the `from_pretrained` method:
29
+ ```python
30
+ from model2vec import StaticModel
31
+
32
+ model = StaticModel.from_pretrained("tomaarsen/mxbai-embed-large-v1-distilled")
33
+
34
+ embeddings = model.encode(["Example sentence"])
35
+ ```
36
+
37
+ Alternatively, you can distill your own model using the `distill` method:
38
+ ```python
39
+ from model2vec.distill import distill
40
+
41
+ # Choose a Sentence Transformer model
42
+ model_name = "BAAI/bge-base-en-v1.5"
43
+
44
+ # Distill the model
45
+ m2v_model = distill(model_name=model_name, pca_dims=256)
46
+
47
+ # Save the model
48
+ m2v_model.save_pretrained("m2v_model")
49
+ ```
50
+
51
+ ## How it works
52
+
53
+ 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.
54
+
55
+ 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.
56
+
57
+ ## Citation
58
+
59
+ Please cite the [Model2Vec repository](https://github.com/MinishLab/model2vec) if you use this model in your work.
60
+
61
+ ## Additional Resources
62
+
63
+ - [Model2Vec Repo](https://github.com/MinishLab/model2vec)
64
+ - [Model2Vec Results](https://github.com/MinishLab/model2vec?tab=readme-ov-file#results)
65
+ - [Model2Vec Tutorials](https://github.com/MinishLab/model2vec/tree/main/tutorials)
66
+
67
+ ## Model Authors
68
+
69
+ Model2Vec was developed by the [Minish Lab](https://github.com/MinishLab) team consisting of Stephan Tulkens and Thomas van Dongen.
config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"tokenizer_name": "mixedbread-ai/mxbai-embed-large-v1", "apply_pca": null, "apply_zipf": true, "normalize": false}
embeddings.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b543b5feef4139dc3d4bc49e19f3053ebfb2f8fc8d5b5b947b1bfc0669ebf637
3
+ size 120946776
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff