【问题标题】:Getting sagemaker container locally在本地获取 sagemaker 容器
【发布时间】:2020-11-06 16:03:29
【问题描述】:

当我尝试在脚本模式下为 tensorflow 在本地运行 sagemaker 时。似乎我无法拉动 docker 容器。我已经从 sagemaker 笔记本实例运行了下面的代码,一切运行良好。但是在我的机器上运行它就不行了。

如何下​​载容器,以便在本地调试?

import os

import sagemaker
from sagemaker.tensorflow import TensorFlow


hyperparameters = {}
role = 'arn:aws:iam::xxxxxxxx:role/yyyyyyy'
estimator = TensorFlow(
    entry_point='train.py',
    source_dir='.',
    train_instance_type='local',
    train_instance_count=1,
    hyperparameters=hyperparameters,
    role=role,
    py_version='py3',
    framework_version='1.12.0',
    script_mode=True)

estimator.fit()

我得到这个输出

INFO:sagemaker:Creating training-job with name: sagemaker-tensorflow-
scriptmode-2019-01-28-18-51-57-787
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error response from daemon: pull access denied for 520713654638.dkr.ecr.eu-west-2.amazonaws.com/sagemaker-tensorflow-scriptmode, repository does not exist or may require 'docker login'

subprocess.CalledProcessError: Command 'docker pull 520713654638.dkr.ecr.eu-west-2.amazonaws.com/sagemaker-tensorflow-scriptmode:1.12.0-cpu-py3' returned non-zero exit status 1.

警告看起来像您在使用 docker login stuff here 时得到的输出。如果我按照这些步骤注册到带有 tensorflow 容器的目录,它会显示登录成功

Invoke-Expression -Command (aws ecr get-login --no-include-email --registry-ids 520713654638 --region eu-west-2)
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Login Succeeded

然后我还是拉不出来

docker pull 520713654638.dkr.ecr.eu-west-2.amazonaws.com/sagemaker-tensorflow-scriptmode:1.11.0-cpu-py3
Error response from daemon: pull access denied for 520713654638.dkr.ecr.eu-west-2.amazonaws.com/sagemaker-tensorflow-scriptmode, repository does not exist or may require 'docker login'

【问题讨论】:

    标签: amazon-web-services docker amazon-sagemaker


    【解决方案1】:

    相同的顺序在本地对我有效:'aws ecr get-login'、'docker login'、'docker pull'。

    您的本地 IAM 用户是否有足够的凭证从 ECR 中提取? 'AmazonEC2ContainerRegistryReadOnly' 策略应该足够了:https://docs.aws.amazon.com/AmazonECR/latest/userguide/ecr_managed_policies.html

    或者,您可以从 Github 获取容器并构建它:https://github.com/aws/sagemaker-tensorflow-container

    【讨论】:

    • 尝试从它们提供给您的图像本地构建图像是行不通的。我认为它们只是python2,但我相信脚本模式是python 3(以及不想使用python 2)。当我尝试使用不同的权限时会报告。
    • 您可以在脚本模式分支中找到 Python 3 Dockerfiles :) github.com/aws/sagemaker-tensorflow-container/tree/script-mode/…
    • 是的,这是我的权限
    猜你喜欢
    • 1970-01-01
    • 2022-01-12
    • 1970-01-01
    • 2020-12-25
    • 2023-03-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多