When I use the pickle file of fastai and do prediction using learn.predict() method. And I use the same pickle file and convert that pickle file using this method to PyTorch. Below is the code snippet.
learn = load_learner(src_path,model_name)
var=learn.model
import pickle
new_str=f"/pytorch-weight/{model_name}"
file = open(new_str, 'wb')
pickle.dump(var, file)
# close the file
file.close()
And do the prediction using that generated pickle file in PyTorch but I get the different result as compared to fastai. What is the reason behind this I want to know? Am I doing the right way to convert that pickle file for PyTorch inference?
Fastai automatically applies the validation transforms. make sure you are using exactly the same transforms in your plain pytorch implementation. (I guess at least resize and normalization)