modernbert-agnews-smoke

answerdotai/ModernBERT-base fine-tuned for single-label text classification on fancyzhx/ag_news.

  • Labels (4): World, Sports, Business, Sci/Tech
  • Date: 2026-07-28 16:41 UTC

Evaluation

Metric Value
accuracy 0.8710
f1_macro 0.8725

Usage

from transformers import AutoModelForSequenceClassification, AutoTokenizer

model = AutoModelForSequenceClassification.from_pretrained("davanstrien/modernbert-agnews-smoke", trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained("davanstrien/modernbert-agnews-smoke", trust_remote_code=True)

inputs = tokenizer("your text here", return_tensors="pt", truncation=True)
print(model.config.id2label[model(**inputs).logits.argmax().item()])

Reproduction

Produced on Hugging Face Jobs (gpu) with the train-classifier.py recipe from uv-scripts. Run it yourself:

hf jobs uv run --flavor gpu --secrets HF_TOKEN \
    https://huggingface.co/datasets/uv-scripts/classification/raw/main/train-classifier.py \
    fancyzhx/ag_news davanstrien/modernbert-agnews-smoke --model answerdotai/ModernBERT-base
Downloads last month
-
Safetensors
Model size
0.1B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for davanstrien/modernbert-agnews-smoke

Finetuned
(1386)
this model

Dataset used to train davanstrien/modernbert-agnews-smoke