token classification pipeline does not use attention mask, affects predictions
Author: CallumMcMahon
Pull request: no

## Environment info
<!-- You can run the command `transformers-cli env` and copy-and-paste its output below.
     Don't forget to fill out the missing fields in that output! -->

- `transformers` version: 4.17.0
- Platform: Mac
- Python version: 3.7.10
- PyTorch version (GPU?): 1.8.1 no GPU
- Using GPU in script?: no
- Using distributed or parallel set-up in script?: no

### Who can help
@Narsil 


## Information

Model I am using: Bert for token classification

The problem arises when using:
* [ ] the official example scripts: (give details below)
* [X] my own modified scripts: (give details below)

The tasks I am working on is:
* [ ] an official GLUE/SQUaD task: (give the name)
* [X] my own task or dataset: (give details below)

NER pipeline

## To reproduce

Steps to reproduce the behavior:

```python
from transformers import AutoModelForTokenClassification, AutoTokenizer, \
    TokenClassificationPipeline

model = AutoModelForTokenClassification.from_pretrained("alvaroalon2/biobert_diseases_ner")
tokenizer = AutoTokenizer.from_pretrained("alvaroalon2/biobert_diseases_ner")

pipeline = TokenClassificationPipeline(model=model,
                                       tokenizer=tokenizer,
                                       aggregation_strategy="first",
                                       ignore_labels=["0", "O"],
                                       )
sentences = ["hello, I have influenza",
             "Hepatitis is a known problem for many nations, particularly in "
             "combination with rabies"]

print(pipeline(sentences, batch_size=1))
print(pipeline(sentences, batch_size=2))
```

output:
```python
[[{'entity_group': 'DISEASE', 'score': 0.9999732, 'word': 'influenza', 'start': 14, 'end': 23}], [{'entity_group': 'DISEASE', 'score': 0.99998534, 'word': 'Hepatitis', 'start': 0, 'end': 9}, {'entity_group': 'DISEASE', 'score': 0.99989414, 'word': 'rabies', 'start': 80, 'end': 86}]]
[[], [{'entity_group': 'DISEASE', 'score': 0.99998534, 'word': 'Hepatitis', 'start': 0, 'end': 9}, {'entity_group': 'DISEASE', 'score': 0.99989414, 'word': 'rabies', 'start': 80, 'end': 86}]]
```

<!-- If you have code snippets, error messages, stack traces please provide them here as well.
     Important! Use code tags to correctly format your code. See https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks#syntax-highlighting
     Do not use screenshots, as they are hard to read and (more importantly) don't allow others to copy-and-paste your code.-->

## Expected behavior

The outputs should be the same regardless of batch size. The attention mask is not passed to the model, leading to the discrepancy. If may just be a case of setting `return_attention_mask=True` in the [preprocessing](https://github.com/huggingface/transformers/blob/25b8f9a85b929e2b9acb190b6df7f094d07e4b61/src/transformers/pipelines/token_classification.py#L195) function.

Let me know if you need any more clarification!

Thanks


Comments:
Hi @CallumMcMahon ,

Thanks you very much for reporting this.

It is indeed the case that somehow `return_attention_mask` is deliberately set to `False`. I tried to look back in history why it was there but I couldn't find a very good reason, so I removed it in the fix PR.