我使用的是sagemaker 2.5.1和tensorflow 2.3.0奇怪的是,以前同样的代码也工作过,我能想到的唯一变化是两个库的新版本
这似乎是SageMaker的一个错误。
我假设您正在使用TensorFlow
估计器来训练模型。类似这样的东西:
estimator = TensorFlow(
entry_point='script.py',
role=role,
train_instance_count=1,
train_instance_type='ml.p3.2xlarge',
framework_version='2.3.0',
py_version='py37',
script_mode=True,
hyperparameters={
'epochs': 100,
'batch-size': 256,
'learning-rate': 0.001
}
)
如果是这种情况,那么在启用调试器回调时,TensorFlow 2.2或TensorFlow 3.3都会导致此错误。要解决此问题,可以将debugger_hook_config
设置为False
:
estimator = TensorFlow(
entry_point='script.py',
role=role,
train_instance_count=1,
train_instance_type='ml.p3.2xlarge',
framework_version='2.3.0',
py_version='py37',
script_mode=True,
debugger_hook_config=False,
hyperparameters={
'epochs': 100,
'batch-size': 256,
'learning-rate': 0.001
}
)
问题实际上来自smdebug 0.9.1版本降级到0.8.1解决了问题