Upload folder using huggingface_hub
Browse files- README.md +72 -0
- config.json +1 -0
- model.safetensors +3 -0
- tokenizer.json +0 -0
README.md
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
library_name: model2vec
|
3 |
+
license: mit
|
4 |
+
model_name: potion-science-32M
|
5 |
+
tags:
|
6 |
+
- embeddings
|
7 |
+
- static-embeddings
|
8 |
+
---
|
9 |
+
|
10 |
+
# potion-science-32M 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. It uses a larger vocabulary size than the [potion-science-8M](https://huggingface.co/minishlab/potion-science-8M) model which can be beneficial for tasks that require a larger (specialized) vocabulary.
|
18 |
+
|
19 |
+
|
20 |
+
## Installation
|
21 |
+
|
22 |
+
Install model2vec using pip:
|
23 |
+
```
|
24 |
+
pip install model2vec
|
25 |
+
```
|
26 |
+
|
27 |
+
## Usage
|
28 |
+
Load this model using the `from_pretrained` method:
|
29 |
+
```python
|
30 |
+
from model2vec import StaticModel
|
31 |
+
|
32 |
+
# Load a pretrained Model2Vec model
|
33 |
+
model = StaticModel.from_pretrained("minishlab/potion-science-32M")
|
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
|
59 |
+
|
60 |
+
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).
|
61 |
+
|
62 |
+
## Citation
|
63 |
+
|
64 |
+
Please cite the [Model2Vec repository](https://github.com/MinishLab/model2vec) if you use this model in your work.
|
65 |
+
```
|
66 |
+
@software{minishlab2024model2vec,
|
67 |
+
authors = {Stephan Tulkens, Thomas van Dongen},
|
68 |
+
title = {Model2Vec: Turn any Sentence Transformer into a Small Fast Model},
|
69 |
+
year = {2024},
|
70 |
+
url = {https://github.com/MinishLab/model2vec},
|
71 |
+
}
|
72 |
+
```
|
config.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"tokenizer_name": "baai/bge-base-en-v1.5", "apply_pca": 256, "apply_zipf": true, "hidden_dim": 256, "seq_length": 1000000, "normalize": true}
|
model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5973432fc766d8f0fff07d4138bbb79d67854fe6af120aff2922f26b9b7e2055
|
3 |
+
size 127414360
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|