Downloads · 30 days
22
1% of all-time downloads
JiaqiLee/bert-agnews
bert-agnews is a text classification model from JiaqiLee. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as afl-3.0.
This model is a fine-tuned version of the bert-base-uncased model to classify news articles into one of four categories: World(label 0), Sports(label 1), Business(label 2), Sci/Tech(label 3).
Downloads · 30 days
22
1% of all-time downloads
All-time downloads
2.6K
Public
Repo size
876 MB
Likes
4
Public
Click a slice to open those files.
.bin438 MB · 100%
From the Hugging Face model README
This model is a fine-tuned version of the bert-base-uncased model to classify news articles into one of four categories: World(label 0), Sports(label 1), Business(label 2), Sci/Tech(label 3).
You can use the model with the following code.
from transformers import BertForSequenceClassification, BertTokenizer, TextClassificationPipeline
model_path = "JiaqiLee/bert-agnews"
tokenizer = BertTokenizer.from_pretrained(model_path)
model = BertForSequenceClassification.from_pretrained(model_path, num_labels=4)
pipeline = TextClassificationPipeline(model=model, tokenizer=tokenizer)
print(pipeline("Google scores first-day bump of 18 (USATODAY.com): USATODAY.com - Even a big first-day jump in shares of Google (GOOG) couldn't quiet debate over whether the Internet search engine's contentious auction was a hit or a flop."))
The training data comes from HuggingFace AGNews dataset. We use 90% of the train.csv data to train the model and the remaining 10% for evaluation.
The model achieves 0.9447 classification accuracy in AGNews test dataset.