How to batch encode sentences using BertTokenizer?
# ❓ 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
<!-- Description of your issue -->
I would like to create a minibatch by encoding multiple sentences using transformers.BertTokenizer. How can I do it? I tried following code.

```
from transformers import BertTokenizer
tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')

tokenizer.encode('this is the first sentence')
>>> [2023, 2003, 1996, 2034, 6251]

tokenizer.encode(['this is the first sentence', 'another setence'])
>>> [100, 100] # expecting 7 tokens
```
<!-- You should first ask your question on SO, and only if
     you didn't get an answer ask it here on GitHub. -->
**A link to original question on Stack Overflow**:
https://stackoverflow.com/questions/62669261/how-to-encode-multiple-setence-using-transformers-berttokenizer
Hi @RayLei Have a look at this https://huggingface.co/transformers/preprocessing.html