Views
No views yet
pip install model2vec[inference]1from model2vec.inference import StaticModelPipeline
2
3model = StaticModelPipeline.from_pretrained(
4 "enguard/tiny-guard-2m-en-prompt-hate-speech-binary-moderation"
5)
6
7
8# Supports single texts. Format input as a single text:
9text = "Example sentence"
10
11model.predict([text])
12model.predict_proba([text])
13| Field | Value |
|---|---|
| Classifies | prompt-hate-speech-binary |
| Base Model | minishlab/potion-base-2m |
| Precision | 0.9141 |
| Recall | 0.7269 |
| F1 | 0.8098 |
| True \ Predicted | FAIL | PASS |
|---|---|---|
| FAIL | 182 | 68 |
| PASS | 16 | 234 |
1{
2 "FAIL": {
3 "precision": 0.9141414141414141,
4 "recall": 0.7269076305220884,
5 "f1-score": 0.8098434004474273,
6 "support": 249.0
7 },
8 "PASS": {
9 "precision": 0.7740863787375415,
10 "recall": 0.932,
11 "f1-score": 0.8457350272232305,
12 "support": 250.0
13 },
14 "accuracy": 0.8296593186372746,
15 "macro avg": {
16 "precision": 0.8441138964394779,
17 "recall": 0.8294538152610442,
18 "f1-score": 0.8277892138353289,
19 "support": 499.0
20 },
21 "weighted avg": {
22 "precision": 0.8439735607326603,
23 "recall": 0.8296593186372746,
24 "f1-score": 0.8278251773892124,
25 "support": 499.0
26 }
27}| Text | True Label | Predicted Label |
|---|---|---|
| It really only works on bitchy women because they get insulted that I think they look old | FAIL | FAIL |
| You mean the Master of Mesopotamia | PASS | PASS |
| Oh fuck that's so stupid. You believed his father to be dead and you acted like a decent person. Fuck this gay earth | FAIL | FAIL |
| I'm taking it. Thanks for suggestion. | PASS | PASS |
| I think you fell for a person, not a gender. | PASS | PASS |
| It really only works on bitchy women because they get insulted that I think they look old | FAIL | FAIL |
| Dataset Size | Time (seconds) | Predictions/Second |
|---|---|---|
| 1 | 0.0002 | 5315.97 |
| 500 | 0.0319 | 15692.66 |
| 500 | 0.0298 | 16767.29 |
@software{minishlab2024model2vec,
author = {Stephan Tulkens and {van Dongen}, Thomas},
title = {Model2Vec: Fast State-of-the-Art Static Embeddings},
year = {2024},
publisher = {Zenodo},
doi = {10.5281/zenodo.17270888},
url = {https://github.com/MinishLab/model2vec},
license = {MIT}
}