Downloads · 30 days
9
14% of all-time downloads
sunil9938/distilbert-lora-sentiment-amazon
distilbert-lora-sentiment-amazon is a machine learning model from sunil9938. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as mit.
Developed by: sunil9938 Model type: Text Classification (Sentiment Analysis) Language: English License: MIT Finetuned from model: distilbert-base-uncased
Downloads · 30 days
9
14% of all-time downloads
All-time downloads
63
Public
Repo size
3 MB
Likes
0
Public
Click a slice to open those files.
.safetensors3 MB · 81%
From the Hugging Face model README
Developed by: sunil9938
Model type: Text Classification (Sentiment Analysis)
Language: English
License: MIT
Finetuned from model: distilbert-base-uncased
This model is a fine-tuned version of DistilBERT using LoRA (Low-Rank Adaptation) for sentiment analysis on Amazon product reviews. It achieves 87.8% accuracy on the test set with only 1.09% trainable parameters.
from transformers import AutoTokenizer, AutoModelForSequenceClassification
from peft import PeftModel
tokenizer = AutoTokenizer.from_pretrained("sunil9938/distilbert-lora-sentiment-amazon")
base_model = AutoModelForSequenceClassification.from_pretrained(
"distilbert-base-uncased",
num_labels=2,
ignore_mismatched_sizes=True
)
model = PeftModel.from_pretrained(base_model, "sunil9938/distilbert-lora-sentiment-amazon")
model.eval()
def predict(text):
inputs = tokenizer(text, truncation=True, padding=True, max_length=256, return_tensors="pt")
outputs = model(**inputs)
probs = outputs.logits.softmax(dim=1)
pred = probs.argmax().item()
return "POSITIVE" if pred == 1 else "NEGATIVE", probs[0][pred].item()
print(predict("This product is amazing!"))
## Limitations
- English only
- Binary classification (no neutral)
- Trained on Amazon reviews only
## Citation
```bibtex
@misc{sunil9938-distilbert-lora-sentiment,
author = {Sunil Kumar},
title = {DistilBERT-LoRA Sentiment Classifier for Amazon Reviews},
year = {2026},
publisher = {Hugging Face},
url = {https://huggingface.co/sunil9938/distilbert-lora-sentiment-amazon}
}