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
Yeah, that was the issue. Actually, setting
sagemaker_session = None
worked. More on this issue here: https://github.com/aws/sagemaker-python-sdk/issues/929