Cannot use datasets with tokenizer in torchscript

I was trying to use xlm-roberta for label classification task and set the flag torchscript=True in both model.pretrained and tokenizer.frompretrained but for some reason, is consuming a lot of memory
I tried to set return tensors =‘pt’ in tokenizer - but datasets object expects list of nump array and hence getting an error