Using SageMaker SDK to deploy a open source xgboost model locally

0

I have a locally trained model that I am trying to debug locally on docker container before deploying / creating endpoint on SageMaker. I am following the documentation that AWS customer service provided, however, I am running into issue with Creating Endpoint Config.

Here's the code snippet:

from sagemaker.xgboost import XGBoost, XGBoostModel
from sagemaker.session import Session

sm_client = boto3.client(
                         "sagemaker",
                         aws_access_key_id='xxxxxx',
                         aws_secret_access_key='xxxxxx'
                        )

sagemaker_session = Session(sagemaker_client = sm_client)

xgb_inference_model = XGBoostModel(
                                   model_data=model_url,
                                   role=role,
                                   entry_point="inference.py",
                                   framework_version="0.90-2",
                                   sagemaker_session = sagemaker_session     
)

print('Deploying endpoint in local mode')
predictor = xgb_inference_model.deploy(
                                       initial_instance_count = 1,
                                       instance_type = "local"
)


Traceback:

20 print('Deploying endpoint in local mode')
21 predictor = xgb_inference_model.deploy(
22                                        initial_instance_count = 1,

ClientError: An error occurred (ValidationException) when calling the CreateEndpointConfig operation: 1 validation error detected: Value 'local' at 'productionVariants.1.member.instanceType' failed to satisfy constraint: Member must satisfy enum value set: [ml.r5d.12xlarge, ml.r5.12xlarge, ml.p2.xlarge, ml.m5.4xlarge, ml.m4.16xlarge, ml.r5d.24xlarge,

Here's the documentation link: https://github.com/aws-samples/amazon-sagemaker-local-mode/blob/main/xgboost_script_mode_local_training_and_serving/xgboost_script_mode_local_training_and_serving.py

질문됨 2년 전577회 조회
1개 답변
4

Can you try using from sagemaker.local import LocalSession instead of sagemaker.session import Session as specified in the documentation?

https://sagemaker.readthedocs.io/en/stable/overview.html#local-mode

pk
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인