Next, let's create the config and models as we did before:

resnet50d_config = ResnetConfig(block_type="bottleneck", stem_width=32, stem_type="deep", avg_down=True)
resnet50d = ResnetModelForImageClassification(resnet50d_config)
pretrained_model = timm.create_model("resnet50d", pretrained=True)
resnet50d.model.load_state_dict(pretrained_model.state_dict())

Now to send the model to the Hub, make sure you are logged in. Either run in your terminal:

huggingface-cli login
or from a notebook: