如何在Python Sagemaker SDK中使用TensorFlow估计器指定最大运行时间?

2024-04-26 14:25:40 发布

您现在位置:Python中文网/ 问答频道 /正文

使用Python Sagemaker SDK,可以使用TensorFlow启动培训作业,代码如下:

import sagemaker
from sagemaker.tensorflow import TensorFlow

sess = sagemaker.Session()
tf_estimator = TensorFlow(...)
tf_estimator.fit(...)

是否可以在此脚本中指定培训的最大运行时间


Tags: 代码fromimport脚本sessiontftensorflow作业
2条回答

让我对@Franco的答案加上一点更正

sagemaker.estimator.EstimatorBase的参数名为max_run=86400以分配最大运行时间

由于AWS支持,找到了答案:

TensorFlow估计器有一个基类sagemaker.estimator.Framework,它又有一个基类sagemaker.estimator.EstimatorBase,它接受参数train_max_run,它接受以秒为单位的值,默认为86,40024hs

因此TensorFlow估计器的初始化将传递最大训练运行时间的自定义值,如下所示:

MAX_TRAINING_TIME = 99999
tf_estimator = TensorFlow(..., train_max_run=MAX_TRAINING_TIME)

相关问题 更多 >