fancyzhx/ag_news
Viewer • Updated • 128k • 88.6k • 190
This model is a fine-tuned version of bert-base-uncased
on the AG News dataset.
It classifies English news headlines or articles into four categories:
| Label | Category | Description |
|---|---|---|
| 0 | World | International and world news |
| 1 | Sports | Sports-related news |
| 2 | Business | Financial and economic news |
| 3 | Sci/Tech | Science and technology news |
The model was trained for text classification using the transformers library from Hugging Face.
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
tokenizer = AutoTokenizer.from_pretrained("Vantish/bert-based-uncased-agnews4-v01")
model = AutoModelForSequenceClassification.from_pretrained("Vantish/bert-based-uncased-agnews4-v01")
text = "NASA launches a new satellite to study climate change."
inputs = tokenizer(text, return_tensors="pt")
outputs = model(**inputs)
pred = torch.argmax(outputs.logits, dim=-1).item()
label_map = {
0: "World",
1: "Sports",
2: "Business",
3: "Sci/Tech"
}
print("Predicted label:", label_map[pred])
bert-base-uncasedTrained on a single NVIDIA GPU (e.g., T4 or V100).
| Metric | Score | | F1 Score | 85.6% | | Accuracy | 85.5% |
⚠️ Replace with your actual evaluation results if available.
If you use this model, please cite:
@misc{bert_agnews_finetune,
title={BERT Base Uncased Fine-Tuned on AG News},
author={Vantish},
year={2025},
howpublished={\url{https://huggingface.co/Vantish/bert-based-uncased-agnews4-v01}},
}
Author: [Vantish]