Question answering pipeline fails with long context
Author: jswift24
Pull request: no
Labels: name: wontfix

name: Core: Pipeline

## 🐛 Bug

<!-- Important information -->

Model I am using (Bert, XLNet....): Question Answering Pipeline / Distilbert

Language I am using the model on (English, Chinese....):

The problem arise when using:
* [x] the official example scripts: (give details): Based on the sample pipeline code form here: https://github.com/huggingface/transformers#quick-tour-of-pipelines
* [] my own modified scripts: (give details)

The tasks I am working on is:
* [x] an official GLUE/SQUaD task: (give the name)
* [ ] my own task or dataset: (give details)

## To Reproduce
I think I found a bug in the pipeline code. It fails when there's a long context in a list. See below:


```
from transformers import pipeline
nlp = pipeline('question-answering')

long_str = 'These are some irrelevant words. ' * 100
long_str = 'Pipeline have been included in the huggingface/transformers repository. ' + long_str

#Works
nlp(
    {
    'question': 'What is the name of the repository ?',
    'context': 'Pipeline have been included in the huggingface/transformers repository. '
    },
    {
    'question': 'What is the name of the repository ?',
    'context': 'Pipeline have been included in the huggingface/transformers repository. '
    }     
)

#Long context by itself - works
nlp(
    {
    'question': 'What is the name of the repository ?',
    'context': long_str
    })


#Long context in a list - fails
nlp(
    {
    'question': 'What is the name of the repository ?',
    'context': long_str
    },
    {
    'question': 'What is the name of the repository ?',
    'context': 'Pipeline have been included in the huggingface/transformers repository. '
    }     
)
```

Here's the error message:
```
Converting examples to features: 100%|██████████| 2/2 [00:00<00:00, 87.19it/s]
Traceback (most recent call last):

  File "<ipython-input-3-e795fc7f26bf>", line 8, in <module>
    'context': 'Pipeline have been included in the huggingface/transformers repository. '

  File "c:\users\admin\appdata\local\programs\python\python37\lib\site-packages\transformers\pipelines.py", line 686, in __call__
    for s, e, score in zip(starts, ends, scores)

  File "c:\users\admin\appdata\local\programs\python\python37\lib\site-packages\transformers\pipelines.py", line 686, in <listcomp>
    for s, e, score in zip(starts, ends, scores)

IndexError: index 0 is out of bounds for axis 0 with size 0
```

<!-- If you have a code sample, error messages, stack traces, please provide it here as well. -->

## Expected behavior


Would like to get the answer for the second example.

<!-- A clear and concise description of what you expected to happen. -->

## Environment

* OS: Windows
* Python version:  Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]
* PyTorch version: N/A
* PyTorch Transformers version (or branch): master
* Using GPU ?
* Distributed or parallel setup ?
* Any other relevant information:

## Additional context

<!-- Add any other context about the problem here. -->


Comments:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.


I also have this issue

This seems to be fixed when limiting the batch size.