make basehandler and visionhandler available as runtime imports for custom handlers?
Is there a recommended way to import basehandler and visionhandler for our own custom handlers? Or should we just include them all as --extra-files param and import, though that also seems redundant?
Basically, I wrote a new custom handler but doesn't make sense to rewrite the .pth loader etc for the same reasons you have these base classes for the default handlers. The resnet152 example has basically cut and pasted in the same file loader code into it but again, the more we can re-use the better imo.
Right now I'm just cutting and pasting those base classes into my custom image_handler.py but that means I don't get any future updates automatically etc. Alternatively could add as --extra-files I think but that also seems clunky as the extra-files param starts to get long. And not sure if a hard coded reference back from model-serve directory is a safe assumption.
Anyway, would be great if we can import those base classes directly at runtime and re-use. Thanks!
Extending the default handler is possible -
Look at the last line.
$ python
Python 3.7.7 (default, May 6 2020, 04:59:01)
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ts.torch_handler.base_handler
>>>
Hi @dhaniram-kshirsagar - thanks for the update. That works great, just tested it on our server. I didn't know about the namespace breakout you show, so that was the key. That's a big improvement vs including the same code redundantly so much appreciated!