Tokenizer prepare_for_model Error inconsistency
Author: r-stiller
Pull request: no

## Environment info
- `transformers` version: 4.16.2
- Platform: Windows 10
- Python version: 3.9.10

[GitBlame](https://github.com/huggingface/transformers/blame/b87c044c79a408c0a1e7f7b046b5b4ce999c2d0e/src/transformers/tokenization_utils_base.py#L2974-L2978):
- @LysandreJik, @thomwolf 

## Information
Hello there,
I ran into a problem when using the `PreTrainedTokenizerBase.prepare_for_model` function.
The function doesen't throw the same error message when the setting the parameter `return_token_type_ids` to either `None` or `True`.

The value `None` makes the function fetch the default model parameter which is `True` (for the example below).
So I expect the function to throw the same message.

Within the functions [definition](https://github.com/huggingface/transformers/blob/b87c044c79a408c0a1e7f7b046b5b4ce999c2d0e/src/transformers/tokenization_utils_base.py#L2956-L2978) the parameter sanity check is performed before getting the model default parameters.
I propose to swap the fetching of the model defaults with the sanity check.

## To reproduce
Minimal code example:
```
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained('bert-base-uncased')
sentences = ['Sentence number one.',
             'Sentence number two is longer to trigger padding.']

token_ids = tokenizer.batch_encode_plus(
    sentences,
    add_special_tokens=True,
    truncation=False,
    padding=False)
token_ids = token_ids['input_ids']

# I do stuff with the IDs here.  For e.g. applying a custom truncate function.
```

With `return_token_type_ids` set to `None`.
```
tokenizer.prepare_for_model(
    token_ids,
    add_special_tokens=False,
    padding='longest',
    truncation=False,
    return_attention_mask=None)  # Use tokenizers default
```
```
Traceback (most recent call last):
  File "C:\Users\rs\miniconda3\envs\tf\lib\site-packages\IPython\core\interactiveshell.py", line 3457, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-4-7db0043bfd18>", line 1, in <module>
    sia.predict(text_neg)
  File "C:\Users\rs\Documents\repos\Python\test\sentiment_analysis\transformers_text_classification.py", line 137, in predict
    input_batch = self._tokenizer.prepare_for_model(
  File "C:\Users\rs\miniconda3\envs\tf\lib\site-packages\transformers\tokenization_utils_base.py", line 3003, in prepare_for_model
    encoded_inputs = self.pad(
  File "C:\Users\rs\miniconda3\envs\tf\lib\site-packages\transformers\tokenization_utils_base.py", line 2829, in pad
    outputs = self._pad(
  File "C:\Users\rs\miniconda3\envs\tf\lib\site-packages\transformers\tokenization_utils_base.py", line 3197, in _pad
    encoded_inputs["token_type_ids"] + [self.pad_token_type_id] * difference
TypeError: unsupported operand type(s) for +: 'int' and 'list'
```

## Expected behavior
With `return_token_type_ids` set to `True`.
```
tokenizer.prepare_for_model(
    token_ids,
    add_special_tokens=False,
    padding='longest',
    truncation=False,
    return_token_type_ids=True) # Explicitly set to true
```
```
Traceback (most recent call last):
  File "C:\Users\rs\miniconda3\envs\tf\lib\site-packages\IPython\core\interactiveshell.py", line 3457, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-4-7db0043bfd18>", line 1, in <module>
    sia.predict(text_neg)
  File "C:\Users\rs\Documents\repos\Python\test\sentiment_analysis\transformers_text_classification.py", line 137, in predict
    input_batch = self._tokenizer.prepare_for_model(
  File "C:\Users\rs\miniconda3\envs\tf\lib\site-packages\transformers\tokenization_utils_base.py", line 2937, in prepare_for_model
    raise ValueError(
ValueError: Asking to return token_type_ids while setting add_special_tokens to False results in an undefined behavior. Please set add_special_tokens to True or set return_token_type_ids to None.
```

Comments:
cc @SaulLu 

We should also probably put this method as private/internal with a deprecation cycle as I don't think it's tested outside of the `__call__`/`encode`/`encode_plus` methods

Thanks for the issue @r-stiller!

Indeed, I don't think we test that this method returns certain errors - we have two tests dedicated to it `test_prepare_for_model` and `test_compare_prepare_for_model`. But I agree that having this method public make things harder to maintain.

@r-stiller , could you share with us why you wanted to use `prepare_for_model` on a list of ids? That would be very useful to know how its currently used. :smile: 

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/master/CONTRIBUTING.md) are likely to be ignored.

@SaulLu sorry for my late reply...

I wanted to apply a custom truncate function which removes tokens from the middle of oversized senteces instead of cutting them on the left/right side. 
(1/4 from the beginning and 3/4 from the end of the sentence)

Therefore I obtained the token IDs with `batch_encode_plus` to get their count.
If their count exceeded the given max. sequence length I truncated them.

After that I wanted to use `prepare_for_model` to get my batch ready for the model (padding, attention mask and type Ids).

Or in short:
`batch_encode_plus` -> `custom truncate` -> `prepare_for_model`. 

Since this lead to the error above I changed my code to the following:
`batch_encode_plus` -> `custom truncate` -> `batch_decode` -> `batch_encode_plus`