Pringled commited on
Commit
4d51b5b
·
verified ·
1 Parent(s): e7421cd

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +20 -36
README.md CHANGED
@@ -10,7 +10,12 @@ tags:
10
 
11
  # potion-multilingual-128M Model Card
12
 
13
- This [Model2Vec](https://github.com/MinishLab/model2vec) model is a distilled version of a 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. Model2Vec models are the smallest, fastest, and most performant static embedders available. The distilled models are up to 50 times smaller and 500 times faster than traditional Sentence Transformers.
 
 
 
 
 
14
 
15
 
16
  ## Installation
@@ -37,47 +42,25 @@ model = StaticModel.from_pretrained("potion-multilingual-128M")
37
  embeddings = model.encode(["Example sentence"])
38
  ```
39
 
40
- ### Using Sentence Transformers
41
-
42
- You can also use the [Sentence Transformers library](https://github.com/UKPLab/sentence-transformers) to load and use the model:
43
-
44
- ```python
45
- from sentence_transformers import SentenceTransformer
46
-
47
- # Load a pretrained Sentence Transformer model
48
- model = SentenceTransformer("potion-multilingual-128M")
49
-
50
- # Compute text embeddings
51
- embeddings = model.encode(["Example sentence"])
52
- ```
53
-
54
- ### Distilling a Model2Vec model
55
-
56
- 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:
57
-
58
- ```python
59
- from model2vec.distill import distill
60
-
61
- # Distill a Sentence Transformer model, in this case the BAAI/bge-base-en-v1.5 model
62
- m2v_model = distill(model_name="BAAI/bge-base-en-v1.5", pca_dims=256)
63
-
64
- # Save the model
65
- m2v_model.save_pretrained("m2v_model")
66
- ```
67
-
68
  ## How it works
69
 
70
- 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.
 
 
 
 
 
 
71
 
72
- 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.
73
 
74
  ## Additional Resources
75
 
 
76
  - [Model2Vec Repo](https://github.com/MinishLab/model2vec)
77
- - [Model2Vec Base Models](https://huggingface.co/collections/minishlab/model2vec-base-models-66fd9dd9b7c3b3c0f25ca90e)
78
- - [Model2Vec Results](https://github.com/MinishLab/model2vec/tree/main/results)
79
  - [Model2Vec Tutorials](https://github.com/MinishLab/model2vec/tree/main/tutorials)
80
- - [Website](https://minishlab.github.io/)
81
 
82
 
83
  ## Library Authors
@@ -86,8 +69,9 @@ Model2Vec was developed by the [Minish Lab](https://github.com/MinishLab) team c
86
 
87
  ## Citation
88
 
89
- Please cite the [Model2Vec repository](https://github.com/MinishLab/model2vec) if you use this model in your work.
90
- ```
 
91
  @article{minishlab2024model2vec,
92
  author = {Tulkens, Stephan and {van Dongen}, Thomas},
93
  title = {Model2Vec: Fast State-of-the-Art Static Embeddings},
 
10
 
11
  # potion-multilingual-128M Model Card
12
 
13
+ <div align="center">
14
+ <img width="35%" alt="Model2Vec logo" src="https://raw.githubusercontent.com/MinishLab/model2vec/main/assets/images/logo_v2.png">
15
+ </div>
16
+
17
+
18
+ This [Model2Vec](https://github.com/MinishLab/model2vec) model is pre-trained using Tokenlearn. It is a distilled version of the [BAAI/bge-m3](https://huggingface.co/BAAI/bge-m3) 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. It's a multilingual model, trained on 101 languages, and is capable of generating embeddings for any text in any language.
19
 
20
 
21
  ## Installation
 
42
  embeddings = model.encode(["Example sentence"])
43
  ```
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  ## How it works
46
 
47
+ Model2vec creates a small, static model that outperforms other static embedding models by a large margin on all tasks on MTEB. This model is pre-trained using Tokenlearn. It's created using the following steps:
48
+
49
+ - Distillation: first, a model is distilled from a sentence transformer model using Model2Vec.
50
+ - Training data creation: the sentence transformer model is used to create training data by creating mean output embeddings on a large corpus.
51
+ - Training: the distilled model is trained on the training data using Tokenlearn.
52
+ - Post-training re-regularization: after training, the model is re-regularized by weighting the tokens based on their
53
+ - frequency, applying PCA, and finally applying SIF weighting.
54
 
55
+ The results for this model can be found on the [Model2Vec results page](https://github.com/MinishLab/model2vec/blob/main/results/README.md).
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
+ - [Tokenlearn repo](https://github.com/MinishLab/tokenlearn)
62
+ - [Model2Vec Results](https://github.com/MinishLab/model2vec/blob/main/results/README.md)
63
  - [Model2Vec Tutorials](https://github.com/MinishLab/model2vec/tree/main/tutorials)
 
64
 
65
 
66
  ## Library Authors
 
69
 
70
  ## Citation
71
 
72
+ If you use Model2Vec in your research, please cite the following:
73
+
74
+ ```bibtex
75
  @article{minishlab2024model2vec,
76
  author = {Tulkens, Stephan and {van Dongen}, Thomas},
77
  title = {Model2Vec: Fast State-of-the-Art Static Embeddings},