Downloads · 30 days
75
3% of all-time downloads
t-bank-ai/response-toxicity-classifier-base
response-toxicity-classifier-base is a text classification model from t-bank-ai. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as mit.
BERT classifier from Skoltech, finetuned on contextual data with 4 labels.
Downloads · 30 days
75
3% of all-time downloads
All-time downloads
2.8K
Public
Repo size
2 GB
Likes
10
Public
Click a slice to open those files.
.bin654 MB · 99%
From the Hugging Face model README
BERT classifier from Skoltech, finetuned on contextual data with 4 labels.
Skoltech/russian-inappropriate-messages was finetuned on a multiclass data with four classes (check the exact mapping between idx and label in model.config).
The model was finetuned on a soon-to-be-posted dialogs datasets.
Model achieves the following results on the validation datasets (will be posted soon):
| OK - F1-score | TOXIC - F1-score | SEVERE TOXIC - F1-score | RISKS - F1-score | |
|---|---|---|---|---|
| internet dialogs | 0.896 | 0.348 | 0.490 | 0.591 |
| chatbot dialogs | 0.940 | 0.295 | 0.729 | 0.46 |
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained('tinkoff-ai/response-toxicity-classifier-base')
model = AutoModelForSequenceClassification.from_pretrained('tinkoff-ai/response-toxicity-classifier-base')
inputs = tokenizer('[CLS]привет[SEP]привет![SEP]как дела?[RESPONSE_TOKEN]норм, у тя как?', max_length=128, add_special_tokens=False, return_tensors='pt')
with torch.inference_mode():
logits = model(**inputs).logits
probas = torch.softmax(logits, dim=-1)[0].cpu().detach().numpy()
The work was done during internship at Tinkoff by Nikita Stepanov, mentored by Alexander Markov.