Views
No views yet
pip install model2vecfrom_pretrained method:1from model2vec import StaticModel
2
3# Load a pretrained Model2Vec model
4model = StaticModel.from_pretrained("minishlab/M2V_base_output")
5
6# Compute text embeddings
7embeddings = model.encode(["Example sentence"])distill method:1from model2vec.distill import distill
2
3# Choose a Sentence Transformer model
4model_name = "BAAI/bge-base-en-v1.5"
5
6# Distill the model
7m2v_model = distill(model_name=model_name, pca_dims=256)
8
9# Save the model
10m2v_model.save_pretrained("m2v_model")| Model | Avg (All) | Avg (MTEB) | Class | Clust | PairClass | Rank | Ret | STS | Sum | Pearl | WordSim |
|---|---|---|---|---|---|---|---|---|---|---|---|
| all-MiniLM-L6-v2 | 55.80 | 55.93 | 69.25 | 44.90 | 82.37 | 47.14 | 42.92 | 78.95 | 25.96 | 60.83 | 49.91 |
| potion-base-32M | 52.83 | 52.13 | 71.70 | 41.25 | 78.17 | 42.45 | 32.67 | 73.93 | 24.74 | 55.37 | 55.15 |
| potion-base-8M | 51.32 | 51.08 | 70.34 | 39.74 | 76.62 | 41.79 | 31.11 | 72.91 | 25.06 | 53.54 | 50.75 |
| potion-base-4M | 50.01 | 49.77 | 68.00 | 39.47 | 75.37 | 41.41 | 28.43 | 71.87 | 23.82 | 52.55 | 49.21 |
| M2V_base_output | 48.77 | 47.96 | 66.84 | 33.96 | 74.90 | 39.31 | 25.36 | 68.76 | 26.61 | 54.02 | 49.18 |
| potion-base-2M | 47.55 | 47.49 | 64.13 | 37.53 | 73.72 | 40.46 | 22.99 | 69.77 | 23.80 | 50.82 | 44.72 |
| GloVe_300d | 45.49 | 45.82 | 62.73 | 37.10 | 72.48 | 38.28 | 21.80 | 61.52 | 26.81 | 45.65 | 43.05 |
| BPEmb_50k_300d | 42.33 | 41.74 | 61.72 | 35.17 | 57.86 | 37.26 | 15.36 | 55.30 | 29.49 | 47.56 | 41.28 |
1@software{minishlab2024model2vec,
2 author = {Stephan Tulkens and {van Dongen}, Thomas},
3 title = {Model2Vec: Fast State-of-the-Art Static Embeddings},
4 year = {2024},
5 publisher = {Zenodo},
6 doi = {10.5281/zenodo.17270888},
7 url = {https://github.com/MinishLab/model2vec},
8 license = {MIT}
9}