rubert base cased sentiment rusentiment

Providerblanchefort
Categorysentiment-analysis
LicenseApache-2.0
Downloads334.6K
Stars0

Overview

RuBERT-base-cased-sentiment (RuSentiment) is a specialized transformer model optimized for sentiment analysis in Russian. Built upon the RuBERT base architecture, it is specifically fine-tuned to handle the linguistic nuances and morphological complexity of the Russian language, providing more accurate polarity detection than general-purpose multilingual models. For developers, this model is an ideal choice for building sentiment-driven pipelines, such as customer feedback loops, social media monitoring, or automated support ticket prioritization. It integrates seamlessly with the Hugging Face ecosystem, allowing for rapid deployment via the Transformers library. While smaller than massive LLMs, its domain-specific tuning offers a high performance-to-latency ratio for real-time inference tasks.

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
# Install Hugging Face transformers
pip install transformers torch
SDK Usage
# 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:

Guidance
pip install -U huggingface_hub

CLI Download

Download the full repository

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)

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

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 Download
git lfs install
git clone https://huggingface.co/blanchefort/rubert-base-cased-sentiment-rusentiment

To skip LFS large-file downloads, use:

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

Install Transformers
pip install -U transformers torch

Load the model and run inference

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

来源: HuggingFace

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

How to use

python
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

RuSentiment**

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

Join our Telegram