Downloads · 30 days
11
12% of all-time downloads
RooLeX/Homework2-llm-toxicity
Homework2-llm-toxicity is a machine learning model from RooLeX. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
This model is a fine-tuned version of ai-forever/ru-en-RoSBERTa for binary classification of Russian texts into toxic (1) and non-toxic (0).
Downloads · 30 days
11
12% of all-time downloads
All-time downloads
89
Public
Parameters
405M
1.6 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors1.6 GB · 99%
From the Hugging Face model README
This model is a fine-tuned version of ai-forever/ru-en-RoSBERTa for binary classification of Russian texts into toxic (1) and non-toxic (0).
It was trained on a balanced dataset of ~74k examples (split 80/10/10) derived from several public sources:
Only the classification head was trained; the encoder weights were frozen.
| Metric | Value |
|---|---|
| Accuracy | 0.9992 |
| Precision | 0.9992 |
| Recall | 0.9992 |
| F1 | 0.9992 |
| MCC | 0.9984 |
| ROC AUC | 1.0000 |
Confusion matrix: [[3713 3] [ 3 3713]]
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch
model_name = "RooLeX/Homework2-llm-toxicity"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
def predict_toxicity(text):
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True, max_length=64)
with torch.no_grad():
outputs = model(**inputs)
probs = torch.softmax(outputs.logits, dim=-1)
return int(torch.argmax(probs)), probs[0, 1].item()
# Пример
print(predict_toxicity("Ты идиот!")) # (1, ~0.9998)
print(predict_toxicity("Здравствуйте, чем могу помочь?")) # (0, ~0.0000)
RooLeX
Hugging Face: RooLeX