Downloads · 30 days
11
0% of all-time downloads
kartashoffv/vashkontrol-sentiment-rubert
vashkontrol-sentiment-rubert is a text classification model from kartashoffv. 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.
The model is designed to evaluate the tone of reviews from the VashKontrol portal.
Downloads · 30 days
11
0% of all-time downloads
All-time downloads
238K
Public
Parameters
178M
10.7 GB on disk
Likes
2
Public
Click a slice to open those files.
.bin711 MB · 50%
From the Hugging Face model README
The model is designed to evaluate the tone of reviews from the VashKontrol portal.
This model is a fine-tuned version of DeepPavlov/rubert-base-cased on a following dataset: kartashoffv/vash_kontrol_reviews.
It achieves the following results on the evaluation set:
The model predicts a sentiment label (positive, neutral, negative) for a submitted text review.
The model was trained on the corpus of reviews of the VashControl portal, left by users in the period from 2020 to 2022 inclusive. The total number of reviews was 17,385. The sentimental assessment of the dataset was carried out by the author manually by dividing the general dataset into positive/neutral/negative reviews.
The resulting classes: 0 (positive): 13045 1 (neutral): 1196 2 (negative): 3144
Class weighting was used to solve the class imbalance.
The following hyperparameters were used during training:
| Training Loss | Epoch | Step | Validation Loss | F1 |
|---|---|---|---|---|
| 0.0992 | 1.0 | 1391 | 0.0737 | 0.9337 |
| 0.0585 | 2.0 | 2782 | 0.0616 | 0.9384 |
| 0.0358 | 3.0 | 4173 | 0.0787 | 0.9441 |
| 0.0221 | 4.0 | 5564 | 0.0918 | 0.9488 |
| 0.0106 | 5.0 | 6955 | 0.1085 | 0.9461 |
import torch
from transformers import AutoModelForSequenceClassification
from transformers import BertTokenizerFast
tokenizer = BertTokenizerFast.from_pretrained('kartashoffv/vashkontrol-sentiment-rubert')
model = AutoModelForSequenceClassification.from_pretrained('kartashoffv/vashkontrol-sentiment-rubert', return_dict=True)
@torch.no_grad()
def predict(review):
inputs = tokenizer(review, max_length=512, padding=True, truncation=True, return_tensors='pt')
outputs = model(**inputs)
predicted = torch.nn.functional.softmax(outputs.logits, dim=1)
pred_label = torch.argmax(predicted, dim=1).numpy()
return pred_label
0: POSITIVE
1: NEUTRAL
2: NEGATIVE