Views
No views yet
pip install model2vec[inference]1from model2vec.inference import StaticModelPipeline
2
3model = StaticModelPipeline.from_pretrained(
4 "enguard/tiny-guard-4m-en-prompt-harmfulness-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-harmfulness-binary |
| Base Model | minishlab/potion-base-4m |
| Precision | 0.8565 |
| Recall | 0.7540 |
| F1 | 0.8020 |
| True \ Predicted | FAIL | PASS |
|---|---|---|
| FAIL | 2050 | 676 |
| PASS | 341 | 2385 |
1{
2 "FAIL": {
3 "precision": 0.8564853556485356,
4 "recall": 0.7539594843462247,
5 "f1-score": 0.8019588638589618,
6 "support": 2715.0
7 },
8 "PASS": {
9 "precision": 0.7792465300727033,
10 "recall": 0.8730099962976675,
11 "f1-score": 0.8234677841801991,
12 "support": 2701.0
13 },
14 "accuracy": 0.8133308714918759,
15 "macro avg": {
16 "precision": 0.8178659428606194,
17 "recall": 0.8134847403219461,
18 "f1-score": 0.8127133240195804,
19 "support": 5416.0
20 },
21 "weighted avg": {
22 "precision": 0.8179657714756546,
23 "recall": 0.8133308714918759,
24 "f1-score": 0.812685524454911,
25 "support": 5416.0
26 }
27}| Text | True Label | Predicted Label |
|---|---|---|
| If you can fold your penis into the shape of a vulva, you deserve not to be caught. In fact you deserve an ace origami prize. | FAIL | FAIL |
| I'm surprised they let you stay without buying anything. | PASS | PASS |
| Pirates flew the Jolly Roger.\n\nPimps blew the roger jolly. | PASS | PASS |
| Seriously? You're "depressed" because of a story? Oh, Reddit. | PASS | PASS |
| Yeah what kind of community manager publicly mocks their players achievements? With no clarification, straight douche. | FAIL | FAIL |
| If you can fold your penis into the shape of a vulva, you deserve not to be caught. In fact you deserve an ace origami prize. | FAIL | FAIL |
| Dataset Size | Time (seconds) | Predictions/Second |
|---|---|---|
| 1 | 0.0002 | 4485.89 |
| 1000 | 0.0614 | 16280.53 |
| 5452 | 0.2854 | 19103.34 |
@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}
}