Downloads · 30 days
29
2% of all-time downloads
MichaelHuang/muril_base_cased_urdu_sentiment
muril_base_cased_urdu_sentiment is a text classification model from MichaelHuang. Use it when you need a label for a piece of text. It is set up for transformers.
Base model is google/muril-base-cased, a BERT model pre-trained on 17 Indian languages and their transliterated counterparts. Urdu sentiment analysis dataset is from mirfan899.
Downloads · 30 days
29
2% of all-time downloads
All-time downloads
1.5K
Public
Repo size
3.8 GB
Likes
1
Public
Click a slice to open those files.
.pt1.9 GB · 67%
From the Hugging Face model README
Base model is google/muril-base-cased, a BERT model pre-trained on 17 Indian languages and their transliterated counterparts. Urdu sentiment analysis dataset is from mirfan899.
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification
# Load the model and tokenizer
tokenizer = AutoTokenizer.from_pretrained("google/muril-base-cased")
model = AutoModelForSequenceClassification.from_pretrained("MichaelHuang/muril_base_cased_urdu_sentiment")
# Define the input text
text = '''
لیکن مسٹر پوتن نے یہ بھی کہا کہ یہ منصوبہ اسی وقت پیش کیا جا سکتا ہے جب لوگ 'مغرب اور کیئو میں' اس کے لیے تیار ہوں۔
روسی رہنما نے منگل کو ماسکو میں چینی صدر شی جن پنگ سے ملاقات کی جس میں روس یوکرین جنگ اور دونوں ممالک کے درمیان تعلقات پر تبادلہ خیال کیا گیا۔
گذشتہ ماہ شائع ہونے والے چین کے منصوبے میں واضح طور پر روس سے یوکرین چھوڑنے کا مطالبہ نہیں کیا گیا ہے۔
'''
# Tokenize the input text
inputs = tokenizer(text, return_tensors='pt')
# Make a prediction
outputs = model(**inputs)
predicted_class = torch.argmax(outputs.logits).item()
# Print the predicted class
if predicted_class == 1:
print('Positive')
else:
print('Negative')
| eval_loss | epoch | step | eval_accuracy |
|---|---|---|---|
| 0.29 | 1.0 | 3000 | 0.89 |
| 0.32 | 2.0 | 6000 | 0.91 |
| 0.33 | 3.0 | 9000 | 0.91 |