codegood commited on
Commit
16abe27
·
verified ·
1 Parent(s): 6bae3d1

Upload folder using huggingface_hub

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