| --- |
| 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 |