Sentiment Classification Fine-Tuned Collection Kazakh
Collection
1 item
•
Updated
A sentiment analysis model for Kazakh text, fine-tuned on a dataset of entertainment reviews.
This model is based on bert-base-multilingual-cased and fine-tuned for sentiment classification of Kazakh text into three classes:
from transformers import pipeline
classifier = pipeline("text-classification", model="R3iwan/kazakh-sentiment-bert")
text = "Бұл фильм маған ұнамады"
result = classifier(text)
print(result)
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
model_name = "R3iwan/kazakh-sentiment-bert"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
text = "Бұл фильм маған ұнамады"
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True)
with torch.no_grad():
outputs = model(**inputs)
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
predicted_class = torch.argmax(predictions, dim=-1).item()
labels = ["negative", "neutral", "positive"]
print(f"Predicted: {labels[predicted_class]}")
print(f"Confidence: {predictions[0][predicted_class].item():.2%}")
The model was trained on the R3iwan/entertainment-reviews-kazakh dataset with the following parameters:
bert-base-multilingual-casedThe model is trained on a limited dataset of entertainment reviews and may perform better on similar texts. For other domains, additional fine-tuning may be required.
R3iwan
Apache 2.0
Base model
google-bert/bert-base-multilingual-cased