Downloads · 30 days
35
100% of all-time downloads
blue-machines/Intent-classifier-v1
Intent-classifier-v1 is a text classification model from blue-machines. Use it when you need a label for a piece of text. It is set up for onnxruntime.
blue-machines/Intent-classifier-v1 is a sentence-level 7-class intent classifier.
Downloads · 30 days
35
100% of all-time downloads
All-time downloads
35
Public
Parameters
118M
1.1 GB on disk
Likes
0
Public
Click a slice to open those files.
.onnx710 MB · 59%
From the Hugging Face model README
blue-machines/Intent-classifier-v1 is a sentence-level 7-class intent classifier.
microsoft/Multilingual-MiniLM-L12-H384model.onnx — dynamic INT8 including embeddings (~113 MB)[user] / [assistant] tags)| id | label |
|---|---|
| 0 | provide_info |
| 1 | affirm |
| 2 | deny |
| 3 | correction |
| 4 | question |
| 5 | clarify_request |
| 6 | unclear |
| File | Role |
|---|---|
model.onnx | Deploy — INT8 ONNX (~113 MB; embeddings + MatMul quantized; GeGLU head FP32) |
model_int8.onnx | Same INT8 graph (explicit name) |
model_fp32.onnx | FP32 ONNX reference |
model.safetensors | PyTorch weights (checkpoint-2400) |
tokenizer.json / tokenizer_config.json | XLM-R / MiniLM tokenizer |
label_map.json | label ↔ id |
config.json | Transformer config |
export_metadata.json | export provenance |
sample200_int8_eval.json | 200-sample INT8 eval snapshot |
| Split | Accuracy | Notes |
|---|---|---|
| Full test (train-time eval, FP32) | ~0.837 | checkpoint-2400 |
| 200-sample INT8 (seed=1) all | 0.86 | natural domain mix |
| 200-sample INT8 Muthoot | 0.8057553956834532 | |
| 200-sample INT8 synthetic | 0.9836065573770492 |
Hard-fail fine-tunes after this checkpoint degraded accuracy — do not use hardft weights.
import json
from pathlib import Path
import numpy as np
import onnxruntime as ort
from transformers import AutoTokenizer
MODEL_DIR = Path(".") # or snapshot_download("blue-machines/Intent-classifier-v1")
MAX_LEN = 96
LABELS = [
"provide_info", "affirm", "deny", "correction",
"question", "clarify_request", "unclear",
]
tokenizer = AutoTokenizer.from_pretrained(MODEL_DIR)
if tokenizer.pad_token is None:
tokenizer.pad_token = tokenizer.unk_token
session = ort.InferenceSession(
str(MODEL_DIR / "model.onnx"),
providers=["CPUExecutionProvider"],
)
def predict_intent(sentence: str) -> dict:
enc = tokenizer(
sentence,
return_tensors="np",
truncation=True,
max_length=MAX_LEN,
padding=True,
)
feed = {
"input_ids": enc["input_ids"].astype(np.int64),
"attention_mask": enc["attention_mask"].astype(np.int64),
}
logits = session.run(None, feed)[0][0]
x = logits.astype(np.float64)
x = x - x.max()
probs = np.exp(x); probs = probs / probs.sum()
pred_id = int(probs.argmax())
return {
"intent": LABELS[pred_id],
"confidence": float(probs.max()),
"probs": {LABELS[i]: float(probs[i]) for i in range(7)},
}
print(predict_intent("Haan, ye sahi hai. Proceed karo."))