FlukeTJ commited on
Commit
def51fe
1 Parent(s): 36541b9

Upload folder using huggingface_hub

Browse files
Files changed (5) hide show
  1. .gitattributes +1 -0
  2. README.md +76 -0
  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 ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: BAAI/bge-m3
3
+ library_name: model2vec
4
+ license: mit
5
+ model_name: FlukeTJ/bge-m3-m2v-distilled-256
6
+ tags:
7
+ - embeddings
8
+ - static-embeddings
9
+ ---
10
+
11
+ # FlukeTJ/bge-m3-m2v-distilled-256 Model Card
12
+
13
+ This [Model2Vec](https://github.com/MinishLab/model2vec) model is a distilled version of the [BAAI/bge-m3](https://huggingface.co/BAAI/bge-m3) 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.
14
+
15
+
16
+ ## Installation
17
+
18
+ Install model2vec using pip:
19
+ ```
20
+ pip install model2vec
21
+ ```
22
+
23
+ ## Usage
24
+ Load this model using the `from_pretrained` method:
25
+ ```python
26
+ from model2vec import StaticModel
27
+
28
+ # Load a pretrained Model2Vec model
29
+ model = StaticModel.from_pretrained("FlukeTJ/bge-m3-m2v-distilled-256")
30
+
31
+ # Compute text embeddings
32
+ embeddings = model.encode(["Example sentence"])
33
+ ```
34
+
35
+ Alternatively, you can distill your own model using the `distill` method:
36
+ ```python
37
+ from model2vec.distill import distill
38
+
39
+ # Choose a Sentence Transformer model
40
+ model_name = "BAAI/bge-base-en-v1.5"
41
+
42
+ # Distill the model
43
+ m2v_model = distill(model_name=model_name, pca_dims=256)
44
+
45
+ # Save the model
46
+ m2v_model.save_pretrained("m2v_model")
47
+ ```
48
+
49
+ ## How it works
50
+
51
+ 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.
52
+
53
+ 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.
54
+
55
+ ## Additional Resources
56
+
57
+ - [All Model2Vec models on the hub](https://huggingface.co/models?library=model2vec)
58
+ - [Model2Vec Repo](https://github.com/MinishLab/model2vec)
59
+ - [Model2Vec Results](https://github.com/MinishLab/model2vec?tab=readme-ov-file#results)
60
+ - [Model2Vec Tutorials](https://github.com/MinishLab/model2vec/tree/main/tutorials)
61
+
62
+ ## Library Authors
63
+
64
+ 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).
65
+
66
+ ## Citation
67
+
68
+ Please cite the [Model2Vec repository](https://github.com/MinishLab/model2vec) if you use this model in your work.
69
+ ```
70
+ @software{minishlab2024model2vec,
71
+ authors = {Stephan Tulkens, Thomas van Dongen},
72
+ title = {Model2Vec: Turn any Sentence Transformer into a Small Fast Model},
73
+ year = {2024},
74
+ url = {https://github.com/MinishLab/model2vec},
75
+ }
76
+ ```
config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"tokenizer_name": "BAAI/bge-m3", "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:899b5556b89553331329bb3f340be6f831de763b8f56ef69ffd07ca137d609f1
3
+ size 256002136
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:249df0778f236f6ece390de0de746838ef25b9d6954b68c2ee71249e0a9d8fd4
3
+ size 17082799