ModernBERT Emotion Detection — QAT INT8

Fine-tuned and quantized version of answerdotai/ModernBERT-base for 6-class emotion classification using the dair-ai/emotion dataset.

Quantization

  • Method: INT8 weight-only quantization via torchao
  • Weights: INT8
  • Activations: FP32
  • Speedup: ~2x faster on CPU vs FP32

Labels

ID Label
0 sadness
1 joy
2 love
3 anger
4 fear
5 surprise

Usage

from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

tokenizer = AutoTokenizer.from_pretrained("Sukuna404/modernbert-emotion-qat-int8")
model = AutoModelForSequenceClassification.from_pretrained(
    "Sukuna404/modernbert-emotion-qat-int8"
)
model.eval()

def predict(text):
    inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)
    with torch.no_grad():
        outputs = model(**inputs)
    pred_id = outputs.logits.argmax().item()
    return model.config.id2label[pred_id]

print(predict("I am so happy today!"))  # joy
Downloads last month
32
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Sukuna404/modernbert-emotion-qat-int8

Finetuned
(1271)
this model

Dataset used to train Sukuna404/modernbert-emotion-qat-int8