Pringled commited on
Commit
ec8e266
·
verified ·
1 Parent(s): 0972166

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +22 -24
README.md CHANGED
@@ -5,6 +5,8 @@ model_name: potion-retrieval-512dim-60kvocab-v1replica-v1
5
  tags:
6
  - embeddings
7
  - static-embeddings
 
 
8
  ---
9
 
10
  ```
@@ -21,9 +23,15 @@ PEARL 49.31
21
  WordSim 50.02
22
  ```
23
 
24
- # potion-retrieval-512dim-60kvocab-v1replica-v1 Model Card
 
 
 
 
 
 
 
25
 
26
- 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.
27
 
28
 
29
  ## Installation
@@ -37,39 +45,29 @@ pip install model2vec
37
  Load this model using the `from_pretrained` method:
38
  ```python
39
  from model2vec import StaticModel
40
-
41
  # Load a pretrained Model2Vec model
42
- model = StaticModel.from_pretrained("potion-retrieval-512dim-60kvocab-v1replica-v1")
43
-
44
  # Compute text embeddings
45
  embeddings = model.encode(["Example sentence"])
46
  ```
47
 
48
- Alternatively, you can distill your own model using the `distill` method:
49
- ```python
50
- from model2vec.distill import distill
51
-
52
- # Choose a Sentence Transformer model
53
- model_name = "BAAI/bge-base-en-v1.5"
54
-
55
- # Distill the model
56
- m2v_model = distill(model_name=model_name, pca_dims=256)
57
-
58
- # Save the model
59
- m2v_model.save_pretrained("m2v_model")
60
- ```
61
 
62
  ## How it works
63
 
64
- 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.
 
 
 
 
65
 
66
- 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.
67
 
68
  ## Additional Resources
69
 
70
  - [All Model2Vec models on the hub](https://huggingface.co/models?library=model2vec)
71
  - [Model2Vec Repo](https://github.com/MinishLab/model2vec)
72
- - [Model2Vec Results](https://github.com/MinishLab/model2vec?tab=readme-ov-file#results)
 
73
  - [Model2Vec Tutorials](https://github.com/MinishLab/model2vec/tree/main/tutorials)
74
 
75
  ## Library Authors
@@ -81,10 +79,10 @@ Model2Vec was developed by the [Minish Lab](https://github.com/MinishLab) team c
81
  Please cite the [Model2Vec repository](https://github.com/MinishLab/model2vec) if you use this model in your work.
82
  ```
83
  @software{minishlab2024model2vec,
84
- authors = {Stephan Tulkens, Thomas van Dongen},
85
- title = {Model2Vec: Turn any Sentence Transformer into a Small Fast Model},
86
  year = {2024},
87
- url = {https://github.com/MinishLab/model2vec},
88
  }
89
  ```
90
 
 
5
  tags:
6
  - embeddings
7
  - static-embeddings
8
+ - mteb
9
+ - sentence-transformers
10
  ---
11
 
12
  ```
 
23
  WordSim 50.02
24
  ```
25
 
26
+ # potion-retrieval-32M Model Card
27
+
28
+ <div align="center">
29
+ <img width="35%" alt="Model2Vec logo" src="https://raw.githubusercontent.com/MinishLab/model2vec/main/assets/images/logo_v2.png">
30
+ </div>
31
+
32
+
33
+ This [Model2Vec](https://github.com/MinishLab/model2vec) model is pre-trained using [Tokenlearn](https://github.com/MinishLab/tokenlearn). It 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. It uses a larger vocabulary size than the [potion-science-8M](https://huggingface.co/minishlab/potion-base-8M) model which can be beneficial for tasks that require a larger vocabulary.
34
 
 
35
 
36
 
37
  ## Installation
 
45
  Load this model using the `from_pretrained` method:
46
  ```python
47
  from model2vec import StaticModel
 
48
  # Load a pretrained Model2Vec model
49
+ model = StaticModel.from_pretrained("minishlab/potion-retrieval-32M")
 
50
  # Compute text embeddings
51
  embeddings = model.encode(["Example sentence"])
52
  ```
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
  ## How it works
56
 
57
+ Model2vec creates a small, static model that outperforms other static embedding models by a large margin on all tasks on [MTEB](https://huggingface.co/spaces/mteb/leaderboard). This model is pre-trained using [Tokenlearn](https://github.com/MinishLab/tokenlearn). It's created using the following steps:
58
+ - Distillation: first, a model is distilled from a sentence transformer model using Model2Vec.
59
+ - Training data creation: the sentence transformer model is used to create training data by creating mean output embeddings on a large corpus.
60
+ - Training: the distilled model is trained on the training data using Tokenlearn.
61
+ - Post-training re-regularization: after training, the model is re-regularized by weighting the tokens based on their frequency, applying PCA, and finally applying [SIF weighting](https://openreview.net/pdf?id=SyK00v5xx).
62
 
63
+ The results for this model can be found on the [Model2Vec results page](https://github.com/MinishLab/model2vec/blob/main/results/README.md).
64
 
65
  ## Additional Resources
66
 
67
  - [All Model2Vec models on the hub](https://huggingface.co/models?library=model2vec)
68
  - [Model2Vec Repo](https://github.com/MinishLab/model2vec)
69
+ - [Tokenlearn repo](https://github.com/MinishLab/tokenlearn)
70
+ - [Model2Vec Results](https://github.com/MinishLab/model2vec/blob/main/results/README.md)
71
  - [Model2Vec Tutorials](https://github.com/MinishLab/model2vec/tree/main/tutorials)
72
 
73
  ## Library Authors
 
79
  Please cite the [Model2Vec repository](https://github.com/MinishLab/model2vec) if you use this model in your work.
80
  ```
81
  @software{minishlab2024model2vec,
82
+ authors = {Stephan Tulkens and Thomas van Dongen},
83
+ title = {Model2Vec: The Fastest State-of-the-Art Static Embeddings in the World},
84
  year = {2024},
85
+ url = {https://github.com/MinishLab/model2vec}
86
  }
87
  ```
88