好的,我已經在 Sagemaker 中處理這個問題將近一個星期了,我已經準備好解決問題了。在 BYO 算法 Docker 部署類型場景中,我有一個自定義訓練腳本與一個數據處理腳本配對。這是一個用 Python 3.x 構建的 Pytorch 模型,BYO Docker 文件最初是為 Python 2 構建的,但我看不出我遇到的問題有什么問題......這是在成功培訓之后運行 Sagemaker 不會將模型保存到目標 S3 存儲桶。我進行了廣泛的搜索,似乎無法在任何地方找到適用的答案。這一切都在 Notebook 實例中完成。注意:我將其用作承包商,并且沒有對 AWS 其余部分的完全權限,包括下載 Docker 映像。文件:FROM ubuntu:18.04MAINTAINER Amazon AI <[email protected]>RUN apt-get -y update && apt-get install -y --no-install-recommends \ wget \ python-pip \ python3-pip3 nginx \ ca-certificates \ && rm -rf /var/lib/apt/lists/*RUN wget https://bootstrap.pypa.io/get-pip.py && python3 get-pip.py && \ pip3 install future numpy torch scipy scikit-learn pandas flask gevent gunicorn && \ rm -rf /root/.cacheENV PYTHONUNBUFFERED=TRUEENV PYTHONDONTWRITEBYTECODE=TRUEENV PATH="/opt/program:${PATH}"COPY decision_trees /opt/programWORKDIR /opt/programDocker 鏡像構建:%%shalgorithm_name="name-this-algo"cd containerchmod +x decision_trees/trainchmod +x decision_trees/serveaccount=$(aws sts get-caller-identity --query Account --output text)region=$(aws configure get region)region=${region:-us-east-2}fullname="${account}.dkr.ecr.${region}.amazonaws.com/${algorithm_name}:latest"aws ecr describe-repositories --repository-names "${algorithm_name}" > /dev/null 2>&1if [ $? -ne 0 ]then aws ecr create-repository --repository-name "${algorithm_name}" > /dev/nullfi# Get the login command from ECR and execute it directly$(aws ecr get-login --region ${region} --no-include-email)# Build the docker image locally with the image name and then push it to ECR# with the full name.docker build -t ${algorithm_name} .docker tag ${algorithm_name} ${fullname}docker push ${fullname}
添加回答
舉報
0/150
提交
取消