yes, there’s an official guide for text classification here: 🤗 Transformers Notebooks — transformers 4.5.0.dev0 documentation 4
in that notebook you can see how the number of labels is specified in the model config and you could try adapting this code to your use case