As per this - How to use a pretrained model from s3 to predict some data? , I was trying to use an existing model to create an endpoint, but I was facing the following error -
Traceback (most recent call last):
File "/miniconda3/lib/python3.7/site-packages/gunicorn/workers/base_async.py", line 55, in handle
self.handle_request(listener_name, req, client, addr)
File "/miniconda3/lib/python3.7/site-packages/gunicorn/workers/ggevent.py", line 143, in handle_request
super().handle_request(listener_name, req, sock, addr)
File "/miniconda3/lib/python3.7/site-packages/gunicorn/workers/base_async.py", line 106, in handle_request
respiter = self.wsgi(environ, resp.start_response)
File "/miniconda3/lib/python3.7/site-packages/sagemaker_sklearn_container/serving.py", line 124, in main
serving_env.module_dir)
File "/miniconda3/lib/python3.7/site-packages/sagemaker_sklearn_container/serving.py", line 101, in import_module
user_module = importlib.import_module(module_name)
File "/miniconda3/lib/python3.7/importlib/__init__.py", line 118, in import_module
if name.startswith('.'):
As per Problem deploying the best estimator gotten with sagemaker.estimator.Estimator (w/ sklearn custom image), https://forums.aws.amazon.com/thread.jspa?threadID=313838 , I am using the correct env variables (along with SAGEMAKER_DEFAULT_INVOCATIONS_ACCEPT, SAGEMAKER_PROGRAM, and SAGEMAKER_SUBMIT_DIRECTORY), but somehow the health checks are failing while creation of the endpoint.
I tried the similar thing via AWS console and it is working surprisingly. Is there a work around for this to do it via code?
My code snippet:
trainedmodel = sagemaker.model.Model(
model_data='s3://my-bucket/my-key/output/model.tar.gz',
image='my-image',
env={"SAGEMAKER_DEFAULT_INVOCATIONS_ACCEPT": "text/csv",
"SAGEMAKER_USE_NGINX": "True",
"SAGEMAKER_WORKER_CLASS_TYPE": "gevent",
"SAGEMAKER_KEEP_ALIVE_SEC": "60",
"SAGEMAKER_CONTAINER_LOG_LEVEL": "20",
"SAGEMAKER_ENABLE_CLOUDWATCH_METRICS": "false",
"SAGEMAKER_PROGRAM": "my-script.py",
"SAGEMAKER_REGION": "us-east-1",
"SAGEMAKER_SUBMIT_DIRECTORY": "s3://my-bucket/my-key/source/sourcedir.tar.gz"
},
role=role)
trainedmodel.deploy(initial_instance_count=1, instance_type='ml.c4.xlarge', endpoint_name = 'my-endpoint')