AWS Endpoint Failure

0

Hello, I've been trying to make an endpoint to my model that was traind, it's cnn/gru tensorflow model, while creating endpoint using the following code, first is for conversion to .tar.gz, and after that the endpoint deployment:

import subprocess

model_filename = 'ecg_classifier'

# Create .tar.gz archive
subprocess.run(['tar', '-czvf', 'ecg_classifier.tar.gz', model_filename])
import boto3

local_file_path = 'ecg_classifier.tar.gz'
s3_bucket_name = 'psutgrad'

# Upload to S3
s3_client = boto3.client('s3')
s3_client.upload_file(local_file_path, s3_bucket_name, local_file_path)
import boto3
import sagemaker
from sagemaker import image_uris
region = boto3.Session().region_name
client = boto3.client("sagemaker", region_name=region)

#Role to give SageMaker permission to access AWS services.
sagemaker_role = sagemaker.get_execution_role()

#Get model from S3
model_url = "s3://psutgrad/ecg_classifier.tar.gz"

#Get container image (prebuilt example)
from sagemaker import image_uris
container=image_uris.retrieve(framework='tensorflow',region='us-east-1',version='2.13',image_scope='inference',instance_type='ml.c5.4xlarge')


#Create model
model_name = "ecgclassifier"

response = client.create_model(
    ModelName = model_name,
    ExecutionRoleArn = sagemaker_role,
    Containers = [{
        "Image": container,
        "Mode": "SingleModel",
        "ModelDataUrl": model_url,
    }]
)
response = client.create_endpoint_config(
   EndpointConfigName="ecgclassifier",
   #KmsKeyId="arn:aws:kms:us-east-1:123456789012:key/143ef68f-76fd-45e3-abba-ed28fc8d3d5e",#issue maker
   ProductionVariants=[
        {
            "ModelName": "ecgclassifier",
            "VariantName": "AllTraffic",
            "ServerlessConfig": {
                "MemorySizeInMB": 2048,
                "MaxConcurrency": 20,
                "ProvisionedConcurrency": 10,
            }
        } 
    ]
)
response = client.create_endpoint(
    EndpointName="ecgclassifier",
    EndpointConfigName="ecgclassifier"
)

The endpoint created fails with the following message:

Received server error (0) from model with message "An error occurred while handling request as the model process exited.". See https://us-east-1.console.aws.amazon.com/cloudwatch/home?region=us-east-1#logEventViewer:group=/aws/sagemaker/Endpoints/ecgclassifier in account 679259229293 for more information.

When going to cloudwatch the following message is attached to the log related to endpoint created: ValueError: no SavedModel bundles found!

asked 5 months ago237 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions