bhavnicksm
commited on
Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- README.md +59 -0
- config.json +12 -0
- model.safetensors +3 -0
- special_tokens_map.json +1 -0
- tokenizer.json +3 -0
- tokenizer_config.json +7 -0
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# dark-potion-base-150M Model Card
|
2 |
+
|
3 |
+
This [Model2Vec](https://github.com/MinishLab/model2vec) model is a distilled version of a **dark secret model** 🤫. This model was created by [Bhavnick Minhas](https://github.com/bhavnicksm) using the [Model2Vec](https://github.com/MinishLab/model2vec) library, as a proof of concept, answering the question: "Can we distill static embeddings from a Sentence Embedding API, without any access to the original model?".
|
4 |
+
|
5 |
+
The original model is a proprietary model, and the only information we have about it is the tokenizer.json file, which contains the vocabulary and special tokens. We use this information to create a new tokenizer, and then use the Model2Vec library to distill a static embedding model from the API. Note that this is perfectly legal as embeddings are owned by the user as long as they are paid for, and the user is free to use them in any way they want.
|
6 |
+
|
7 |
+
All credit goes to the [Minish Lab](https://github.com/MinishLab) team for the original model and the [Model2Vec](https://github.com/MinishLab/model2vec) library.
|
8 |
+
|
9 |
+
## Installation
|
10 |
+
|
11 |
+
Install model2vec using pip:
|
12 |
+
|
13 |
+
```bash
|
14 |
+
pip install model2vec
|
15 |
+
```
|
16 |
+
|
17 |
+
## Usage
|
18 |
+
|
19 |
+
Load this model using the `from_pretrained` method:
|
20 |
+
|
21 |
+
```python
|
22 |
+
from model2vec import StaticModel
|
23 |
+
|
24 |
+
# Load a pretrained Model2Vec model
|
25 |
+
model = StaticModel.from_pretrained("bhavnicksm/dark-potion-base-150M")
|
26 |
+
|
27 |
+
# Compute text embeddings
|
28 |
+
embeddings = model.encode(["Example sentence"])
|
29 |
+
```
|
30 |
+
|
31 |
+
## How it works
|
32 |
+
|
33 |
+
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.
|
34 |
+
|
35 |
+
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.
|
36 |
+
|
37 |
+
## Additional Resources
|
38 |
+
|
39 |
+
- [All Model2Vec models on the hub](https://huggingface.co/models?library=model2vec)
|
40 |
+
- [Model2Vec Repo](https://github.com/MinishLab/model2vec)
|
41 |
+
- [Model2Vec Results](https://github.com/MinishLab/model2vec?tab=readme-ov-file#results)
|
42 |
+
- [Model2Vec Tutorials](https://github.com/MinishLab/model2vec/tree/main/tutorials)
|
43 |
+
|
44 |
+
## Library Authors
|
45 |
+
|
46 |
+
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).
|
47 |
+
|
48 |
+
## Citation
|
49 |
+
|
50 |
+
Please cite the [Model2Vec repository](https://github.com/MinishLab/model2vec) if you use this model in your work.
|
51 |
+
|
52 |
+
```bibtex
|
53 |
+
@software{minishlab2024model2vec,
|
54 |
+
authors = {Stephan Tulkens, Thomas van Dongen},
|
55 |
+
title = {Model2Vec: Turn any Sentence Transformer into a Small Fast Model},
|
56 |
+
year = {2024},
|
57 |
+
url = {https://github.com/MinishLab/model2vec},
|
58 |
+
}
|
59 |
+
```
|
config.json
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"model_type": "model2vec",
|
3 |
+
"architectures": [
|
4 |
+
"StaticModel"
|
5 |
+
],
|
6 |
+
"tokenizer_name": "cl100k_base",
|
7 |
+
"apply_pca": 1536,
|
8 |
+
"apply_zipf": false,
|
9 |
+
"hidden_dim": 1536,
|
10 |
+
"seq_length": 1000000,
|
11 |
+
"normalize": false
|
12 |
+
}
|
model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8377d00215d780cf38a513de2912ee55bc5d598675a2d22e3c185684c4ceafcf
|
3 |
+
size 1231945824
|
special_tokens_map.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{}
|
tokenizer.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:83ab9ebd416f1db1dcd00c863df0faafd3a0ef1fa26ff0d2f0d8ffd7e5e35080
|
3 |
+
size 13846757
|
tokenizer_config.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"added_tokens_decoder": {},
|
3 |
+
"clean_up_tokenization_spaces": false,
|
4 |
+
"extra_special_tokens": {},
|
5 |
+
"model_max_length": 1000000000000000019884624838656,
|
6 |
+
"tokenizer_class": "PreTrainedTokenizerFast"
|
7 |
+
}
|