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

gefragt vor 2 Jahren577 Aufrufe
1 Antwort
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
beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen