Thanks, this worked for me. Can you tell me how to load the model from a checkpoint after training? In your example, the model trained is an object of the ViTForImageClassification class, so from_pretrained() cannot be used.