Downloads · 30 days
6
24% of all-time downloads
SaiCharan7829/query_classification-distilBERT-66M
query_classification-distilBERT-66M is a text classification model from SaiCharan7829. Use it when you need a label for a piece of text. The card lists the license as apache-2.0.
A high-performance intent classification model based on DistilBERT, fine-tuned to classify user queries into 5 categories with 98.03% accuracy on a challenging test set of 7,320 samples.
Downloads · 30 days
6
24% of all-time downloads
All-time downloads
25
Public
Parameters
67M
268 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors268 MB · 100%
From the Hugging Face model README
A high-performance intent classification model based on DistilBERT, fine-tuned to classify user queries into 5 categories with 98.03% accuracy on a challenging test set of 7,320 samples.
This model classifies text into 5 intent categories:
basic_actions - One-time, immediate commands
automator - Recurring, scheduled, or conditional automations
information - Educational, factual, or informational queries
conversation - Social interactions and casual chat
irrelevant - Abusive, meaningless, or off-topic content
| Category | Precision | Recall | F1-Score | Support |
|---|---|---|---|---|
| basic_actions | 95.92% | 100.00% | 97.92% | 1,833 |
| automator | 100.00% | 94.50% | 97.17% | 1,418 |
| information | 100.00% | 95.39% | 97.64% | 1,432 |
| conversation | 100.00% | 100.00% | 100.00% | 1,456 |
| irrelevant | 94.71% | 100.00% | 97.28% | 1,181 |
| Overall | 98.12% | 98.03% | 98.03% | 7,320 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
# Load model and tokenizer
model_name = "SaiCharan7829/query_classification-distilBERT-66M"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
# Prepare input
text = "Turn on the lights every evening at 6pm"
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True)
# Get prediction
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
predicted_class = torch.argmax(logits, dim=1).item()
# Categories mapping
categories = ["basic_actions", "automator", "information", "conversation", "irrelevant"]
print(f"Predicted category: {categories[predicted_class]}")
# Output: Predicted category: automator
import torch.nn.functional as F
# Get probabilities
probs = F.softmax(logits, dim=1)[0]
confidence = probs[predicted_class].item()
print(f"Category: {categories[predicted_class]}")
print(f"Confidence: {confidence:.2%}")
# Show all probabilities
for i, category in enumerate(categories):
print(f"{category}: {probs[i].item():.2%}")
Distribution:
This model is designed for:
Not recommended for:
@misc{query_classification_distilbert_2024,
author = {SaiCharan7829},
title = {DistilBERT Task Router - Query Classification Model},
year = {2024},
publisher = {HuggingFace},
howpublished = {\url{https://huggingface.co/SaiCharan7829/query_classification-distilBERT-66M}}
}
Apache 2.0
SaiCharan7829