简体   繁体   English

SageMaker TensorFlow Estimator源代码S3上传路径

[英]SageMaker TensorFlow Estimator source code S3 upload path

I'm using the SageMaker TensorFlow estimator for training, and specifying an output path for my model artifacts with the output_path argument, with a value of s3://<bucket>/<prefix>/ . 我正在使用SageMaker TensorFlow估计器进行训练,并使用output_path参数为我的模型工件指定一个输出路径,其值为s3://<bucket>/<prefix>/

After model training, a directory named <training_job_name>/output is created in the specified output_path . 模型训练后,在指定的output_path创建一个名为<training_job_name>/output的目录。

The issue I'm having is, the source code that's used for training is also uploaded to S3 by default, but instead of being placed in s3://<bucket>/<prefix>/<training_job_name>/source , it's placed in s3://<bucket>/<training_job_name>/source . 我遇到的问题是,用于训练的源代码也默认情况下也上载到S3,但不是放置在s3://<bucket>/<prefix>/<training_job_name>/source ,而是放置在s3://<bucket>/<training_job_name>/source

So how can I specify the S3 upload path for the training job's source code in order to make it use the bucket AND prefix name of output_path ? 因此,如何为训练作业的源代码指定S3上传路径,以使其使用output_path的存储桶AND前缀名称?

Have you tried using the “code_location” argument: https://sagemaker.readthedocs.io/en/stable/estimators.html to specify the location for the source code? 您是否尝试过使用“ code_location”参数: https ://sagemaker.readthedocs.io/en/stable/estimators.html指定源代码的位置?

Below is a snippet code example that use code_location 以下是使用code_location的代码段示例

from sagemaker.tensorflow import TensorFlow

code-path = "s3://<bucket>/<prefix>"
output-path = "s3://<bucket>/<prefix>"

abalone_estimator = TensorFlow(entry_point='abalone.py',
                           role=role,
                           framework_version='1.12.0',
                           training_steps= 100, 
                           image_name=image,
                           evaluation_steps= 100,
                           hyperparameters={'learning_rate': 0.001},
                           train_instance_count=1,
                           train_instance_type='ml.c4.xlarge',
                           code_location= code-path,
                           output_path = output-path,
                           base_job_name='my-job-name'
                           )

I believe the code_location parameter shown by @user3458797 is the correct answer. 我相信@ user3458797显示的code_location参数是正确的答案。

The output_path only configures the S3 location for saving the training result (model artifacts and output files). output_path仅配置S3位置以保存训练结果(模型工件和输出文件)。

https://sagemaker.readthedocs.io/en/stable/estimators.html https://sagemaker.readthedocs.io/en/stable/estimators.html

Your training script won't be saved in the "output_path" unless you move the file into /opt/ml/model during the training or you use the code_location parameter. 除非您在培训期间将文件移至/ opt / ml / model或使用code_location参数,否则您的培训脚本不会保存在“ output_path”中。

Please let me know if there is anything I can clarify. 请让我知道是否有任何需要澄清的内容。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 AWS Sagemaker 中使用 Tensorflow Estimator 时如何在 S3 中保存 Tensorflow 模型(作为 /output/model.tar.gz) - How to save Tensorflow model in S3 (as /output/model.tar.gz) when using Tensorflow Estimator in AWS Sagemaker 从 s3 工件创建时,SageMaker 自定义 model output 路径 tensorflow - SageMaker custom model output path for tensorflow when creating from s3 artifacts 如何为Sagemaker编写Tensorflow KMeans Estimator脚本 - How to write Tensorflow KMeans Estimator script for Sagemaker 如何使用 TensorFlow Estimator 在 Amazon SageMaker 中获得可重现的结果? - How to get reproducible result in Amazon SageMaker with TensorFlow Estimator? 如何使用 TensorFlow 估计器和 Python Sagemaker SDK 指定最大运行时间? - How to specify max runtime using TensorFlow estimator with Python Sagemaker SDK? Tensorflow 的 Estimator 停止训练 - Tensorflow's Estimator stops training 将 tensorflow model 从本地机器转移到 AWS SageMaker 时读取 S3 存储桶时出现问题 - Having issues reading S3 bucket when transitioning a tensorflow model from local machine to AWS SageMaker 如何将 tensorflow 检查点保存到 Sagemaker 上的 S3? 它抛出 OSError: 无法创建文件 - How to save a tensorflow checkpoint to S3 on Sagemaker? It throws OSError: Unable to create file TensorFlow 估计器的下载输入路径不正确 - TensorFlow estimator is getting incorrect download input path Sagemaker 如何将调整步骤的最佳超参数传递给另一个估计器? - Sagemaker how to pass tuning step's best hyperparameter into another estimator?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM