Hi everyone,
I’m trying to download a timm model to a user-specified location on my local machine using the following code: model = timm.create_model(model_name, pretrained=True)
The code above downloads the model to the default location: C:\Users\17swa\.cache\torch\hub\checkpoints, which I don’t want. I want the model to be stored in my user specified location.
However, I couldn’t find a way to specify the download location. Is it possible to do this? If yes, could someone please guide me on how to achieve it?
{Currently I’m at lecture 03 of the fast.ai course }
I have just tried the following and it seems to work:
save_path = /path/to/your/directory
model = timm.create_model(model_name, pretrained=True)
# Save the model's state dictionary (weights) to the specified location
torch.save(model.state_dict(), save_path)