Model Path not found in Sagemaker Inference

17 views Asked by At

I'm trying to perform pose-associated activities as part of inferencing. I'm using Fastapi to perform inferencing on Sagemaker by following https://sii.ua/blog/en/deploying-custom-models-on-aws-sagemaker-using-fastapi/

I have a bunch of pre-models in here which i have stored as a tar file on S3. Cmd used to tar the files:

cd opt/ml/
tar -czvf pre-models.tar.gz pre-models

enter image description here

In my code, i have set model path as 'ml/pre_models/(sub-dir varies as per requirement)' However, Sagemaker cannot find the model path. I get this line in cloudwatch:

"Fix path to models/ ml/pre_models/models"

I tried ls, and i can't see pre-models files in there.

1

There are 1 answers

0
R.K On

For future self who lands here...

I had my code in /opt/ml/ and models in pre_models/

Sagemaker Inference creates a directory model/ to store the S3 models. So the final path appeared as :

/opt/ml/model/pre_models

To trace this path just keep on printing the directory structure from your code (in my case "invocations" API method

print(os.system("ls"))
print(os.system("ls /opt/ml"))