I have a model based on EfficientNet-b3 that was trained in a container using fastai 1. I would like to re-use this model for inference in another container working with fastai 2.
I tried to load the .pkl file with load_learner in fastai 2, but it failed. I get a similar error as in this topic
I finally proceeded as follows:
- load the model in the fastai 1 container
- save the model parameters with
- copy the .pth file to the fastai 2 container
- load the model in the fastai 2 container with
model = EfficientNet.from_pretrained('efficientnet-b3', num_classes=n_classes) model.load_state_dict(torch.load('./model.pth')) model.eval()
- predict with
I checked the top 5 predictions and they are quite different from the ones I got in the fastai 1 container.
I wanted to ask if the original .pkl file contains some pre- or post-processing steps that I should reproduce when I use the .pth file?
Thanks for you answer!