为 AWS SageMaker 培训作业分配名称

时间:2021-07-14 08:05:53

标签: amazon-web-services amazon-sagemaker

这可能是一个非常基本的问题(我想是的)

estimator = PyTorch(entry_point='train.py',
                   source_dir = 'code',
                    role = role,
                   framework_version = '1.5.0',
                   py_version = 'py3',
                   instance_count = 2,
                   instance_type = 'ml.g4dn.2xlarge',
                   hyperparameters={"epochs": 2,
                                     "num_labels": 46,
                                     "backend": "gloo",    
                                    },
                   profiler_config=profiler_config,
                    debugger_hook_config=debugger_hook_config,
                    rules=rules
                   )

我如上声明了我的估算器,并使用 fit() 将其放入训练中。
我已经在我的 sagemaker 上完成了其中的几个,并且在 aws 培训工作日志中有几个培训工作。
但它们都以“pytorch-training-2021 ....”的形式出现。
无论如何我可以声明训练作业的名称,例如“custom-model-xgboost-ver1”?
我以为它可以作为estimator的参数之一,但我找不到。

提前致谢。

2 个答案:

答案 0 :(得分:2)

当您调用 fit() 时,您可以传递此参数 job_name=yourJobName

答案 1 :(得分:1)

您可以使用以下代码段作为示例,使用 estimator.fit()

from sagemaker.pytorch import PyTorch

estimator = PyTorch(entry_point='mnist.py',
                    role=role,
                    py_version='py3',
                    framework_version='1.8.0',
                    instance_count=2,
                    instance_type='ml.c5.2xlarge',
                    hyperparameters={
                        'epochs': 1,
                        'backend': 'gloo'
                    })
estimator.fit('training': inputs, job_name='Name')