IndexError: Dimension out of range (expected to be in range of [-1, 0], but got 1)
Author: VaibhavSxn
Pull request: no

# 🐛 Bug
I am running Huggingface's nlp pipeline. The code is below:

```
nlp = pipeline("question-answering", 
               model = 'distilbert-base-cased-distilled-squad', 
               tokenizer='distilbert-base-cased-distilled-squad')
```

Model I am using is pipeline.

I try run an example using docker and I get the following error:

```
convert squad examples to features: 100%|██████████| 1/1 [00:00<00:00, 360.86it/s]
add example index and unique id: 100%|██████████| 1/1 [00:00<00:00, 3120.76it/s]
myimage_1  | [2020-05-26 08:38:22,060] ERROR in app: Exception on /deep/search [POST]
myimage_1  | Traceback (most recent call last):
myimage_1  |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app
myimage_1  |     response = self.full_dispatch_request()
myimage_1  |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request
myimage_1  |     rv = self.handle_user_exception(e)
myimage_1  |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception
myimage_1  |     reraise(exc_type, exc_value, tb)
myimage_1  |   File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
myimage_1  |     raise value
myimage_1  |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request
myimage_1  |     rv = self.dispatch_request()
myimage_1  |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request
myimage_1  |     return self.view_functions[rule.endpoint](**req.view_args)
myimage_1  |   File "main.py", line 50, in launch_app
myimage_1  |     answers = nlp(question=ques0, context=abstract, topk = 10)
myimage_1  |   File "/usr/local/lib/python3.7/site-packages/transformers/pipelines.py", line 1010, in __call__
myimage_1  |     start, end = self.model(**fw_args)
myimage_1  |   File "/usr/local/lib/python3.7/site-packages/torch/nn/modules/module.py", line 550, in __call__
myimage_1  |     result = self.forward(*input, **kwargs)
myimage_1  |   File "/usr/local/lib/python3.7/site-packages/transformers/modeling_distilbert.py", line 720, in forward
myimage_1  |     input_ids=input_ids, attention_mask=attention_mask, head_mask=head_mask, inputs_embeds=inputs_embeds
myimage_1  |   File "/usr/local/lib/python3.7/site-packages/torch/nn/modules/module.py", line 550, in __call__
myimage_1  |     result = self.forward(*input, **kwargs)
myimage_1  |   File "/usr/local/lib/python3.7/site-packages/transformers/modeling_distilbert.py", line 482, in forward
myimage_1  |     inputs_embeds = self.embeddings(input_ids)  # (bs, seq_length, dim)
myimage_1  |   File "/usr/local/lib/python3.7/site-packages/torch/nn/modules/module.py", line 550, in __call__
myimage_1  |     result = self.forward(*input, **kwargs)
myimage_1  |   File "/usr/local/lib/python3.7/site-packages/transformers/modeling_distilbert.py", line 86, in forward
myimage_1  |     seq_length = input_ids.size(1)
myimage_1  | IndexError: Dimension out of range (expected to be in range of [-1, 0], but got 1)
```

My python version in 3.7.4.

Please help in fixing this.



Comments:
Hi, what's your transformers and pytorch version? Is that the entire code you're using?

Your code doesn't crash here but crashes at the line

```py
answers = nlp(question=ques0, context=abstract, topk = 10)
```

Do you mind providing the question and the context you're using?

Sorry, its a mistake on my part. Thanks for your reply.