KeyError: 'logits'
### System Info

```shell
`transformers` version: 4.16.2
- Platform: Linux-5.13.0-48-generic-x86_64-with-glibc2.31
- Python version: 3.9.7
- PyTorch version (GPU?): 1.9.1+cu111 (True)
- Tensorflow version (GPU?): 2.4.1 (False)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: <fill in>
- Using distributed or parallel set-up in script?: <fill in>
```


### Who can help?

@Narsil


### Information

- [X] The official example scripts
- [ ] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [X] My own task or dataset (give details below)

### Reproduction

bert_name = 'bert-base-cased'
bert_ = AutoModel.from_pretrained(bert_name)
tokenizer_= AutoTokenizer.from_pretrained(bert_name)

classifier = pipeline("zero-shot-classification",model=bert_,tokenizer=tokenizer_)

for d in tqdm(data_loader):

      text=d['text']
      true_label = d["label"]

      for i in range(len(text)):
        tl=c.index(true_label[i])
        Ground_Truth.append(tl)
        output=classifier(text[i],label)
        print('output',output)
        high_score=max(output['scores'])


Error:::
File "/home/kshankar/Desktop/Project/Zero_Shot_updated/Fine-tuning/BBC_distilbert-base-uncased-finetuned-sst-2-english.py", line 187, in eval_model
    output=classifier(text[i],label)
  File "/home/kshankar/miniconda3/lib/python3.9/site-packages/transformers/pipelines/zero_shot_classification.py", line 182, in __call__
    return super().__call__(sequences, **kwargs)
  File "/home/kshankar/miniconda3/lib/python3.9/site-packages/transformers/pipelines/base.py", line 1006, in __call__
    return self.run_single(inputs, preprocess_params, forward_params, postprocess_params)
  File "/home/kshankar/miniconda3/lib/python3.9/site-packages/transformers/pipelines/base.py", line 1030, in run_single
    outputs = self.postprocess(all_outputs, **postprocess_params)
  File "/home/kshankar/miniconda3/lib/python3.9/site-packages/transformers/pipelines/zero_shot_classification.py", line 214, in postprocess
    logits = np.concatenate([output["logits"].numpy() for output in model_outputs])
  File "/home/kshankar/miniconda3/lib/python3.9/site-packages/transformers/pipelines/zero_shot_classification.py", line 214, in <listcomp>
    logits = np.concatenate([output["logits"].numpy() for output in model_outputs])
KeyError: 'logits'

### Expected behavior

```shell
logits is assigned before assignment
```

Hi,

You're loading the pipeline with a `BertModel`, which doesn't include a head on top (like a sequence classification head for instance). Hence, no `logits` are computed.

The zero-shot classification pipeline makes use of sequence classifiers fine-tuned on an [NLI task](http://nlpprogress.com/english/natural_language_inference.html) (natural language inference). Hence, you'll need to provide an `xxxForSequenceClassification` model fine-tuned on such a dataset.<|||||>This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.<|||||>> Hi,
> 
> You're loading the pipeline with a `BertModel`, which doesn't include a head on top (like a sequence classification head for instance). Hence, no `logits` are computed.
> 
> The zero-shot classification pipeline makes use of sequence classifiers fine-tuned on an [NLI task](http://nlpprogress.com/english/natural_language_inference.html) (natural language inference). Hence, you'll need to provide an `xxxForSequenceClassification` model fine-tuned on such a dataset.

Thank you for the response!

It's the same even if I use the pre-trained zero-shot classification model from Huggingface.

Example:
bert_name = ‘facebook/bart-large-mnli’
model = AutoModel.from_pretrained(bert_name)
tokenizer = AutoTokenizer.from_pretrained(bert_name)
classifier = pipeline(“zero-shot-classification”, model = model , tokenizer=tokenizer)<|||||>You need to replace `AutoModel` with `AutoModelForSequenceClassification` and use a model that supports `AutoModelForSequenceClassification`.

Or use directly 
```
pipe = pipeline(model="facebook/bart-large-mnli")
print(pipe("Is this ok?", candidate_labels=["Science", "politics"])
```<|||||>> You need to replace `AutoModel` with `AutoModelForSequenceClassification` and use a model that supports `AutoModelForSequenceClassification`.
> 
> Or use directly
> 
> ```
> pipe = pipeline(model="facebook/bart-large-mnli")
> print(pipe("Is this ok?", candidate_labels=["Science", "politics"])
> ```

Its working. Thanks alot. 