Redshift ML with multi-container Sagemaker model

0

Is it possible to use Redshift ML with a Sagemaker multi-container model?

The closest I can find is the documentation that mentions the syntax for BYOM remote inference (https://docs.aws.amazon.com/redshift/latest/dg/r_create_model_use_cases.html):

CREATE MODEL model_name 
    FUNCTION function_name ( data_type [, ...] ) 
    RETURNS data_type
    SAGEMAKER 'endpoint_name'[:'model_name']
    IAM_ROLE { default };

Which specifies a model_name parameter. However, I'm dealing with a single Sagemaker model with multiple containers, running in Direct mode.

For reference, referencing a specific container is possible using boto3 (I'm dapting the example from here: https://docs.aws.amazon.com/sagemaker/latest/dg/neo-requests-boto3.html):

import boto3

import json
 
endpoint = 'insert name of your endpoint here'
 
runtime = boto3.Session().client('sagemaker-runtime')
 
# Read image into memory
with open(image, 'rb') as f:
    payload = f.read()
# Send image via InvokeEndpoint API
response = runtime.invoke_endpoint(
    EndpointName=endpoint,
    ContentType='application/x-image',
    Body=payload,
    TargetContainerHostname='my-container' # Here I would specify each individual container.
)

# Unpack response
result = json.loads(response['Body'].read().decode())
  • I have a question regarding first part of your question, multimodel endpoints. When I try to create a model in redshift as below:

    CREATE MODEL public.test_model FUNCTION f_test_model(float,float,float,float,float,float,float) RETURNS decimal(10,6) SAGEMAKER 'multimodel-endpoint-test-model':'test_model_1.tar.gz' IAM_ROLE 'arn:aws:iam::xxxxxxxxxxxxx:role/RedshiftML';

    I get an error: ERROR: syntax error at or near ":" Position: 244 [ErrorId: 1-62f9c1ea-630b6de304a036c97fee2e4c]

    Isn't this the correct syntax? If not, do you know the correct syntax as I cannot find anything in the documentation or in the examples

Tomas
asked 2 years ago272 views
1 Answer
0

Hello, sorry for the last response. I looked into the documentation and found that it doesn't clearly provide information for support of Sagemaker multi-container model. In order to gather more details around this, I have reached out to Redshift ML team to provide clarity on its support and update the documentation accordingly. However, if there is any specific issue while performing your tests, I would request you to open a AWS Support ticket with the Premium Support and they should be able to take a deeper look at your scenario.

AWS
SUPPORT ENGINEER
answered 2 years ago

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