Running  Pipeline batching code from documentation returns TypeError: _batch_encode_plus() got an unexpected keyword argument 'batch_size' on Colab. 
## 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.12.5
- Platform: Linux-5.4.104+-x86_64-with-Ubuntu-18.04-bionic
- Python version: 3.7.12
- PyTorch version (GPU?): 1.10.0+cu111 (True)
- Tensorflow version (GPU?): 2.7.0 (True)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: Yes
- Using distributed or parallel set-up in script?: No

I have Tokenizers version `0.10.3` installed. 

### Who can help
@Narsil @sgugger 

<!-- Your issue will be replied to more quickly if you can figure out the right person to tag with @
 If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**.
 Please tag fewer than 3 people.

Models:

- ALBERT, BERT, XLM, DeBERTa, DeBERTa-v2, ELECTRA, MobileBert, SqueezeBert: @LysandreJik
- encoder-decoder models (For example, BlenderBot, BART, Marian, Pegasus, T5, ByT5): @patrickvonplaten, @patil-suraj
- Longformer, Reformer, TransfoXL, XLNet, FNet: @patrickvonplaten
- FSMT: @stas00
- Funnel: @sgugger
- GPT-2, GPT: @patrickvonplaten, @LysandreJik
- RAG, DPR: @patrickvonplaten, @lhoestq
- TensorFlow: @Rocketknight1
- JAX/Flax: @patil-suraj @patrickvonplaten 
- TAPAS, LayoutLM, LayoutLMv2, LUKE, ViT, BEiT, DEiT, DETR, CANINE: @NielsRogge
- GPT-Neo, GPT-J, CLIP: @patil-suraj
- Wav2Vec2, HuBERT, SpeechEncoderDecoder: @patrickvonplaten, @anton-l

If the model isn't in the list, ping @LysandreJik who will redirect you to the correct contributor.

Library:

- Benchmarks: @patrickvonplaten
- Deepspeed: @stas00
- Ray/raytune: @richardliaw, @amogkam
- Text generation: @patrickvonplaten
- Tokenizers: @LysandreJik
- Trainer: @sgugger
- Pipelines: @Narsil
- Speech: @patrickvonplaten, @anton-l
- Vision: @NielsRogge, @sgugger

Documentation: @sgugger

Model hub:

- for issues with a model, report at https://discuss.huggingface.co/ and tag the model's creator.

HF projects:

- datasets: [different repo](https://github.com/huggingface/datasets)
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)

Examples:

- maintained examples (not research project or legacy): @sgugger, @patil-suraj

For research projetcs, please ping the contributor directly. For example, on the following projects:

- research_projects/bert-loses-patience: @JetRunner
- research_projects/distillation: @VictorSanh

 -->

## Information

