Closed dlesomewhere closed 2 years ago
Hello @dlesomewhere,
thank you for opening the PR. But that's something we cannot add since it would break first of all the backward compatibility with any existing custom inference script. Additionally, it wouldn't be longer compliant with the SageMaker Inference contract. The SageMaker Inference contract is equal across all Inference Toolkits on SageMaker (MXNET, PyTorch, TensorFlow...). You can take a look at the documentation
Hi @philschmid - thanks for the link to the SageMaker inference contract. I agree with your reasoning! Will close this PR.
Issue #40
Description of changes:
This commit changes the way the custom model_fn is bound to the instance of the HuggingFaceHandlerService so the custom model_fn has access to the context available to the handler.
This will allow us to use that context, for example
self.device
to ensure we properly set the device when creating a custom pipeline.This PR also includes the fix to a failing test from https://github.com/aws/sagemaker-huggingface-inference-toolkit/pull/38.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.