seregadgl commited on
Commit
4a04064
1 Parent(s): 1123b25

Upload folder using huggingface_hub

Browse files
Files changed (5) hide show
  1. .gitattributes +1 -0
  2. README.md +78 -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,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: BAAI/bge-reranker-v2-gemma
3
+ language:
4
+ - multilingual
5
+ library_name: model2vec
6
+ license: mit
7
+ model_name: seregadgl/gemma_dist
8
+ tags:
9
+ - embeddings
10
+ - static-embeddings
11
+ ---
12
+
13
+ # seregadgl/gemma_dist Model Card
14
+
15
+ This [Model2Vec](https://github.com/MinishLab/model2vec) model is a distilled version of the [BAAI/bge-reranker-v2-gemma](https://huggingface.co/BAAI/bge-reranker-v2-gemma) 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.
16
+
17
+
18
+ ## Installation
19
+
20
+ Install model2vec using pip:
21
+ ```
22
+ pip install model2vec
23
+ ```
24
+
25
+ ## Usage
26
+ Load this model using the `from_pretrained` method:
27
+ ```python
28
+ from model2vec import StaticModel
29
+
30
+ # Load a pretrained Model2Vec model
31
+ model = StaticModel.from_pretrained("seregadgl/gemma_dist")
32
+
33
+ # Compute text embeddings
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
+ ## Additional Resources
58
+
59
+ - [All Model2Vec models on the hub](https://huggingface.co/models?library=model2vec)
60
+ - [Model2Vec Repo](https://github.com/MinishLab/model2vec)
61
+ - [Model2Vec Results](https://github.com/MinishLab/model2vec?tab=readme-ov-file#results)
62
+ - [Model2Vec Tutorials](https://github.com/MinishLab/model2vec/tree/main/tutorials)
63
+
64
+ ## Library Authors
65
+
66
+ 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).
67
+
68
+ ## Citation
69
+
70
+ Please cite the [Model2Vec repository](https://github.com/MinishLab/model2vec) if you use this model in your work.
71
+ ```
72
+ @software{minishlab2024model2vec,
73
+ authors = {Stephan Tulkens, Thomas van Dongen},
74
+ title = {Model2Vec: Turn any Sentence Transformer into a Small Fast Model},
75
+ year = {2024},
76
+ url = {https://github.com/MinishLab/model2vec},
77
+ }
78
+ ```
config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"tokenizer_name": "BAAI/bge-reranker-v2-gemma", "apply_pca": 512, "apply_zipf": true, "hidden_dim": 512, "seq_length": 1000000, "normalize": false}
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bb3095f5637d1c9e571e935c421cf94a3282028ae31ad65f55ad2de3ca123ba2
3
+ size 524288088
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a63c485bbbab0efcfc1ffe32fd177108a9f70be1875ea3aacad3c4f064a5974b
3
+ size 34315097