RoBERTa: A Robustly Optimized BERT Pretraining Approach
Paper • 1907.11692 • Published • 10
How to use MhoOmm/News_Classifier_Model with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="MhoOmm/News_Classifier_Model") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("MhoOmm/News_Classifier_Model")
model = AutoModelForSequenceClassification.from_pretrained("MhoOmm/News_Classifier_Model")This model is a fine-tuned RoBERTa model for multiclass news classification. It predicts the category of a news headline or article among four classes:
The model was fine-tuned on the AG News dataset using Hugging Face Transformers and PyTorch.
| Label ID | Category |
|---|---|
| 0 | World |
| 1 | Sports |
| 2 | Business |
| 3 | Sci/Tech |
This model can be used for:
This model is not intended for:
from transformers import AutoTokenizer
from transformers import AutoModelForSequenceClassification
import torch
model_name = "MhoOmm/news-classifier"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
text = "Apple launches a new AI-powered processor"
inputs = tokenizer(
text,
return_tensors="pt",
truncation=True
)
with torch.no_grad():
outputs = model(**inputs)
prediction = outputs.logits.argmax(-1).item()
print(model.config.id2label[prediction])
The model was fine-tuned on the AG News dataset.
The model was evaluated using classification accuracy.
| Input | Prediction |
|---|---|
| India defeats Australia in the cricket final | Sports |
| Stock market reaches a new all-time high | Business |
| Apple unveils a new AI-powered device | Sci/Tech |
| Global leaders meet to discuss climate policy | World |
Created by MhoOmm as an end-to-end NLP project demonstrating:
If you use this model, please cite the original RoBERTa paper:
RoBERTa: A Robustly Optimized BERT Pretraining Approach
Yinhan Liu, Myle Ott, Naman Goyal, et al.