bert-base-uncased-agnews4-v01
Model description
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.
Intended uses & limitations
Intended uses
- News topic classification
- Benchmarking or educational purposes
- Text categorization for NLP pipelines
Limitations
- The model is trained on English text only.
- It may perform poorly on informal or domain-specific text (e.g., social media).
- The dataset contains news articles up to 2015; recent topics or events may be underrepresented.
How to use
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])
Training procedure
- Base model:
bert-base-uncased - Dataset: AG News
- Task: Text classification (4 classes)
- Optimizer: AdamW
- Learning rate: 2e-5
- Batch size: 16
- Epochs: 3
- Loss function: CrossEntropyLoss
- Evaluation metric: Accuracy
Hardware
Trained on a single NVIDIA GPU (e.g., T4 or V100).
Evaluation results
| Metric | Score | | F1 Score | 85.6% | | Accuracy | 85.5% |
⚠️ Replace with your actual evaluation results if available.
Citation
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}},
}
License
- Base model: Apache 2.0 License
- Fine-tuned weights: Apache 2.0
Author
Author: [Vantish]
- Downloads last month
- 1
Dataset used to train Vantish/bert-based-uncased-agnews4-v01
Evaluation results
- Accuracy on AG Newsself-reported0.855
- F1 Score on AG Newsself-reported0.856