【问题标题】:Building XGBoost on SageMaker在 SageMaker 上构建 XGBoost
【发布时间】:2020-10-27 19:56:07
【问题描述】:

我正在尝试在 AWS Sagemaker 上运行 XGBoost,并尝试为 XGBoost 调用容器。


containers = {'us-west-2': '433757028032.dkr.ecr.us-west-2.amazonaws.com/xgboost:latest',
              'us-east-1': '811284229777.dkr.ecr.us-east-1.amazonaws.com/xgboost:latest',
              'us-east-2': '825641698319.dkr.ecr.us-east-2.amazonaws.com/xgboost:latest',
              'eu-west-1': '685385470294.dkr.ecr.eu-west-1.amazonaws.com/xgboost:latest'}

hyperparameters = {
        "max_depth":"5",
        "eta":"0.2",
        "gamma":"4",
        "min_child_weight":"6",
        "subsample":"0.7",
        "objective":"binary:logistic",
        "num_round":50
        }

estimator = sagemaker.estimator.Estimator(image_name=containers['us-east-1'], 
                                          hyperparameters=hyperparameters,
                                          role=sagemaker.get_execution_role(),
                                          train_instance_count=1, 
                                          train_instance_type='ml.m5.2xlarge', 
                                          train_volume_size=5, # 5 GB 
                                          output_path=output_path,
                                          train_use_spot_instances=True,
                                          train_max_run=300,
                                          train_max_wait=600)


但是,运行以下命令会引发错误:

estimator.fit({'train': s3_input_train,'validation': s3_input_test})
ClientError: An error occurred (ValidationException) when calling the CreateTrainingJob operation: Invalid DNS suffix 'amazonaws.com' for region 'us-east-1' in training image. Please provide the valid <region>.<dns-suffix>: 'ap-south-1.amazonaws.com'

有人可以帮忙解决这个错误吗?谢谢。

【问题讨论】:

  • 你能用 boto3.session.Session().region_name 检查区域吗?
  • 笔记本实例在 ap-south-1 中创建,S3 存储桶在 us-east-1 中。从与 S3 存储桶相同的区域创建另一个笔记本实例解决了该问题。如何从不同区域访问 S3?
  • 由于 S3 是全局性的,它与您访问 S3 的位置没有区别。
  • 但是当我在同一区域创建另一个笔记本实例时,错误消失了(没有任何其他更改)。是否需要更改任何 S3 设置才能从其他地区访问它?
  • 不,因为问题不在于 S3 存储桶。存储桶没有区域。问题是您的容器在另一个区域。 Sagemaker 正在从 ECR 中提取图像。

标签: python amazon-web-services boto3 amazon-sagemaker


【解决方案1】:

笔记本实例在 ap-south-1 中创建,S3 存储桶在 us-east-1 中。从与 S3 存储桶相同的区域创建另一个笔记本实例解决了该问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-06-10
    • 1970-01-01
    • 1970-01-01
    • 2022-10-14
    • 1970-01-01
    • 1970-01-01
    • 2021-02-11
    相关资源
    最近更新 更多