Downloads · 30 days
11
9% of all-time downloads
asfahanjaved126/reasoning-sentiment-classifier-v1
reasoning-sentiment-classifier-v1 is a text generation model from asfahanjaved126. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
A LoRA fine-tuned adapter for Qwen2.5-7B-Instruct that classifies text sentiment and explains its reasoning — not just a label, but the specific phrase or reason behind the classification.
Downloads · 30 days
11
9% of all-time downloads
All-time downloads
118
Public
Repo size
51.8 MB
Likes
0
Public
Click a slice to open those files.
.safetensors40.4 MB · 78%
From the Hugging Face model README
A LoRA fine-tuned adapter for Qwen2.5-7B-Instruct that classifies text sentiment and explains its reasoning — not just a label, but the specific phrase or reason behind the classification.
Input: "This blender is absolutely terrible. It broke after one day."
Output:
Evaluated on a held-out test set (sample of 50 examples):
| Metric | Score |
|---|---|
| Sentiment classification accuracy | 94% |
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
base_model = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen2.5-7B-Instruct",
torch_dtype=torch.float16,
device_map={"": 0}
)
model = PeftModel.from_pretrained(base_model, "asfahanjaved126/reasoning-sentiment-classifier-v1")
tokenizer = AutoTokenizer.from_pretrained("asfahanjaved126/reasoning-sentiment-classifier-v1")
system_prompt = "Classify the sentiment as positive or negative, and give one brief reason why. Format your answer as:\nSentiment: <label>\nReason: <reason>"
messages = [
{"role": "system", "content": system_prompt},
{"role": "user", "content": "This product completely changed how I work, love it!"}
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
output = model.generate(**inputs, max_new_tokens=60, temperature=0.0, do_sample=False)
result = tokenizer.decode(output[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)
print(result)
This model is designed for businesses that need not just sentiment classification but actionable insight into customer feedback — identifying specific recurring complaint themes or praise points across large volumes of reviews, without manually reading each one.
Suitable for:
Fine-tuned using QLoRA (4-bit quantization) on Kaggle's free T4 GPU. Training used the TRL SFTTrainer with completion-only loss masking, cosine learning rate schedule, over 3 epochs. This checkpoint reflects training through 425 of 450 total steps (94%) due to a session interruption near the end of the final epoch.