尝试在S3存储桶中保存TF模型时出现KeyError:'callable_inputs'

问题描述

我正在使用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',debugger_hook_config=False,'learning-rate': 0.001
    } 
)
,

问题实际上来自于smdebug 0.9.1版 降级到0.8.1解决了这个问题