Target is out of bounds

Hello, I was following the Transformers tutorial (https://docs.fast.ai/tutorial.transformers.html), and tried to replace the GPT2 Model with XLM like so:

pretrained_weights = 'xlm-mlm-tlm-xnli15-1024'
tokenizer = XLMTokenizer.from_pretrained(pretrained_weights)
model = XLMModel.from_pretrained(pretrained_weights)

However, I now get the following error when running learn.validate():
Target 18395 is out of bounds.

I have tried roberta and distilbert as well and the error is the same though the index is different.
What is causing this issue?