sky-2002 commited on
Commit
43c2280
·
verified ·
1 Parent(s): c31b745

Upload folder using huggingface_hub

Browse files
Files changed (5) hide show
  1. README.md +82 -0
  2. config.json +12 -0
  3. model.safetensors +3 -0
  4. modules.json +8 -0
  5. tokenizer.json +0 -0
README.md ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: NovaSearch/stella_en_400M_v5
3
+ library_name: model2vec
4
+ license: mit
5
+ model_name: novasearch-stella-400M-distilled-256-v0
6
+ tags:
7
+ - embeddings
8
+ - static-embeddings
9
+ - sentence-transformers
10
+ ---
11
+
12
+ # novasearch-stella-400M-distilled-256-v0 Model Card
13
+
14
+ This [Model2Vec](https://github.com/MinishLab/model2vec) model is a distilled version of the [NovaSearch/stella_en_400M_v5](https://huggingface.co/NovaSearch/stella_en_400M_v5) 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.
15
+
16
+
17
+ ## Evaluation Results
18
+ Model | STS | WordSim
19
+ ----|---|---|
20
+ `sky-2002/novasearch-stella-400M-distilled-256-v0`|62.44|51.06
21
+
22
+ ## Installation
23
+
24
+ Install model2vec using pip:
25
+ ```
26
+ pip install model2vec
27
+ ```
28
+
29
+ ## Usage
30
+ Load this model using the `from_pretrained` method:
31
+ ```python
32
+ from model2vec import StaticModel
33
+
34
+ # Load a pretrained Model2Vec model
35
+ model = StaticModel.from_pretrained("novasearch-stella-400M-distilled-256-v0")
36
+
37
+ # Compute text embeddings
38
+ embeddings = model.encode(["Example sentence"])
39
+ ```
40
+
41
+ Alternatively, you can distill your own model using the `distill` method:
42
+ ```python
43
+ from model2vec.distill import distill
44
+
45
+ # Choose a Sentence Transformer model
46
+ model_name = "BAAI/bge-base-en-v1.5"
47
+
48
+ # Distill the model
49
+ m2v_model = distill(model_name=model_name, pca_dims=256)
50
+
51
+ # Save the model
52
+ m2v_model.save_pretrained("m2v_model")
53
+ ```
54
+
55
+ ## How it works
56
+
57
+ 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.
58
+
59
+ 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.
60
+
61
+ ## Additional Resources
62
+
63
+ - [All Model2Vec models on the hub](https://huggingface.co/models?library=model2vec)
64
+ - [Model2Vec Repo](https://github.com/MinishLab/model2vec)
65
+ - [Model2Vec Results](https://github.com/MinishLab/model2vec?tab=readme-ov-file#results)
66
+ - [Model2Vec Tutorials](https://github.com/MinishLab/model2vec/tree/main/tutorials)
67
+
68
+ ## Library Authors
69
+
70
+ 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).
71
+
72
+ ## Citation
73
+
74
+ Please cite the [Model2Vec repository](https://github.com/MinishLab/model2vec) if you use this model in your work.
75
+ ```
76
+ @software{minishlab2024model2vec,
77
+ authors = {Stephan Tulkens, Thomas van Dongen},
78
+ title = {Model2Vec: Turn any Sentence Transformer into a Small Fast Model},
79
+ year = {2024},
80
+ url = {https://github.com/MinishLab/model2vec},
81
+ }
82
+ ```
config.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model_type": "model2vec",
3
+ "architectures": [
4
+ "StaticModel"
5
+ ],
6
+ "tokenizer_name": "NovaSearch/stella_en_400M_v5",
7
+ "apply_pca": 256,
8
+ "apply_zipf": true,
9
+ "hidden_dim": 256,
10
+ "seq_length": 1000000,
11
+ "normalize": false
12
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:73114afd34bd5803bcf5b6396b6322f8964d87e12ddff74337e126458241895a
3
+ size 30236760
modules.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "idx": 0,
4
+ "name": "0",
5
+ "path": ".",
6
+ "type": "sentence_transformers.models.StaticEmbedding"
7
+ }
8
+ ]
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff