Downloads · 30 days
34
2% of all-time downloads
IT-community/BART_cnn_news_text_classification
BART_cnn_news_text_classification is a text classification model from IT-community. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as apache-2.0.
This is a fine-tuned BART (Bidirectional and Auto-Regressive Transformers) model for text classification on CNN news articles. The model was fine-tuned on a dataset of CNN news articles with labels indicating the arti…
Downloads · 30 days
34
2% of all-time downloads
All-time downloads
2.3K
Public
Parameters
140M
1.1 GB on disk
Likes
0
Public
Click a slice to open those files.
.bin560 MB · 50%
From the Hugging Face model README
This is a fine-tuned BART (Bidirectional and Auto-Regressive Transformers) model for text classification on CNN news articles. The model was fine-tuned on a dataset of CNN news articles with labels indicating the article topic, using a batch size of 32, learning rate of 6e-5, and trained for one epoch.
pip install transformers
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("IT-community/BART_cnn_news_text_classification")
model = AutoModelForSequenceClassification.from_pretrained("IT-community/BART_cnn_news_text_classification")
# Tokenize input text
text = "This is an example CNN news article about politics."
inputs = tokenizer(text, padding=True, truncation=True, max_length=512, return_tensors="pt")
# Make prediction
outputs = model(inputs["input_ids"], attention_mask=inputs["attention_mask"])
predicted_label = torch.argmax(outputs.logits)
print(predicted_label)
The model achieved the following performance metrics on the test set:
Accuracy: 0.9591836734693877
F1-score: 0.958301875401112
Recall: 0.9591836734693877
Precision: 0.9579673040369542
We are a scientific club from Saad Dahleb Blida University named IT Community, created in 2016 by students. We are interested in all IT fields, This work was done by IT Community Club.
Added preprocessing code for CNN news articles
Improved model performance with additional fine-tuning on a larger dataset