File size: 2,373 Bytes
3026509
 
2cd84a6
 
 
 
144e7cb
2cd84a6
144e7cb
 
 
 
 
 
 
 
 
6a4f769
144e7cb
 
 
 
5f6aa97
 
 
144e7cb
6a4f769
144e7cb
 
 
 
 
 
 
 
6a4f769
144e7cb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
---
license: apache-2.0
datasets:
- AyoubChLin/CNN_News_Articles_2011-2022
metrics:
- accuracy
- f1
pipeline_tag: zero-shot-classification
language:
- en
tags:
- zero shot
- text classification
- news classification
---

# Huggingface Model: BART-MNLI-ZeroShot-Text-Classification
This is a Huggingface model fine-tuned on the CNN news dataset for zero-shot text classification task using DistilBART-MNLI. The model achieved an f1 score of 93% and an accuracy of 93% on the CNN test dataset with a maximum length of 128 tokens.

## Authors
This work was done by [CHERGUELAINE Ayoub](https://www.linkedin.com/in/ayoub-cherguelaine/) & [BOUBEKRI Faycal](https://www.linkedin.com/in/faycal-boubekri-832848199/)

## Original Model
[valhalla/distilbart-mnli-12-1](https://huggingface.co/valhalla/distilbart-mnli-12-1)

## Model Architecture
The model architecture is based on the DistilBART-MNLI transformer model. DistilBART is a smaller and faster version of BART that is pre-trained on a large corpus of text and fine-tuned on downstream natural language processing tasks.

## Dataset
The CNN news dataset was used for fine-tuning the model. This dataset contains news articles from the CNN website and is labeled into 6 categories, including politics, health, entertainment, tech, travel, world, and sports.

## Fine-tuning Parameters
The model was fine-tuned for 1 epoch on a maximum length of 256 tokens. The training took approximately 6 hours to complete.

## Evaluation Metrics
The model achieved an f1 score of 93% and an accuracy of 93% on the CNN test dataset with a maximum length of 128 tokens.

# Usage
The model can be used for zero-shot text classification tasks on news articles. It can be accessed via the Huggingface Transformers library using the following code:

```python
from transformers import pipeline, AutoTokenizer, AutoModelForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("AyoubChLin/DistilBart_cnn_zeroShot")

model = AutoModelForSequenceClassification.from_pretrained("AyoubChLin/DistilBart_cnn_zeroShot")
classifier = pipeline(
    "zero-shot-classification",
    model=model,
    tokenizer=tokenizer,
    device=0
)
```
## Acknowledgments
We would like to acknowledge the Huggingface team for their open-source implementation of transformer models and the CNN news dataset for providing the labeled dataset for fine-tuning.