-
Notifications
You must be signed in to change notification settings - Fork 1.2k
PyTorch 1.6.0 Inference packaging skips dependencies, other model artefacts #1909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @setu4993, Could you provide the python sdk code and |
A short example to reproduce the issue (X and Y are other directories on the file system): sagemaker_model = PyTorchModel(
model_data="model.tar.gz",
source_dir="/root/",
entry_point="inference.py",
dependencies=[
"X",
"Y",
],
framework_version="1.6.0",
py_version="py3",
) After the re-packaging step occurs and a ├── code
│ ├── README.md
│ ├── inference.py
│ ├── lib
│ │ ├── X
│ │ │ ├── __init__.py
│ │ ├── ...
│ │ └── Y
│ │ ├── README.md
│ │ ├── __init__.py
│ │ ├── ...
│ └── requirements.txt
├── model.pth
└── another_model.pkl But, at runtime, the only files and directories in the |
The problem here is multi-fold:
|
@ChuyangDeng : Any update on this? |
@setu4993, I have experienced similar issues with that. From the source code, I believe the following line might be the one that's causing what you are experiencing (and me as well): This makes Furthermore, Sagemaker Python SDK example with PyTorch (with the code here) does not work with this serving container (because the model has a companion object). |
Thanks @jonsnowseven. +1, I think I found the same line earlier :). In my case, it all works with 1.5.0, so I'm sticking to it and updating to 1.6 with requirements.txt. |
After almost 4 months from the last comment, this bug still persists.... |
Yes @ldong87. Any news regarding this? |
Same issue here. Have been trying to work around this for 2 days now with no luck. |
Wanted to share that @amaharek found a potential solution and posted it on the supplementary issue on the |
@dectl One (ugly) workaround is to copy/load the missing model files from |
This issue was fixed in TS0.3.1 and toolkitv2.0.5.. These fixes are available in latest SM DLC. |
Thank you, @lxning! Can confirm that it works and the packages now contain all artifacts as expected. |
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 notmodel.pth
, and it won't show up in the container. Similarly, any of the extradepenencies
specified during the initialization of aPyTorchModel
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 inmodel_dir
. I had an extra.pkl
object in there which was not included.Similarly, the directories log is missing the extra dependencies specified while creating the
PyTorchModel
object undermodel_dir/lib
(#1832 another bug) ormodel_dir
(as specified in API documentation) both.System information
A description of your system. Please provide:
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.
The text was updated successfully, but these errors were encountered: