Update README.md
Browse files
README.md
CHANGED
@@ -1,15 +1,20 @@
|
|
1 |
---
|
2 |
library_name: model2vec
|
3 |
license: mit
|
4 |
-
model_name: potion-science-
|
5 |
tags:
|
6 |
- embeddings
|
7 |
- static-embeddings
|
8 |
---
|
9 |
|
10 |
-
# potion-science-
|
11 |
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
|
15 |
## Installation
|
@@ -25,37 +30,29 @@ Load this model using the `from_pretrained` method:
|
|
25 |
from model2vec import StaticModel
|
26 |
|
27 |
# Load a pretrained Model2Vec model
|
28 |
-
model = StaticModel.from_pretrained("potion-science-
|
29 |
|
30 |
# Compute text embeddings
|
31 |
embeddings = model.encode(["Example sentence"])
|
32 |
```
|
33 |
|
34 |
-
Alternatively, you can distill your own model using the `distill` method:
|
35 |
-
```python
|
36 |
-
from model2vec.distill import distill
|
37 |
-
|
38 |
-
# Choose a Sentence Transformer model
|
39 |
-
model_name = "BAAI/bge-base-en-v1.5"
|
40 |
-
|
41 |
-
# Distill the model
|
42 |
-
m2v_model = distill(model_name=model_name, pca_dims=256)
|
43 |
-
|
44 |
-
# Save the model
|
45 |
-
m2v_model.save_pretrained("m2v_model")
|
46 |
-
```
|
47 |
|
48 |
## How it works
|
49 |
|
50 |
-
Model2vec creates a small,
|
|
|
|
|
|
|
|
|
51 |
|
52 |
-
|
53 |
|
54 |
## Additional Resources
|
55 |
|
56 |
- [All Model2Vec models on the hub](https://huggingface.co/models?library=model2vec)
|
57 |
- [Model2Vec Repo](https://github.com/MinishLab/model2vec)
|
58 |
-
- [
|
|
|
59 |
- [Model2Vec Tutorials](https://github.com/MinishLab/model2vec/tree/main/tutorials)
|
60 |
|
61 |
## Library Authors
|
|
|
1 |
---
|
2 |
library_name: model2vec
|
3 |
license: mit
|
4 |
+
model_name: potion-science-8M
|
5 |
tags:
|
6 |
- embeddings
|
7 |
- static-embeddings
|
8 |
---
|
9 |
|
10 |
+
# potion-science-8M Model Card
|
11 |
|
12 |
+
<div align="center">
|
13 |
+
<img width="35%" alt="Model2Vec logo" src="https://raw.githubusercontent.com/MinishLab/model2vec/main/assets/images/logo_v2.png">
|
14 |
+
</div>
|
15 |
+
|
16 |
+
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.
|
17 |
+
This model is pre-trained on the [scientific_papers](https://huggingface.co/datasets/armanc/scientific_papers) dataset consisting of scientific papers from Arxiv and Pubmed.
|
18 |
|
19 |
|
20 |
## Installation
|
|
|
30 |
from model2vec import StaticModel
|
31 |
|
32 |
# Load a pretrained Model2Vec model
|
33 |
+
model = StaticModel.from_pretrained("minishlab/potion-science-8M")
|
34 |
|
35 |
# Compute text embeddings
|
36 |
embeddings = model.encode(["Example sentence"])
|
37 |
```
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
## How it works
|
41 |
|
42 |
+
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:
|
43 |
+
- Distillation: first, a model is distilled from a sentence transformer model using Model2Vec.
|
44 |
+
- Training data creation: the sentence transformer model is used to create training data by creating mean output embeddings on a large corpus.
|
45 |
+
- Training: the distilled model is trained on the training data using Tokenlearn.
|
46 |
+
- 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).
|
47 |
|
48 |
+
The results for this model can be found on the [Model2Vec results page](https://github.com/MinishLab/model2vec/blob/main/results/README.md).
|
49 |
|
50 |
## Additional Resources
|
51 |
|
52 |
- [All Model2Vec models on the hub](https://huggingface.co/models?library=model2vec)
|
53 |
- [Model2Vec Repo](https://github.com/MinishLab/model2vec)
|
54 |
+
- [Tokenlearn repo](https://github.com/MinishLab/tokenlearn)
|
55 |
+
- [Model2Vec Results](https://github.com/MinishLab/model2vec/blob/main/results/README.md)
|
56 |
- [Model2Vec Tutorials](https://github.com/MinishLab/model2vec/tree/main/tutorials)
|
57 |
|
58 |
## Library Authors
|