seregadgl commited on
Commit
674fcf0
1 Parent(s): 68b646e

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: seregadgl/encoder_test_v2
3
+ library_name: model2vec
4
+ license: mit
5
+ model_name: seregadgl/splade_dist
6
+ tags:
7
+ - embeddings
8
+ - static-embeddings
9
+ ---
10
+
11
+ # seregadgl/splade_dist Model Card
12
+
13
+ This [Model2Vec](https://github.com/MinishLab/model2vec) model is a distilled version of the [seregadgl/encoder_test_v2](https://huggingface.co/seregadgl/encoder_test_v2) 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("seregadgl/splade_dist")
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": "seregadgl/encoder_test_v2", "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:c3df7b3ee49a8e079fa9a4eb896ba83f5a543ef1459eb8b16e4185b5f7709fc9
3
+ size 512004184
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3a56def25aa40facc030ea8b0b87f3688e4b3c39eb8b45d5702b3a1300fe2a20
3
+ size 17082734