YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

DistilBERT โ€“ AG News (Textklassifikation)

Kompaktes DistilBERT-Modell, trainiert zur Klassifikation von AG-News-Titeln/Texten (z. B. World, Sports, Business, Sci/Tech).

Quickstart

import torch
from transformers import DistilBertForSequenceClassification, DistilBertTokenizer

MODEL_ID = "verwec/distil_ag_news"   # ggf. feste Revision angeben: revision="v1.0.0"

tokenizer = DistilBertTokenizer.from_pretrained(MODEL_ID)
model = DistilBertForSequenceClassification.from_pretrained(MODEL_ID)
model.eval()

def predict(text: str) -> str:
    inputs = tokenizer(
        text,
        return_tensors="pt",
        padding="max_length",
        truncation=True,
        max_length=512,   # falls du eine andere Lรคnge genutzt hast, hier anpassen
    )
    with torch.no_grad():
        outputs = model(**inputs)
    idx = outputs.logits.argmax(dim=1).item()
    return model.config.id2label[idx]

print(predict("Boris Becker wins Wimbledon."))
Downloads last month
3
Safetensors
Model size
65.8M params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support