aws / sagemaker-inference-toolkit

Serve machine learning models within a 🐳 Docker container using 🧠 Amazon SageMaker.
Apache License 2.0
372 stars 82 forks source link

Allow model_fn to get more arguments #65

Open ehsanmok opened 3 years ago

ehsanmok commented 3 years ago

Right now, model_fn only accepts model_dir which is very limiting in case a model needs some arguments to be instantiated first then can load the checkpoint.

ehsanmok commented 3 years ago

Any update on this issue?

This is limiting as when a user wants to pass different hyperparameters, they must be hardcoded inside the model_fn.

zachchurchill commented 3 years ago

I agree that the single model_dir argument is pretty restricting. One way I've gotten around hardcoding specific values is by using environment variables to pass in parameters that can be used in the model_fn at runtime, e.g. which model file to use during a Batch Transform job if I happen to load several models in with my model artifact.