Downloads · 30 days
6
27% of all-time downloads
Swarnadeep-28/bengali-code-mix-sentiment-lora
bengali-code-mix-sentiment-lora is a text classification model from Swarnadeep-28. Use it when you need a label for a piece of text. It is set up for peft. The card lists the license as apache-2.0.
should probably proofread and complete it, then remove this comment. --
Downloads · 30 days
6
27% of all-time downloads
All-time downloads
22
Public
Repo size
40 MB
Likes
0
Public
Click a slice to open those files.
.json17.1 MB · 66%
From the Hugging Face model README
This model is a fine-tuned version of xlm-roberta-base on the None dataset. It achieves the following results on the evaluation set:
This model is a LoRA Parameter-Efficient Fine-Tuned version of xlm-roberta-base for sentiment analysis on Bengali–English code-mixed text (commonly found in social media posts, comments, and tweets).
positive, negative, neutralThis model enables efficient, low-resource fine-tuning while maintaining competitive performance for code-mixed sentiment classification.
from transformers import AutoTokenizer, AutoModelForSequenceClassification
from peft import PeftModel
import torch
# Load tokenizer & model
model_id = "Swarnadeep-28/bengali-code-mix-sentiment-lora"
tokenizer = AutoTokenizer.from_pretrained(model_id)
base_model = AutoModelForSequenceClassification.from_pretrained("xlm-roberta-base", num_labels=3)
model = PeftModel.from_pretrained(base_model, model_id)
# Example text
text = "Aaj match ta khub bhalo chilo! Loved it."
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True)
with torch.no_grad():
logits = model(**inputs).logits
pred = torch.argmax(logits, dim=-1).item()
labels = ["negative", "neutral", "positive"]
print("Predicted label:", labels[pred])
The following hyperparameters were used during training:
| Training Loss | Epoch | Step | Validation Loss | Accuracy | F1 |
|---|---|---|---|---|---|
| 0.6325 | 1.0 | 1001 | 0.8349 | 0.6982 | 0.6974 |
| 0.7065 | 2.0 | 2002 | 0.7734 | 0.7096 | 0.7093 |
| 0.6849 | 3.0 | 3003 | 0.7649 | 0.7171 | 0.7149 |
| 0.6452 | 4.0 | 4004 | 0.7603 | 0.7176 | 0.7180 |
| 0.669 | 5.0 | 5005 | 0.7597 | 0.7206 | 0.7206 |