Downloads · 30 days
1.9K
0% of all-time downloads
blanchefort/rubert-base-cased-sentiment-rusentiment
rubert-base-cased-sentiment-rusentiment is a text classification model from blanchefort. Use it when you need a label for a piece of text. It is set up for transformers.
This is a DeepPavlov/rubert-base-cased-conversational model trained on RuSentiment.
Downloads · 30 days
1.9K
0% of all-time downloads
All-time downloads
5.7M
Public
Parameters
178M
2.8 GB on disk
Likes
15
Public
Click a slice to open those files.
.h5712 MB · 25%
How the weights are stored.
F32178M · 100%
From the Hugging Face model README
This is a DeepPavlov/rubert-base-cased-conversational model trained on RuSentiment.
0: NEUTRAL
1: POSITIVE
2: NEGATIVE
import torch
from transformers import AutoModelForSequenceClassification
from transformers import BertTokenizerFast
tokenizer = BertTokenizerFast.from_pretrained('blanchefort/rubert-base-cased-sentiment-rusentiment')
model = AutoModelForSequenceClassification.from_pretrained('blanchefort/rubert-base-cased-sentiment-rusentiment', return_dict=True)
@torch.no_grad()
def predict(text):
inputs = tokenizer(text, max_length=512, padding=True, truncation=True, return_tensors='pt')
outputs = model(**inputs)
predicted = torch.nn.functional.softmax(outputs.logits, dim=1)
predicted = torch.argmax(predicted, dim=1).numpy()
return predicted
A. Rogers A. Romanov A. Rumshisky S. Volkova M. Gronas A. Gribov RuSentiment: An Enriched Sentiment Analysis Dataset for Social Media in Russian. Proceedings of COLING 2018.