aws / aws/amazon-sagemaker-examples

[Bug Report] Model Failed to serve at sagemaker endpoint despite increasing gpu memory

Open
#2,982 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
11k
Forks
7k
Avg merge
8h 29m
Merged PRs (30d)
8

Description

**Link to the notebook**
https://github.com/huggingface/notebooks/blob/master/sagemaker/01_getting_started_pytorch/sagemaker-notebook.ipynb
With the following items changed:
model: bert
dataset: custom text dataset, training dataset size: 67000
batch size: 8
Ran on local machine

**Describe the bug**
The training job with instance ml.g4dn.2xlarge runs but an issue is reported at the Profiler Report.
```
█████▋| 131/136 [04:19<00:10, 2.01s/it]#015 97%|█████████▋| 132/136 [04:21<00:08, 2.01s/it]#015 98%|█████████▊| 133/136 [04:23<00:06, 2.01s/it]#015 99%|█████████▊| 134/136 [04:25<00:04, 2.01s/it]#015 99%|█████████▉| 135/136 [04:27<00:02, 2.01s/it]#015100%|██████████| 136/136 [04:27<00:00, 1.49s/it]#015100%|██████████| 136/136 [04:27<00:00, 1.97s/it]

2021-10-17 20:25:28 Completed - Training job completed
ProfilerReport-1634484213: IssuesFound
Training seconds: 17983
Billable seconds: 17983
```
When looked inside the Profiler Report, only GPUMemoryIncrease rule has been reported 175 times. To resolve this issue, I increased the memory of GPU from 2xlarge to 8xlarge. Finally, I tried p3.2xlarge. This time both GPUMemoryIncrease and LowGPUUtilization were reported.

The main problem here is that I am **not able to deploy** the model at Sagemaker Endpoint.

With available logging and the profiler report, I am only able to debug to this point. There is no clear problem stated. Kindly assist.

**To reproduce**
https://github.com/huggingface/notebooks/blob/master/sagemaker/01_getting_started_pytorch/sagemaker-notebook.ipynb
With the following items changed:
model: bert
dataset: custom text dataset, training dataset size: 67000
batch size: 8
Ran on local machine

**Logs**
Checking the logs of sagemake endpoint that failed:

> OSError: [Errno 30] Read-only file system
> Traceback (most recent call last):
> File "/usr/local/bin/dockerd-entrypoint.py", line 23, in
> serving.main()
> File "/opt/conda/lib/python3.6/site-packages/sagemaker_huggingface_inference_toolkit/serving.py", line 34, in main
> _start_mms()
> File "/opt/conda/lib/python3.6/site-packages/retrying.py", line 49, in wrapped_f
> return Retrying(*dargs, **dkw).call(f, *args, **kw)
> File "/opt/conda/lib/python3.6/site-packages/retrying.py", line 212, in call
> raise attempt.get()
> File "/opt/conda/lib/python3.6/site-packages/retrying.py", line 247, in get
> six.reraise(self.value[0], self.value[1], self.value[2])
> File "/opt/conda/lib/python3.6/site-packages/six.py", line 719, in reraise
> raise value
> File "/opt/conda/lib/python3.6/site-packages/retrying.py", line 200, in call
> attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
> File "/opt/conda/lib/python3.6/site-packages/sagemaker_huggingface_inference_toolkit/serving.py", line 30, in _start_mms
> mms_model_server.start_model_server(handler_service=HANDLER_SERVICE)
> File "/opt/conda/lib/python3.6/site-packages/sagemaker_huggingface_inference_toolkit/mms_model_server.py", line 79, in start_model_server
> _adapt_to_mms_format(handler_service, model_dir)
> File "/opt/conda/lib/python3.6/site-packages/sagemaker_huggingface_inference_toolkit/mms_model_server.py", line 129, in _adapt_to_mms_format
> subprocess.check_call(model_archiver_cmd)
> File "/opt/conda/lib/python3.6/subprocess.py", line 311, in check_call
> raise CalledProcessError(retcode, cmd)
> subprocess.CalledProcessError: Command '['model-archiver', '--model-name', 'model', '--handler', 'sagemaker_huggingface_inference_toolkit.handler_service', '--model-path', '/opt/ml/model', '--export-path', '/.sagemaker/mms/models', '--archive-format', 'no-archive', '--f']' returned non-zero exit status 1.

Contributor guide

Open the contributing guide

Research direction

Start with sagemaker/01_getting_started_pytorch/sagemaker-notebook.ipynb and reproduce the changed BERT training and deployment settings. Read the endpoint traceback alongside sagemaker_huggingface_inference_toolkit/serving.py and mms_model_server.py, focusing on the read-only filesystem error during model-archiver startup. Done means the trained model deploys successfully at a SageMaker endpoint.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, jupyter-notebook, python, pytorch
Domain
cloud, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.