ValueError when using PatchTSTForClassification

I’m attempting to adapt the PatchTST blog post (Patch Time Series Transformer in Hugging Face) to use PatchTSTForClassification. I’m getting the following error:

ValueError: The model did not return a loss from the inputs, only the following keys: prediction_logits. For reference, the inputs it received are past_values.

I know that it should be receiving past_values and target_values during training which doesn’t seem to be happening. In addition, I’m not sure how to get it to return loss? Any help is much appreciated.