Create a torchscript version of Tokenizer in Bert
Hi, 

Not sure if a feature request is a proper flag for the below request: 

I want to create an executable version of Tokenizer for Bert - Below is a small code piece:

```
from transformers import AutoTokenizer, AutoModel
import torch

sentences = ['This framework generates tokens for each input sentence']
tokenizer_model = AutoTokenizer.from_pretrained("sentence-transformers/paraphrase-mpnet-base-v2", torchscript=True)
encoded_input = tokenizer_model(sentences, padding=True, truncation=True, max_length=128, return_tensors='pt')

# !!! complains that 'tokenizer_model' doesn't have eval()
tokenizer_model.eval();    

# !!! tokenizer_model takes list of sentences as inputs, how should I provide tensorial dummpy inputs?
traced_tokenizer_model = torch.jit.trace(tokenizer_model, dummpy_inputs)
torch.jit.save(traced_tokenizer_model, "traced_tokenize_bert.pt")
```
My first problem is that `tokenizer_model` doesn’t have `eval()` - So how I can follow the guideline for creating the traced_models.

My second problem is that the `tokenizer_model` takes as inputs a list of strings. How am I supposed to provide tensorial form dummy inputs to create the `traced_tokenizer_model`?


I have followed the instructions on your page for creating torchscripts but do not know how I can create one for the Tokenizer module above.


Hello! I think you're mistaking tokenizers for models. The two are part of the NLP pipeline, but they're very different. The tokenizer prepares the inputs for the model - but it isn't a PyTorch module. It's either plain Python code, or a rust object with a Python wrapper (like it is the case here).

Since it's not a torch module - it doesn't make sense for it to have the `eval` method. Same for your second question, a tokenizer cannot be traced as it's not a torch module.<|||||>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.