cnmoro commited on
Commit
2f9b5e1
·
verified ·
1 Parent(s): a729212

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +2 -47
README.md CHANGED
@@ -34,7 +34,7 @@ Load this model using the `from_pretrained` method:
34
  from model2vec import StaticModel
35
 
36
  # Load a pretrained Model2Vec model
37
- model = StaticModel.from_pretrained("granite-embedding-english")
38
 
39
  # Compute text embeddings
40
  embeddings = model.encode(["Example sentence"])
@@ -48,53 +48,8 @@ You can also use the [Sentence Transformers library](https://github.com/UKPLab/s
48
  from sentence_transformers import SentenceTransformer
49
 
50
  # Load a pretrained Sentence Transformer model
51
- model = SentenceTransformer("granite-embedding-english")
52
 
53
  # Compute text embeddings
54
  embeddings = model.encode(["Example sentence"])
55
- ```
56
-
57
- ### Distilling a Model2Vec model
58
-
59
- You can distill a Model2Vec model from a Sentence Transformer model using the `distill` method. First, install the `distill` extra with `pip install model2vec[distill]`. Then, run the following code:
60
-
61
- ```python
62
- from model2vec.distill import distill
63
-
64
- # Distill a Sentence Transformer model, in this case the BAAI/bge-base-en-v1.5 model
65
- m2v_model = distill(model_name="BAAI/bge-base-en-v1.5", pca_dims=256)
66
-
67
- # Save the model
68
- m2v_model.save_pretrained("m2v_model")
69
- ```
70
-
71
- ## How it works
72
-
73
- 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.
74
-
75
- 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 [SIF weighting](https://openreview.net/pdf?id=SyK00v5xx). During inference, we simply take the mean of all token embeddings occurring in a sentence.
76
-
77
- ## Additional Resources
78
-
79
- - [Model2Vec Repo](https://github.com/MinishLab/model2vec)
80
- - [Model2Vec Base Models](https://huggingface.co/collections/minishlab/model2vec-base-models-66fd9dd9b7c3b3c0f25ca90e)
81
- - [Model2Vec Results](https://github.com/MinishLab/model2vec/tree/main/results)
82
- - [Model2Vec Tutorials](https://github.com/MinishLab/model2vec/tree/main/tutorials)
83
- - [Website](https://minishlab.github.io/)
84
-
85
-
86
- ## Library Authors
87
-
88
- 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).
89
-
90
- ## Citation
91
-
92
- Please cite the [Model2Vec repository](https://github.com/MinishLab/model2vec) if you use this model in your work.
93
- ```
94
- @software{minishlab2024model2vec,
95
- authors = {Stephan Tulkens and Thomas van Dongen},
96
- title = {Model2Vec: Fast State-of-the-Art Static Embeddings},
97
- year = {2024},
98
- url = {https://github.com/MinishLab/model2vec}
99
- }
100
  ```
 
34
  from model2vec import StaticModel
35
 
36
  # Load a pretrained Model2Vec model
37
+ model = StaticModel.from_pretrained("cnmoro/granite-30m-distilled")
38
 
39
  # Compute text embeddings
40
  embeddings = model.encode(["Example sentence"])
 
48
  from sentence_transformers import SentenceTransformer
49
 
50
  # Load a pretrained Sentence Transformer model
51
+ model = SentenceTransformer("cnmoro/granite-30m-distilled")
52
 
53
  # Compute text embeddings
54
  embeddings = model.encode(["Example sentence"])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  ```