SetFit/ag_news
Viewer • Updated • 128k • 7.92k • 8
This model is a fine-tuned version of bert-base-uncased for news topic classification on the AG News dataset.
It predicts one of four categories: World, Sports, Business, Sci/Tech.
bert-base-uncasedSetFit/ag_news| Epoch | Training Loss | Validation Loss | F1 Score |
|---|---|---|---|
| 1 | 0.2005 | 0.1875 | 0.9422 |
| 2 | 0.1171 | 0.1948 | 0.9470 |
| 3 | 0.0853 | 0.2458 | 0.9457 |
Final Training Metrics:
The model can be used for:
from transformers import AutoTokenizer, AutoModelForSequenceClassification
model_name = "Maarij-Aqeel/BERT_news_classification"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
text = "The stock market saw a significant rise today as..."
inputs = tokenizer(text, return_tensors="pt")
outputs = model(**inputs)
predicted_label = outputs.logits.argmax(dim=-1).item()
print(predicted_label)
Base model
google-bert/bert-base-uncased