Hi ! I think some users have already experienced this issue and found a fix in this thread:
  

      github.com/huggingface/transformers
  

  
    
  
	  
  

  
    
      ValueError: Unable to set proper padding strategy as the tokenizer does not have a padding token.  12
    

    
      
        opened 
        
          
        
        Apr 19, 2020
      
      

        
          closed 
        
          
        
        May 5, 2020
      
        

      
        
          
          banunitte
        
      
    

    
    
  


  
    # ❓ Questions & Help

<!-- The GitHub issue tracker is primarly intended for b…ugs, 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()
  

  

  
    
    
  

  


I hope that helps