rubert base cased sentiment rusentiment
Overview
Highlights
- Optimized for high-accuracy Russian sentiment polarity detection
- Built on RuBERT base for strong linguistic understanding
- Seamless integration with Hugging Face Transformers library
- Low-latency inference compared to general LLMs
- Permissive Apache-2.0 license for commercial deployment
Usage
# Install Hugging Face transformers
pip install transformers torch
# Load model with transformers
from transformers import AutoModel, AutoTokenizer
model = AutoModel.from_pretrained("blanchefort/rubert-base-cased-sentiment-rusentiment")
tokenizer = AutoTokenizer.from_pretrained("blanchefort/rubert-base-cased-sentiment-rusentiment")
Hugging Face Download
We recommend downloading the model via the Hugging Face CLI or Hub SDK.
Guidance:Before downloading, install huggingface_hub with:
pip install -U huggingface_hub
CLI Download
Download the full repository
huggingface-cli download blanchefort/rubert-base-cased-sentiment-rusentiment
Download a single file to a local folder (e.g. config.json into ./dir)
huggingface-cli download blanchefort/rubert-base-cased-sentiment-rusentiment config.json --local-dir ./dir
See the official docs for more CLI options
SDK Download
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('blanchefort/rubert-base-cased-sentiment-rusentiment')
Git Download
Make sure git-lfs is installed first
git lfs install
git clone https://huggingface.co/blanchefort/rubert-base-cased-sentiment-rusentiment
To skip LFS large-file downloads, use:
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/blanchefort/rubert-base-cased-sentiment-rusentiment
Model files are hosted on the Hugging Face Hub — download directly via HF CLI / SDK / Git, not through this site.
PyTorch / Transformers Usage
Install Transformers
pip install -U transformers torch
Load the model and run inference
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained('blanchefort/rubert-base-cased-sentiment-rusentiment')
tokenizer = AutoTokenizer.from_pretrained('blanchefort/rubert-base-cased-sentiment-rusentiment')
Full Documentation
---
language:
- ru
tags:
- sentiment
- text-classification
datasets:
- RuSentiment
---
RuBERT for Sentiment Analysis
This is a DeepPavlov/rubert-base-cased-conversational model trained on RuSentiment.
Labels
0: NEUTRAL 1: POSITIVE 2: NEGATIVEHow to use
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
Dataset used for model training
> 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.