Error using XLNet for text classification: No component 'trf_tok2vec' found in pipeline

This is currently expected – the transformers classifier is a different text classifier implementation with its own component and component dependencies (token-vector-encoding, tokenization alignment etc.). The underlying problem here is that the train recipe disables all components except for the one you train (which makes sense, because that's the only one you want to update). But that doesn't work for this component, since it has other component dependencies.

You can probably work around it by editing the recipe and the call to nlp.disable_pipes. However, you're probably still better off using the standalone training script we provide in the spacy-transformers repo. To get good results with the transformer models, you typically want to tune the hyperparameters and you probably also want to run it on GPU. Both of this is much easier if you have a standalone script.