Model2Vec
Safetensors
English
embeddings
static-embeddings
stephantulkens commited on
Commit
146ab7d
·
verified ·
1 Parent(s): f3c7a40

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +44 -35
README.md CHANGED
@@ -5,62 +5,71 @@ model_name: tmpqsu1ee6a
5
  tags:
6
  - embeddings
7
  - static-embeddings
 
 
 
 
 
 
8
  ---
9
 
10
- # tmpqsu1ee6a Model Card
11
 
12
- 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.
 
13
 
 
14
 
15
- ## Installation
16
-
17
- Install model2vec using pip:
18
  ```
19
- pip install model2vec
 
 
 
 
 
 
 
 
 
 
 
20
  ```
21
 
22
- ## Usage
23
- Load this model using the `from_pretrained` method:
24
- ```python
25
- from model2vec import StaticModel
26
 
27
- # Load a pretrained Model2Vec model
28
- model = StaticModel.from_pretrained("tmpqsu1ee6a")
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, 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.
 
 
 
51
 
52
- 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.
 
 
 
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
- - [Model2Vec Results](https://github.com/MinishLab/model2vec?tab=readme-ov-file#results)
59
- - [Model2Vec Tutorials](https://github.com/MinishLab/model2vec/tree/main/tutorials)
60
 
61
  ## Library Authors
62
 
63
- 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).
64
 
65
  ## Citation
66
 
 
5
  tags:
6
  - embeddings
7
  - static-embeddings
8
+ datasets:
9
+ - HuggingFaceFW/fineweb-edu-llama3-annotations
10
+ language:
11
+ - en
12
+ base_model:
13
+ - minishlab/potion-base-8M
14
  ---
15
 
16
+ # potion-8m-edu-classifier Model Card
17
 
18
+ This [Model2Vec](https://github.com/MinishLab/model2vec) model is a fine-tuned version of [potion-base-8m](https://huggingface.co/minishlab/potion-base-8M).
19
+ It was trained to predict educational content, analogous to how the [fineweb-edu-classifier](https://huggingface.co/HuggingFaceFW/fineweb-edu-classifier) was used to filter educational content.
20
 
21
+ It achieves the following performance on the evaluation split:
22
 
 
 
 
23
  ```
24
+ precision recall f1-score support
25
+
26
+ 0 0.70 0.42 0.52 5694
27
+ 1 0.75 0.86 0.80 26512
28
+ 2 0.55 0.51 0.53 10322
29
+ 3 0.54 0.45 0.49 3407
30
+ 4 0.59 0.30 0.40 807
31
+ 5 0.00 0.00 0.00 1
32
+
33
+ accuracy 0.69 46743
34
+ macro avg 0.52 0.42 0.46 46743
35
+ weighted avg 0.68 0.69 0.68 46743
36
  ```
37
 
38
+ When thresholded to a binary classifier, it achieves a macro-averaged F1-score of `0.79`. The original classifier achieves `0.81` on the same dataset, but this classifier is orders of magnitude faster on CPU.
 
 
 
39
 
 
 
 
 
 
40
  ```
41
+ precision recall f1-score support
42
 
43
+ not edu 0.96 0.98 0.97 42528
44
+ edu 0.70 0.54 0.61 4215
 
 
 
 
45
 
46
+ accuracy 0.94 46743
47
+ macro avg 0.83 0.76 0.79 46743
48
+ weighted avg 0.93 0.94 0.93 46743
 
 
49
  ```
50
 
51
+ ## Installation
52
 
53
+ Install model2vec with the inference extra using pip:
54
+ ```
55
+ pip install model2vec[inference]
56
+ ```
57
 
58
+ ## Usage
59
+ Load this model using the `from_pretrained` method:
60
+ ```python
61
+ from model2vec.inference import StaticModelPipeline
62
 
63
+ # Load a pretrained Model2Vec model
64
+ model = StaticModelPipeline.from_pretrained("minishlab/potion-8m-edu-classifier")
65
 
66
+ # Predict labels
67
+ label = model.predict(["Example sentence"])
68
+ ```
 
69
 
70
  ## Library Authors
71
 
72
+ Model2Vec was developed by [Minish](https://github.com/MinishLab).
73
 
74
  ## Citation
75