Best way to load a pretrained model and start fine tuning it?

Right now, when I need to load a pre-trained image model, I just do it this way-

learn = cnn_learner(

What this triggers is, the ImageNet pre-trained model is downloaded and that’s how the learner is created.

But it requires internet access. Without internet access, this doesn’t work.

What I do is, I notice the path into which the .pth file is attempted to be downloaded. I manually download the .pth file from another computer and then put it to the directory the learner would look for in. It is usually- /root/.cache/torch/hub/checkpoints/.

If I do this, it works without the internet. But it is manual and quite messy. Isn’t there a better way to do it?

I want to work like an architecture, not a learner in itself. If I use the .load_learner() method, then it is the learner in itself. I don’t want that.

Please suggest what I should do.

Many pretrained weights are already available as Kaggle datasets, you can click on ‘upload data’ and search by the name of the architecture.

If you are trying to use a custom model below are what I feel some good examples.

This is not about Kaggle. Well, at least not entirely. I also have writing code for edge devices in my mind.

oops! I was some mistaken. But those links still have info on creating custom models.