I was trying to use batch inference using pipelines and datasets. I was running into issues so tried to just run the [example](https://huggingface.co/docs/transformers/master/main_classes/pipelines#transformers.TextClassificationPipeline) from the docs in Colab. This returns an error `TypeError: _batch_encode_plus() got an unexpected keyword argument 'batch_size'`. 

## To reproduce

Steps to reproduce the behavior:

1. Run example pipeline batching code from [docs](https://huggingface.co/docs/transformers/master/main_classes/pipelines#transformers.TextClassificationPipeline) 

```python
from transformers import pipeline                                                   
from transformers.pipelines.base import KeyDataset
import datasets
import tqdm                                                                         

dataset = datasets.load_dataset("imdb", name="plain_text", split="unsupervised")
pipe = pipeline("text-classification", device=0)
for out in pipe(KeyDataset(dataset, "text"), batch_size=8, truncation="only_first"):
    print(out)
    # [{'label': 'POSITIVE', 'score': 0.9998743534088135}]
    # Exactly the same output as before, but the content are passed
    # as batches to the model
``` 
Returns the following stack trace:

```python
---------------------------------------------------------------------------

TypeError                                 Traceback (most recent call last)

<ipython-input-60-ef0c0f3faa82> in <module>()
      6 dataset = datasets.load_dataset("imdb", name="plain_text", split="unsupervised")
      7 pipe = pipeline("text-classification", device=0)
----> 8 for out in pipe(KeyDataset(dataset, "text"), batch_size=8, truncation="only_first"):
      9     print(out)
     10     # [{'label': 'POSITIVE', 'score': 0.9998743534088135}]

5 frames

/usr/local/lib/python3.7/dist-packages/torch/_utils.py in reraise(self)
    432             # instantiate since we don't know how to
    433             raise RuntimeError(msg) from None
--> 434         raise exception
    435 
    436 

TypeError: Caught TypeError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/worker.py", line 287, in _worker_loop
    data = fetcher.fetch(index)
  File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py", line 49, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/usr/local/lib/python3.7/dist-packages/transformers/pipelines/base.py", line 616, in __getitem__
    processed = self.process(item, **self.params)
  File "/usr/local/lib/python3.7/dist-packages/transformers/pipelines/text_classification.py", line 130, in preprocess
    return self.tokenizer(inputs, return_tensors=return_tensors, **tokenizer_kwargs)
  File "/usr/local/lib/python3.7/dist-packages/transformers/tokenization_utils_base.py", line 2442, in __call__
    **kwargs,
  File "/usr/local/lib/python3.7/dist-packages/transformers/tokenization_utils_base.py", line 2512, in encode_plus
    **kwargs,
  File "/usr/local/lib/python3.7/dist-packages/transformers/tokenization_utils_fast.py", line 496, in _encode_plus
    **kwargs,
TypeError: _batch_encode_plus() got an unexpected keyword argument 'batch_size'
```

<!-- 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
<!-- A clear and concise description of what you would expect to happen. -->

That the pipeline successfully uses batching for inference. 

I suspect this is some user error on my part but since others might try and run the documentation code in Colab I thought it was worth opening an issue. 

I haven't had a chance to test this in a non-Colab environment yet. 
Hello! Could you install from the `master` branch and give it another try?

```py
pip uninstall transformers
pip install git+https://github.com/huggingface/transformers
# Restart colab runtime
```

The current documentation is `master` as we're trying out the new frontend; thanks for your understanding!<|||||>> Hello! Could you install from the `master` branch and give it another try?
> 
> ```python
> pip uninstall transformers
> pip install git+https://github.com/huggingface/transformers
> # Restart colab runtime
> ```
> 
> The current documentation is `master` as we're trying out the new frontend; thanks for your understanding!

This works without any errors now. Thanks so much and, apologies I should have spotted that the docs are for the `master` branch. <|||||>No problem at all, the docs are usually for the stable release, but for this week only we're switching to `master` to try out the new docs.

By the way, what's your feeling about the updated frontend of the documentation?<|||||>> No problem at all, the docs are usually for the stable release, but for this week only we're switching to `master` to try out the new docs.
> 
> By the way, what's your feeling about the updated frontend of the documentation?

I mostly like the updated frontend. One thing I find a bit harder to read is the arguments sections. For example the arguments for `class transformers.TextClassificationPipeline`:

<img width="760" alt="Screenshot 2021-12-03 at 13 47 30" src="https://user-images.githubusercontent.com/8995957/144613158-153f2639-864b-4a61-ae23-defefe29088d.png">

I find it a bit harder to parse this because the `model`, `tokenizer`,`modelcard`  etc. arguments are not that separated. This makes it a bit harder for me to quickly see all of the arguments without reading through. I would find it easier to read if it was split into new lines like:

```
Arguments: 

- model: ajfnjann 
- tokenizer: hahdhf 
- modelcard: thewhrh 
```

This might be more to do with the formating of the underlying docs rather than the frontend though and this is obviously a bit subjective and others might find this format better. 
<|||||>Ah that's a bug in the formatting of the docstrings of those classes, it should not be displayed like this! Will fix that this morning :-)<|||||>@Narsil @sgugger thanks both for your help. I will close this now - hopefully, anyone else running into the same issue this week will stumble on this issue. <|||||>Thanks for the bug report @davanstrien!<|||||>I also encountered the same problem with the new fast tokenizer. Use the old one (`use_fast=False`).
```python
tokenizer = AutoTokenizer.from_pretrained(model_type, use_fast=False)
pipe = TextClassificationPipeline(
      model=model,
      tokenizer=tokenizer,
      batch_size=batch_size,
      device=-1
)
```<|||||>`batch_size` needs to be used on the `pipe` call, not on the `pipeline` call.

```python
tokenizer = AutoTokenizer.from_pretrained(model_type, use_fast=False)
pipe = TextClassificationPipeline(
      model=model,
      tokenizer=tokenizer,
      device=-1
)
for out in pipe(data, batch_size=batch_size):
    # Do something
```

The error and overall UX could be improved for sure (either support this call type or raise proper error).<|||||>> `batch_size` needs to be used on the `pipe` call, not on the `pipeline` call.
> 
> ```python
> tokenizer = AutoTokenizer.from_pretrained(model_type, use_fast=False)
> pipe = TextClassificationPipeline(
>       model=model,
>       tokenizer=tokenizer,
>       device=-1
> )
> for out in pipe(data, batch_size=batch_size):
>     # Do something
> ```
> 
> The error and overall UX could be improved for sure (either support this call type or raise proper error).

Thanks! The documentation is a bit confusing.