

You can have your model return anything you want, but returning a dictionary like we did for
ResnetModelForImageClassification, with the loss included when labels are passed, will make your model directly
usable inside the [Trainer] class. Using another output format is fine as long as you are planning on using your own
training loop or another library for training.
Now that we have our model class, let's create one:
py
resnet50d = ResnetModelForImageClassification(resnet50d_config)
Again, you can use any of the methods of [PreTrainedModel], like [~PreTrainedModel.save_pretrained] or
[~PreTrainedModel.push_to_hub]. We will use the second in the next section, and see how to push the model weights
with the code of our model. But first, let's load some pretrained weights inside our model.
In your own use case, you will probably be training your custom model on your own data. To go fast for this tutorial,
we will use the pretrained version of the resnet50d. Since our model is just a wrapper around it, it's going to be
easy to transfer those weights: