[英]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.