Views
No views yet
bert-base-multilingual-cased and fine-tuned for sentiment classification of Kazakh text into five classes:1from transformers import pipeline
2
3classifier = pipeline("text-classification", model="Darmm/sentiment-kk")
4text = "Бұл фильм маған ұнамады"
5print(classifier(text))1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4model_name = "Darmm/sentiment-kk"
5tokenizer = AutoTokenizer.from_pretrained(model_name)
6model = AutoModelForSequenceClassification.from_pretrained(model_name)
7
8text = "Бұл фильм маған ұнамады"
9inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True)
10
11with torch.no_grad():
12 outputs = model(**inputs)
13 predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
14
15predicted_class = torch.argmax(predictions, dim=-1).item()
16labels = ["very_negative", "negative", "neutral", "positive", "very_positive"]
17print(f"Predicted: {labels[predicted_class]}")
18print(f"Confidence: {predictions[0][predicted_class].item():.2%}")bert-base-multilingual-cased{
"eval_loss": 0.02658640407025814,
"eval_accuracy": 0.9969512195121951,
"eval_runtime": 0.544,
"eval_samples_per_second": 602.947,
"eval_steps_per_second": 38.603,
"epoch": 3.0
}bert-base-multilingual-cased, fine‑tuned on the Darmm/darmm-sentiment-kk dataset. The model predicts five sentiment classes and achieves high accuracy on the evaluation split.Darmm/darmm-sentiment-kkbert-base-multilingual-casedbert-base-multilingual-cased негізінде Darmm/darmm-sentiment-kk деректерінде оқытылып, қазақ тіліндегі 5 классты sentiment жіктеуін орындайды.Darmm/darmm-sentiment-kkbert-base-multilingual-casedbert-base-multilingual-cased, дообученная на Darmm/darmm-sentiment-kk для 5‑классовой классификации тональности казахского текста.Darmm/darmm-sentiment-kkbert-base-multilingual-cased