aws / aws/amazon-sagemaker-examples

An error occurred (ModelError) when calling the InvokeEndpoint operation: Received server error (500) from model with message "[Errno 2] No such file or directory: '/.sagemaker/mms/models/model/model.pth'".

Open
#1,238 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
11k
Forks
7k
Avg merge
8h 29m
Merged PRs (30d)
8

Description

Can someone help?

I have created a deep learning model using sagemaker using PyTorch framework. I have uploaded the model artifacts into S3 and deployed the model using the following commands.

**from sagemaker.pytorch import PyTorchModel
from sagemaker import get_execution_role
role = get_execution_role()
import boto3
import numpy as np
pytorch_model = PyTorchModel(model_data='s3://pytorchexample/model.tar.gz', role=role, entry_point='inference.py', framework_version='1.4')
predictor = pytorch_model.deploy(instance_type='ml.t2.medium', initial_instance_count=1)**

the endpoints gets created but while testing the model I get the following error:

**An error occurred (ModelError) when calling the InvokeEndpoint operation: Received server error (500) from model with message "[Errno 2] No such file or directory: '/.sagemaker/mms/models/model/model.pth'". See https://us-east-1.console.aws.amazon.com/cloudwatch/home**

I am not sure why PyTorch is looking for sagemaker folder for the model.pth file. It resides in the S3 bucket.

Contributor guide

Open the contributing guide

Research direction

Start with inference.py and the model.tar.gz artifact used by PyTorchModel, then review the SageMaker deployment logs in CloudWatch for how model.pth is located. Confirm the artifact layout and inference entry point match the deployed endpoint, and verify that invoking the endpoint completes without the missing-file error.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python, pytorch
Domain
cloud, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.