Downloads · 30 days
14
52% of all-time downloads
yashasvijadav03/hinglish-intent-classifier
hinglish-intent-classifier is a text classification model from yashasvijadav03. 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.
Fine-tuned DistilBERT Multilingual adapter using LoRA (PEFT) for Intent Classification on Code-Mixed Hindi-English (Hinglish) conversational utterances. Built for voice-agent Natural Language Understanding (NLU) pipel…
Downloads · 30 days
14
52% of all-time downloads
All-time downloads
27
Public
Repo size
3.6 MB
Likes
0
Public
Click a slice to open those files.
.safetensors3.6 MB · 55%
From the Hugging Face model README
Fine-tuned DistilBERT Multilingual adapter using LoRA (PEFT) for Intent Classification on Code-Mixed Hindi-English (Hinglish) conversational utterances. Built for voice-agent Natural Language Understanding (NLU) pipelines.
complaint (e.g., service issues, refund delays)purchase_inquiry (e.g., catalog questions, warranty inquiries)price_negotiation (e.g., asking for discounts, coupon requests)callback_request (e.g., busy right now, call later)not_interested (e.g., refusal, DND requests)positive_confirmation (e.g., deal acceptance, confirmation)| Model / Configuration | Test Accuracy | Macro-F1 | Precision | Recall |
|---|---|---|---|---|
| Zero-Shot Baseline (MNLI) | 38.89% | 0.3540 | 0.4497 | 0.3889 |
| LoRA Fine-Tuned (Rank 16, lr=5e-4) | 100.00% | 1.0000 | 1.0000 | 1.0000 |
import torch
import torch.nn.functional as F
from transformers import AutoTokenizer, AutoModelForSequenceClassification
from peft import PeftModel
base_model_name = "distilbert-base-multilingual-cased"
adapter_repo = "yashasvijadav03/hinglish-intent-classifier"
# Intent labels mapping
id2label = {
0: "complaint",
1: "purchase_inquiry",
2: "price_negotiation",
3: "callback_request",
4: "not_interested",
5: "positive_confirmation"
}
# 1. Load Tokenizer & Base Model
tokenizer = AutoTokenizer.from_pretrained(base_model_name)
base_model = AutoModelForSequenceClassification.from_pretrained(
base_model_name,
num_labels=len(id2label),
id2label=id2label,
)
# 2. Attach Fine-Tuned LoRA Adapter
model = PeftModel.from_pretrained(base_model, adapter_repo)
model.eval()
# 3. Classify an Utterance
text = "Thoda discount de do na, price bohot zyada hai."
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=128)
with torch.no_grad():
logits = model(**inputs).logits
probs = F.softmax(logits, dim=-1)
predicted_id = torch.argmax(probs, dim=-1).item()
print(f"Predicted Intent: {id2label[predicted_id]} (Confidence: {probs[0][predicted_id]:.2%})")
# Output: Predicted Intent: price_negotiation (Confidence: 98.40%)
distilbert-base-multilingual-cased (135M params)q_lin, v_lin5e-4 with Linear Warmup