Views
No views yet
profanity, threat, illegal.| class | support | threshold | precision | recall | f1 | f1_ci_low | f1_ci_high | pr_auc |
|---|---|---|---|---|---|---|---|---|
| profanity | 141 | 0.64 | 0.5708 | 0.8582 | 0.6856 | 0.6252 | 0.7398 | 0.721 |
| threat | 91 | 0.82 | 0.7526 | 0.8022 | 0.7766 | 0.7074 | 0.8391 | 0.8668 |
| illegal | 103 | 0.54 | 0.981 | 1 | 0.9904 | 0.9755 | 1 | 0.9991 |
| domain | class | support | f1 | recall |
|---|---|---|---|---|
| legal_questions | illegal | 102 | 1 | 1 |
| social_comments | profanity | 141 | 0.6856 | 0.8582 |
| social_comments | threat | 91 | 0.7766 | 0.8022 |
| social_comments | illegal | 1 | 0.5 | 1 |
1import torch
2from transformers import AutoModelForSequenceClassification, AutoTokenizer
3
4repo = "aurelianvolturi/rubert-tiny2-multitask-toxicity"
5tokenizer = AutoTokenizer.from_pretrained(repo)
6model = AutoModelForSequenceClassification.from_pretrained(
7 repo, trust_remote_code=True
8).eval()
9text = "Как проверить подлинность паспорта?"
10batch = tokenizer(text, return_tensors="pt", truncation=True,
11 max_length=model.config.max_length)
12with torch.inference_mode():
13 probabilities = torch.sigmoid(model(**batch).logits)[0].tolist()
14result = {
15 label: probability >= model.config.thresholds[label]
16 for label, probability in zip(model.config.labels, probabilities)
17}revision на commit hash.