Downloads · 30 days
2
3% of all-time downloads
saketgarodia1/distilbert-IT-ticket-student-4bit
distilbert-IT-ticket-student-4bit is a text classification model from saketgarodia1. Use it when you need a label for a piece of text. It is set up for transformers.
This repository contains a 4-bit–quantized version of my DistilBERT IT ticket classifier:
Downloads · 30 days
2
3% of all-time downloads
All-time downloads
61
Public
Parameters
68.3M
70.1 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors70.1 MB · 99%
How the weights are stored.
U844.4M · 65%
From the Hugging Face model README
This repository contains a 4-bit–quantized version of my DistilBERT IT ticket classifier:
saketgarodia1/bert-it-ticket-studentsaketgarodia1/bert-IT-ticket-classifier-fullThe goal of this repo is to provide a much smaller, GPU-friendly model that still achieves strong performance on IT ticket topic classification.
Task: Multi-class text classification
Domain: IT service / support tickets
Labels (8 classes): internal IT “Topic_group” categories (e.g. VPN, Email, Storage, Hardware, etc.)
distilbert-base-uncased)AutoModelForSequenceClassification with 8 labelsThe full-precision student lives in saketgarodia1/bert-it-ticket-student.
This repo is a post-training 4-bit quantized copy of that model.
Quantization is done using bitsandbytes with NF4 (NormalFloat4):
load_in_4bit=Truebnb_4bit_quant_type="nf4"bnb_4bit_compute_dtype=torch.bfloat16bnb_4bit_use_double_quant=TrueRough behavior:
torch.uint8):
torch.float16):
This gives a large memory reduction compared to the FP32 teacher and FP16 student, while keeping accuracy close to the original student.
Evaluated on the same validation/test splits of
Dataset: saketgarodia1/IT-service-topic-classification-data
Metrics are accuracy and macro-averaged F1.
| Split | Loss | Accuracy | Macro F1 |
|---|---|---|---|
| Validation | ~0.389 | ~0.884 | ~0.882 |
| Test | ~0.422 | ~0.880 | ~0.875 |
Values are computed with a standard cross-entropy loss on the hard labels, and
sklearn.metrics.accuracy_score/f1_score(average="macro").
From the full-precision models (trained in earlier notebooks):
| Model | Approx. Accuracy | Approx. Macro F1 | Notes |
|---|---|---|---|
| BERT teacher (FP32) | ~0.937 | ~0.936 | Larger, ~110M parameters |
| DistilBERT student (FP32) | ~0.93X | ~0.93X | ~67M parameters |
| DistilBERT student (4-bit) | ~0.88 | ~0.88 | Quantized, much smaller |
(Replace 0.93X with your final student numbers if you log them.)
import torch
from transformers import (
AutoTokenizer,
AutoModelForSequenceClassification,
BitsAndBytesConfig,
)
model_id = "saketgarodia1/distilbert-IT-ticket-student-4bit"
# 4-bit NF4 config (same as used for export)
nf4_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.bfloat16,
bnb_4bit_use_double_quant=True,
)
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSequenceClassification.from_pretrained(
model_id,
quantization_config=nf4_config,
device_map="auto", # place layers on available GPU(s)
)
text = "VPN not connecting to corporate WiFi"
inputs = tokenizer(text, return_tensors="pt").to(model.device)
with torch.no_grad():
logits = model(**inputs).logits
pred_id = logits.argmax(dim=-1).item()
print("Predicted class id:", pred_id)