File size: 1,463 Bytes
c39c03b |
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 |
---
datasets:
- multi_nli
language: en
license: mit
pipeline_tag: zero-shot-classification
tags:
- bart
- zero-shot-classification
---
# Bart large model for NLI-based Zero Shot Text Classification
This model uses [bart-large](https://huggingface.co/facebook/bart-large).
## Training Data
This model was trained on the [MultiNLI (MNLI)](https://huggingface.co/datasets/multi_nli) dataset in the manner originally described in [Yin et al. 2019](https://arxiv.org/abs/1909.00161).
It can be used to predict whether a topic label can be assigned to a given sequence, whether or not the label has been seen before.
## Usage and Performance
The trained model can be used like this:
```python
from transformers import AutoModelForSequenceClassification, AutoTokenizer, pipeline
# Load model & tokenizer
bart_model = AutoModelForSequenceClassification.from_pretrained('navteca/bart-large-mnli')
bart_tokenizer = AutoTokenizer.from_pretrained('navteca/bart-large-mnli')
# Get predictions
nlp = pipeline('zero-shot-classification', model=bart_model, tokenizer=bart_tokenizer)
sequence = 'One day I will see the world.'
candidate_labels = ['cooking', 'dancing', 'travel']
result = nlp(sequence, candidate_labels, multi_label=True)
print(result)
#{
# "sequence": "One day I will see the world.",
# "labels": [
# "travel",
# "dancing",
# "cooking"
# ],
# "scores": [
# 0.9941897988319397,
# 0.0060537424869835,
# 0.0020010927692056
# ]
#}
``` |