ValueError: Unable to set proper padding strategy as the tokenizer does not have a padding token. 
# ❓ Questions & Help

<!-- The GitHub issue tracker is primarly intended for bugs, feature requests,
     new models and benchmarks, and migration questions. For all other questions,
     we direct you to Stack Overflow (SO) where a whole community of PyTorch and
     Tensorflow enthusiast can help you out. Make sure to tag your question with the
     right deep learning framework as well as the huggingface-transformers tag: 
     https://stackoverflow.com/questions/tagged/huggingface-transformers 
     
     If your question wasn't answered after a period of time on Stack Overflow, you
     can always open a question on GitHub. You should then link to the SO question 
     that you posted.
     -->

## Details
Using pad_token, but it is not set yet. 

tokenizer = GPT2Tokenizer.from_pretrained('gpt2')

tokens = tokenizer.batch_encode_plus(
    ["This is a sample", "This is another longer sample text"], 
    pad_to_max_length=True ,max_length=10 ,return_attention_mask = True# First sentence will have some PADDED tokens to match second sequence length
)

for i in range(2):
    print("Tokens (int)      : {}".format(tokens['input_ids'][i]))
    print("Tokens (str)      : {}".format([tokenizer.convert_ids_to_tokens(s) for s in tokens['input_ids'][i]]))
    print("Tokens (attn_mask): {}".format(tokens['attention_mask'][i]))
    print()

![pad_token_not_Set](https://user-images.githubusercontent.com/6847024/79693840-9f6c6400-828a-11ea-9760-ef3f8a12c6ae.PNG)
<|||||>tokenizer.pad_token = 0<|||||>You have to set the pad_token_id yourself as it's stated in the error message ;-). I would recommend using the `eos_token_id` as the `pad_token_id` for GPT2:
```python 
tokenizer = GPT2Tokenizer.from_pretrained('gpt2')
tokenizer.pad_token = tokenizer.eos_token
```
as it's written in the error message ;-)<|||||>I hit the same issue after using [add_special_tokens](https://huggingface.co/transformers/main_classes/tokenizer.html#transformers.PreTrainedTokenizer.add_special_tokens) with `{"pad_token": "PAD"}` dictionary.

I understand based on the error and the documentation it should not raise the error, right? @patrickvonplaten should the issue be reopened?<|||||>For completeness: 
- patrickvonplaten tip `tokenizer.pad_token = tokenizer.eos_token` solved it
- the whole error message for me was

```
ValueError: Unable to set proper padding strategy as the tokenizer does not have a padding token. In this case please set the `pad_token` `(tokenizer.pad_token = tokenizer.eos_token e.g.)` 
or add a new pad token via the function add_special_tokens if you want to use a padding strategy
```<|||||>You didn't set pad_token. You can set it like this:
```python
tokenizer.pad_token = "[PAD]"
```