I want to port a trained model to somewhere else but I would like to do it using pth file rather than pkl. However, in order to perform predictions using pth there I have to specify a dataloader in order to create the leaner using learn = cnn_learner(dls, resnet34, metrics=[accuracy]).
Is there any way to generate a dummy dataloader to pass it to cnn_learner in order to perform learn.predict(img)?
Ok! I am struggling a little bit on this. I am unsure if I understood this properly.
If I call learn.export I will have a pkl file. You are telling me to change the extension from pkl to pth after saving the model?
Another question is that I’m trying to run the whole prediction in CPU. I am working with single images.
In this sense I tried all the tricks I found to send the model to make the predictions on CPU but I still have jobs when run nvidia-smi. My code so far looks like this (using pthfiles):
Thanks for the feedback!
Actually I was aware of this but at some point got lost because I was trying to deploy on myBinderand getting also CAM output working.
Anyway, it works nicely with the fastbook pipeline.
How can we retrain this learner model , actually I saved my learner on some other data and now I want to train it on similar dataset but with lesser classes ?
Can anyone guide me on how can I use the previously trained learner model on new dataset, to train on the new dataset,as the databunch is binded to learner.