File size: 1,620 Bytes
8a4a6af
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
---
language: ru
license: mit
tags:
- text-classification
- toxicity
- russian
- finetuned
base_model: ai-forever/ru-en-RoSBERTa
pipeline_tag: text-classification
---

# Toxicity Classifier for Russian Texts

## Описание
Модель для бинарной классификации токсичности русскоязычных текстов.

## Задача
- Класс 0: Нетоксичный текст
- Класс 1: Токсичный текст

## Метрики на тестовой выборке

| Метрика | Значение |
|---------|----------|
| Accuracy | 0.0000 |
| F1-Score | 0.0000 |
| Precision | 0.0000 |
| Recall | 0.0000 |
| ROC-AUC | 0.0000 |
| MCC | 0.0000 |

## Использование

```python
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

model_name = 'tankoooo/toxicity-classifier-ru'
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)

def predict_toxicity(text):
    inputs = tokenizer(text, return_tensors='pt', max_length=128, truncation=True, padding=True)
    with torch.no_grad():
        outputs = model(**inputs)
        probs = torch.softmax(outputs.logits, dim=-1)
        return probs[0][1].item()

# Пример
print(predict_toxicity('Здравствуйте, чем могу помочь?'))
```

## Датасет
Модель обучена на датасете: [tankoooo/toxicity-classification-ru](https://huggingface.co/datasets/tankoooo/toxicity-classification-ru)

## Автор
tankoooo

## Лицензия
MIT