DistilBERT_ZeroShot / README.md
AyoubChLin's picture
Update README.md
85290a9
|
raw
history blame
1.7 kB
---
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.