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 的存储桶和前缀名称?

您是否尝试过使用“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

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

如果有什么我可以澄清的,请告诉我。