Pringled commited on
Commit
10e7d45
1 Parent(s): 23f4494

Upload folder using huggingface_hub

Browse files
Files changed (4) hide show
  1. README.md +78 -0
  2. config.json +1 -0
  3. model.safetensors +3 -0
  4. tokenizer.json +0 -0
README.md ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: BAAI/bge-base-en-v1.5
3
+ language:
4
+ - en
5
+ library_name: model2vec
6
+ license: mit
7
+ model_name: M2V_base_glove_subword
8
+ tags:
9
+ - embeddings
10
+ - static-embeddings
11
+ ---
12
+
13
+ # M2V_base_glove_subword Model Card
14
+
15
+ This [Model2Vec](https://github.com/MinishLab/model2vec) model is a distilled version of the [BAAI/bge-base-en-v1.5](https://huggingface.co/BAAI/bge-base-en-v1.5) 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("M2V_base_glove_subword")
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-base-en-v1.5", "apply_pca": 256, "apply_zipf": true, "normalize": false}
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dadf5028e4ce6617f54c6e0164b474ac4a6ae26f46fd61accf308961c9c34bb3
3
+ size 410397784
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff