CoolFace
Modelpublic

Vantish/bert-based-uncased-agnews4-v01

sourceHugging Faceapache-2.0updated 1y agoView on Hugging Face
0likes6downloads
Model Card

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:

LabelCategoryDescription
0WorldInternational and world news
1SportsSports-related news
2BusinessFinancial and economic news
3Sci/TechScience 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

python
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:

bibtex
@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


Author

Author: [Vantish]