sky-2002 commited on
Commit
c88d733
·
verified ·
1 Parent(s): a8b56c0

Upload folder using huggingface_hub

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