serve
serve copied to clipboard
feat(model-archiver): Enabled the built-in base handler
Description
This handler is helpful for structural data and raw number arrays. When serving the model, the base handler should be used with an appropriate service envelope ("body", "json" etc).
Fixes https://github.com/pytorch/serve/issues/987
Type of change
Please delete options that are not relevant.
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [x] New feature (non-breaking change which adds functionality)
- [ ] This change requires a documentation update
Feature/Issue validation/testing
Please describe the Unit or Integration tests that you ran to verify your changes and relevant result summary. Provide instructions so it can be reproduced. Please also list any relevant details for your test configuration.
Checklist:
- [x] Did you have fun?
- [ ] Have you added tests that prove your fix is effective or that this feature works?
- [x] Has code been commented, particularly in hard-to-understand areas?
- [x] Have you made corresponding changes to the documentation?
base handler can be either inherited by customized handler, or directly input as handler in model archiver.
base handler can be ... directly input as handler in model archiver.
I'm not sure that's the case:
The handler can either be a built-in handler (not copied to the model archive) or must be a python file (copied to the model archive). The behavior is decided based on the presence of the handler name in that dictionary.
It's only possible to use the base handler as a built-in handler. (Using the base_handler.py file does not work since that file uses relative imports that break when the file if copied to the model archive).
So, to make it possible to use the base_handler in model archive creator is to add it to the it to the model_handlers dict.
Hi @Ark-kun I apologize for my pontification, in hindsight this was a correct idea and I did end up implementing it when I needed to add ONNX support here https://github.com/pytorch/serve/blob/master/model-archiver/model_archiver/model_packaging_utils.py#L22 - closing for now but please let me know if you have any other feedback, will merge it much more quickly this time