Qwen3-1.7B Emotion Classification
LoRA adapter for emotion analysis with JSON output
2 min readupdated
This compact LoRA (small add-on layer for a base model) adapter is built on top of Qwen/Qwen3-1.7B for automatic emotion detection in text. The model is trained to recognize six basic categories of feelings and output the result as a strict JSON object without extra text or Markdown formatting. It is great for integration into chat bots, customer support systems, and social media analytics where a machine-readable response is required. The solution targets developers who need fast and predictable analysis of user messages in English.
Key features
- 6 emotion classes: accurate detection of joy, sadness, love, anger, fear, and surprise.
- Minimal size: the adapter weight is only 69.8 MB with training on 1% of the base parameters.
- Strict output: yields results exclusively in JSON format without conversational fluff.
- Efficiency: built on the lightweight and high-performing Qwen3-1.7B model.
What you can do
- Review analysis: automatically classify customer sentiment and emotional tone in support feedback.
- Social media monitoring: process user posts and comments to gauge general audience mood.
- Bot integration: use in Telegram bot pipelines to dynamically adapt responses to the user state.
Example
import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base_model_id = "Qwen/Qwen3-1.7B"
adapter_id = "EduardKrutii/qwen3-1.7b-emotion-lora"
tokenizer = AutoTokenizer.from_pretrained(adapter_id)
base_model = AutoModelForCausalLM.from_pretrained(
base_model_id, dtype=torch.float16, device_map="auto"
)
model = PeftModel.from_pretrained(base_model, adapter_id)
model.eval()Read more
Details• Tasks: emotion classification (sadness, joy, love, anger, fear, surprise)
• Base model: Qwen/Qwen3-1.7B (Instruct)
• Adapter size: 69.8 MB (17,432,576 parameters)
• Limitations: English language only, not intended for medical diagnosis










Comments