Best solution to train multiclass model

Hello,
I would like to train an NLP model that outputs a pair of labels (label1, label2), where label1 belongs to a set of possible labels, and label2 belongs to another set of possible labels, different from the first. I was currently thinking of using BERT for multiclassing, seeing the labels as 0/1, creating a single vector.

So, if label1 belongs to a set of 5 labels, and label2 belongs to a set of 4 labels, I would create a single label of 9 values β†’ [0, 0, 0, 0, 1, 0, 0, 1, 0] as an example.

It’s correct? Can I do it in better ways?
Thank you.