Downloads · 30 days
0
pauL9990/sentiment-analyzer-v2-final
sentiment-analyzer-v2-final is a machine learning model from pauL9990. 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 transformers.
- Developer: Porjanya Paul Bordoloi (@pauL9990) - Base Model: distilbert-base-uncased - Architecture: Transformer (DistilBERT) + LoRA (Low-Rank Adaptation) - Language: English - License: Apache 2.0 - Framework: PyTorc…
Downloads · 30 days
0
Access
Public
Updated Mar 31, 2025
Repo size
3 MB
Likes
0
Public
Click a slice to open those files.
.safetensors3 MB · 76%
From the Hugging Face model README
pauL9990/sentiment-analyzer-v2-finalsentiment-analyzer-v2-final is a LoRA fine-tuned version of DistilBERT for binary sentiment classification.
This model is trained on the IMDB movie review dataset and enhanced with real-world short-form and mixed sentiment examples, optimized for:
from transformers import AutoTokenizer, AutoModelForSequenceClassification
from peft import PeftModel
import torch
tokenizer = AutoTokenizer.from_pretrained("pauL9990/sentiment-analyzer-v2-final")
base_model = AutoModelForSequenceClassification.from_pretrained("distilbert-base-uncased", num_labels=2)
model = PeftModel.from_pretrained(base_model, "pauL9990/sentiment-analyzer-v2-final")
model.eval()
def analyze_sentiment(text):
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True, max_length=256)
with torch.no_grad():
outputs = model(**inputs)
probs = torch.softmax(outputs.logits, dim=1)
label = "Positive" if torch.argmax(probs) == 1 else "Negative"
confidence = round(probs.max().item() * 100, 2)
return label, confidence
@misc{bordoloi2025sentimentanalyzer, title={Sentiment Analyzer V2 - LoRA Fine-Tuned DistilBERT}, author={Paul Bordoloi}, year={2025}, howpublished={\url{https://huggingface.co/pauL9990/sentiment-analyzer-v2-final}}, }