File size: 1,751 Bytes
1fed88b
 
85290a9
 
 
 
 
 
 
1fed88b
85290a9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41bd2ae
85290a9
 
 
 
 
 
 
 
 
1b11ce0
b05964f
 
41bd2ae
b05964f
85290a9
b05964f
 
85290a9
b05964f
 
 
85290a9
b05964f
85290a9
b05964f
41bd2ae
85290a9
 
 
 
 
 
 
 
 
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
56
57
58
59
60
61
62
63
64
65
---
license: apache-2.0
datasets:
- AyoubChLin/CNN_News_Articles_2011-2022
language:
- en
metrics:
- accuracy
pipeline_tag: zero-shot-classification
---

# DistilBERT for Zero Shot Classification

This repository contains a DistilBERT model trained for zero-shot classification on CNN articles. The model has been evaluated on CNN articles and achieved an accuracy of 0.956 and an F1 score of 0.955.

## Model Details
- Architecture: DistilBERT
- Training Data: CNN articles
- Accuracy: 0.956
- F1 Score: 0.955

## Usage

To use this model for zero-shot classification, you can follow the steps below:



1. Load the trained model:
   ```python
   
   from transformers import AutoTokenizer, AutoModelForSequenceClassification

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

    model = AutoModelForSequenceClassification.from_pretrained("AyoubChLin/DistilBERT_ZeroShot")

   ```

4. Classify text using zero-shot classification:
   
    ```python
   
   
       from transformers import pipeline

       # Create a zero-shot classification pipeline
       classifier = pipeline("zero-shot-classification", model=model, tokenizer=tokenizer)

       # Classify a sentence
       sentence = "The latest scientific breakthroughs in medicine"
       candidate_labels = ["politics", "sports", "technology", "business"]

       result = classifier(sentence, candidate_labels)

       print(result)
   
   ```

   The output will be a dictionary containing the classified label and the corresponding classification score.

## About the Author

This work was created by Ayoub Cherguelaine.

If you have any questions or suggestions regarding this repository or the trained model, feel free to reach out to Ayoub Cherguelaine.