Tokenizer - Raises wrong "UserWarning: `max_length` is ignored when `padding`=`True`"
In the newest version of transformers (4.11.2 & 4.12.0.dev0) I get the following warning:
```
C:\Anaconda3\envs\sbert\lib\site-packages\transformers\tokenization_utils_base.py:2227: UserWarning: `max_length` is ignored when `padding`=`True`.
  warnings.warn("`max_length` is ignored when `padding`=`True`.")
```


Code to re-produce:
```python
from transformers import AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained('bert-base-uncased')
texts = ["Short sentence", "A really really really really really long sentence to test max length"]

output = tokenizer(texts, padding=True, truncation=True, max_length=5, return_tensors='pt')
print(output['input_ids'].shape)

output = tokenizer(texts, padding=True, truncation=True, return_tensors='pt')
print(output['input_ids'].shape)
```

Output:
```
C:\Anaconda3\envs\sbert\lib\site-packages\transformers\tokenization_utils_base.py:2227: UserWarning: `max_length` is ignored when `padding`=`True`.
  warnings.warn("`max_length` is ignored when `padding`=`True`.")
torch.Size([2, 5])
torch.Size([2, 14])
```` 


As we see, max_length is not ignored when padding = True. It truncates the text as expected to a max_length of 5.

I would say that the warning is incorrect and should not be raised. 

Should I fix it?

Or is it really intended that max_length is ignored when padding=True? This would be horrible, I want to truncate my text to a certain max_length.
Issue is connected to this PR
https://github.com/huggingface/transformers/pull/13509

PR by @shirayu 

Reviewed by @sgugger and @LysandreJik <|||||>I think it is right and the following line should be removed.

https://github.com/huggingface/transformers/blob/8bbb53e20b7873ba7f63be70d4d798e0c3568bfa/src/transformers/tokenization_utils_base.py#L2226-L2227

I must have misunderstood the behavior.
I thought the length was determined independently of the ``max_length`` value as the comment in the last line 2230.

https://github.com/huggingface/transformers/blob/8bbb53e20b7873ba7f63be70d4d798e0c3568bfa/src/transformers/tokenization_utils_base.py#L2223-L2230

Please let me know if it is correct to remove those two lines and I should submit a pull request for a fix.<|||||>max_length has impact on truncation.

E.g. you pass a 4 token and 50 token input text, max_length=10 => text is truncated to 10 tokens, i.e. you have now two texts, one with 4 tokens, one with 10 tokens.

Next, we have padding.
`True` and `'longest'` pads the text to 10 tokens. In that case, `padding='max_length'` would also pad to 10 tokens.

A difference is if you pass two texts with e.g. 4 and 6 tokens with `max_length=10`.
`True` and `'longest'` pads the text to 6 tokens
 `padding='max_length'` would pad to 10 tokens.

Yes, the two lines you highlighted that creates the warning should be removed.

Would be great if you could create the PR.


Edit:
Here some code to show the difference:
```
from transformers import AutoTokenizer
import transformers


tokenizer = AutoTokenizer.from_pretrained('bert-base-uncased')
short_input = ["One Two",  "One Two Three"]
long_input = ["Short sentence", "A really really really really really long sentence to test max length"]

output = tokenizer(short_input, padding=True, truncation=True, max_length=10, return_tensors='pt')
print(output['input_ids'].shape) #Output: 5 tokens

output = tokenizer(short_input, padding='max_length', truncation=True, max_length=10, return_tensors='pt')
print(output['input_ids'].shape) #Output: 10 tokens

output = tokenizer(long_input, padding=True, truncation=True, max_length=10, return_tensors='pt')
print(output['input_ids'].shape) #Truncated to 10 tokens & padded to 10 tokens

output = tokenizer(long_input, padding='max_length', truncation=True, max_length=10, return_tensors='pt')
print(output['input_ids'].shape) #Truncated to 10 tokens & padded to 10 tokens
```<|||||>Thank you for the comment.
I've created a pull request.