繁体   English   中英

SageMaker TensorFlow Estimator源代码S3上传路径

[英]SageMaker TensorFlow Estimator source code S3 upload path

我正在使用SageMaker TensorFlow估计器进行训练,并使用output_path参数为我的模型工件指定一个输出路径,其值为s3://<bucket>/<prefix>/

模型训练后,在指定的output_path创建一个名为<training_job_name>/output的目录。

我遇到的问题是,用于训练的源代码也默认情况下也上载到S3,但不是放置在s3://<bucket>/<prefix>/<training_job_name>/source ,而是放置在s3://<bucket>/<training_job_name>/source

因此,如何为训练作业的源代码指定S3上传路径,以使其使用output_path的存储桶AND前缀名称?

您是否尝试过使用“ code_location”参数: https ://sagemaker.readthedocs.io/en/stable/estimators.html指定源代码的位置?

以下是使用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'
                           )

我相信@ user3458797显示的code_location参数是正确的答案。

output_path仅配置S3位置以保存训练结果(模型工件和输出文件)。

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

除非您在培训期间将文件移至/ opt / ml / model或使用code_location参数,否则您的培训脚本不会保存在“ output_path”中。

请让我知道是否有任何需要澄清的内容。

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM