No, your current transformation would one-hot encode the targets, which is not expected.
The issue is that your current model outputs logits for a time sequence while the target doesn’t contain labels for each time step.
Could you describe what the output shape of the model represents?