SageMaker PyTorch Hosting 1.6 works only with artifacts named model.pth ?

0

Hi, does SageMaker PyTorch Hosting 1.6 works only with artifacts named model.pth ? I'm trying this sample with 1.6 and the deployment fails with error

FileNotFoundError: [Errno 2] No such file or directory: '/opt/ml/model/model.pth'

the documentation doesn't mention such a constraint

AWS
專家
已提問 3 年前檢視次數 741 次
1 個回答
1
已接受的答案

Yes - from the thread on this open issue: https://github.com/aws/sagemaker-pytorch-inference-toolkit/issues/86

In the issue thread they note that the new Pytorch 1.6 image requires that the model filename is model.pth, linking to the relevant code where this default is set: https://github.com/aws/sagemaker-pytorch-inference-toolkit/blob/9a6869e/src/sagemaker_pytorch_serving_container/torchserve.py#L121

Also noted in the thread is that users have successfully adapted their code to use torchserve in Pytorch 1.6 by changing it to save their model in a file named model.pth. Once renamed, they were still able to use custom inference scripts to load their model by defining a custom model_fn: https://github.com/data-science-on-aws/workshop/blob/374329adf15bf1810bfc4a9e73501ee5d3b4e0f5/09_deploy/wip/pytorch/code/inference.py

AWS
已回答 3 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南