Pickle issue with 🤗 tokenizer's encoding
🐛 Bug
Following error is thrown when the 🤗's transformer's tokenizer encode function is called inside the LightningModule. However, the tokenizer encoding works perfectly when it is called outside the  LightningModule:
TypeError: cannot pickle 'Tokenizer' object
Code sample
import nlp
import transformers as tfs
import pytorch_lightning as pl

class Model(pl.LightningModule):
    def __init__(self, ):
        super().__init__()

    def prepare_data(self):
        print("Tokenizer encoding call inside LightningModule")
        dataset = nlp.load_dataset('squad', split='train[:1%]')
        tokenizer = tfs.BertTokenizerFast.from_pretrained('bert-base-cased')
        dataset = dataset.map(lambda example: tokenizer.batch_encode_plus(example['context']), batched=True)

    def forward(self):
        pass

    def training_step(self, batch, batch_idx):
        pass

    def configure_optimizers(self):
        pass

    def train_dataloader(self):
        pass

print("Tokenizer encoding from main") # call outside LightningModule
dataset = nlp.load_dataset('squad', split='train[:1%]')
tokenizer = tfs.BertTokenizerFast.from_pretrained('bert-base-cased')
dataset = dataset.map(lambda example: tokenizer.batch_encode_plus(example['context']), batched=True)


model = Model()
trainer = pl.Trainer()
trainer.fit(model)
Environment
* CUDA:
        - GPU:
                - GeForce RTX 2080 Ti
        - available:         True
        - version:           10.2
* Packages:
        - numpy:             1.18.1
        - pyTorch_debug:     False
        - pyTorch_version:   1.5.0
        - pytorch-lightning: 0.7.6
        - tensorboard:       2.2.2
        - tqdm:              4.46.0
* System:
        - OS:                Linux
        - architecture:
                - 64bit
                - ELF
        - processor:         x86_64
        - python:            3.8.3
        - version:           #75-Ubuntu SMP Tue Oct 1 05:24:09 UTC 2019