I need to deploy a fast.ai model I trained in our environment which is Python 3.5 and I can’t upgrade the Python without affecting 10 other people’s previous work. So my options now are:
modify fast.ai to work in Python 3.5 (not sure how much work it is)
save fast.ai model as a pytorch model (*.pth):
Tried, but learner.models.model are Sequential, which do not have a save method for torch.save.
save fast.ai model (*.h5) and load it in pytorch:
Seems that I need to reconstruct the model before loading it.
other methods.
Any suggests may help greatly.
Thanks for reading!
Just a follow-up, I tried #1 and it turns out the amount of work is small, just change every f’’ format string into older form seems to work. Hope I didn’t miss any other Python 3.6 only features.
Oh I forgot to mention things like image normalization could be different for different models, so will need to take care of. And also data.classes has to be stored and read. After all these, one gets more appreciate the convenience of fast.ai, which gets these details right for you behind the scene.