Description
Describe the bug
Model artefacts packagedin model.tar.gz
are skipped when the model object is converted into a TorchServe model. Similarly, dependencies included are also dropped.
To reproduce
Add any extra file to model.tar.gz
that is not model.pth
, and it won't show up in the container. Similarly, any of the extra depenencies
specified during the initialization of a PyTorchModel
object are dropped.
Expected behavior
Model package would include all of the extra files and dependencies, as described in the API documentation.
Screenshots or logs
Tried os.walk
in the model_dir and realized artefacts I was expecting were missing. The below log shows the files in model_dir
. I had an extra .pkl
object in there which was not included.
2020-09-18 23:50:40,059 [WARN ] W-9000-model_1-stderr org.pytorch.serve.wlm.WorkerLifeCycle - 2020-09-18 23:50:40.058 | INFO | inference:model_fn:59 - ['inference.py', 'handler_service.py', 'model.pth']
Similarly, the directories log is missing the extra dependencies specified while creating the PyTorchModel
object under model_dir/lib
(#1832 another bug) or model_dir
(as specified in API documentation) both.
2020-09-18 23:50:40,058 [WARN ] W-9000-model_1-stderr org.pytorch.serve.wlm.WorkerLifeCycle - 2020-09-18 23:50:40.058 | INFO | inference:model_fn:58 - ['pycache', 'MAR-INF']
System information
A description of your system. Please provide:
- SageMaker Python SDK version: 2.9.1
- Framework name (eg. PyTorch) or algorithm (eg. KMeans): PyTorch
- Framework version: 1.6.0
- Python version: 3.6
- CPU or GPU: GPU
- Custom Docker image (Y/N): N
Additional context
The problem arises from this line in the process of TorchServe packaging, that is a result of aws/sagemaker-pytorch-inference-toolkit#79. It drops every other object as a part of the repackaging except the inference script.
Clearly, that is a regression and unexpected.