My goal is to deploy a model I trained with Fastai into Torchserve. I was following this tutorial but got stuck on the part where he created the model class for pytorch.
He mentions that to run our model in Torchserve, and we need the following:
- A model class
- The weights exported from pytorch (a pth file)
- A handler
Out of these, I get two: the weights and the handler. However, where I'm stuck is in the model class. He created one class file, but I have no idea where he got the DynamicUnet to use as a base for the class or how he mixed that class with unet_learner to create a custom pytorch model class. Can you help me build a model class for a model trained under the learner vision_learner and the pre-trained model of resnet50?
Found the fix myself. Turns out you can just go into the ??create_vision_model and then the ??add_head and put them as the model class inside of the "initialize" function inside of the handler.py ; you should end up with something like this: