Closed kylepula-aws closed 3 years ago
It turns out that there's no issue. I had assumed that the above default_handler
was used if not inference.py
script was provided. It turns out that python_service.py
is only used when inference.py
is provided (or you're running in mulit-model mode). So, in my case, that handler was never being used.
Describe the bug
Default handler behaves differently in inference.py and python_service.py
To reproduce
I have a model and endpoint that works correctly using the default handler provided in python_service.py.
When I copy the default handler into an inference.py file and change it's name to handler, the endpoint behaves differently.
In particular, the response Body becomes
When the inference.py script is not provided in the model artifacts, the default handler runs and returns the model's expected output.
Expected behavior I expected the default handler to perform the same even if it was provided in the inference.py script.
System information A description of your system. Please provide:
Additional context
This is the contents of my inference.py file. My intention was to reproduce the default behavior from the default handler in python_service.py. This is the version copied from inside the actual container, though I believe it matches what's currently in the repo as well.
The default handler as implemented in python_service.py is: