【以下的问题经过翻译处理】 我试图通过扩展预构建镜像来部署SageMaker推理端点。然而,它失败了,错误为“FileNotFoundError:[Errno 2] No such file or directory: 'serve'”。
我的Dockerfile:
ARG REGION=us-west-2
SageMaker PyTorch image
FROM 763104351884.dkr.ecr.$REGION.amazonaws.com/pytorch-inference:1.12.1-gpu-py38-cu116-ubuntu20.04-ec2
RUN apt-get update
ENV PATH="/opt/ml/code:${PATH}"
#此环境变量用于SageMaker PyTorch容器确定我们的用户代码目录。
ENV SAGEMAKER_SUBMIT_DIRECTORY /opt/ml/code
#/ opt / ml及其所有子目录由SageMaker使用,使用/code子目录存储用户代码。
COPY inference.py /opt/ml/code/inference.py
#将inference.py定义为脚本入口点
ENV SAGEMAKER_PROGRAM inference.py
/aws/sagemaker/Endpoints/mytestEndpoint的CloudWatch日志:
2022-09-30T04:47:09.178-07:00
Traceback (most recent call last):
File "/usr/local/bin/dockerd-entrypoint.py", line 20, in <module>
subprocess.check_call(shlex.split(' '.join(sys.argv[1:])))
File "/opt/conda/lib/python3.8/subprocess.py", line 359, in check_call
retcode = call(popenargs, kwargs)
File "/opt/conda/lib/python3.8/subprocess.py", line 340, in call
*with Popen(*popenargs, kwargs) as p:
File "/opt/conda/lib/python3.8/subprocess.py", line 858, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "/opt/conda/lib/python3.8/subprocess.py", line 1704, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
Traceback (most recent call last): File "/usr/local/bin/dockerd-entrypoint.py", line 20, in <module> subprocess.check_call(shlex