SMSIG tensorflow config_error ai_generated true

ValueError: 在SavedModel中未找到签名键'serving_default'。可用键:['train', 'eval']。请检查模型导出配置。

ValueError: Signature key 'serving_default' not found in SavedModel. Available keys: ['train', 'eval']. Check the model export configuration.

ID: tensorflow/savedmodel-signature-key-error

其他格式: JSON · Markdown 中文 · English
90%修复率
87%置信度
1证据数
2023-08-05首次发现

版本兼容性

版本状态引入弃用备注
tensorflow==2.10.0 active
tensorflow==2.12.0 active
tensorflow==2.15.0 active

根因分析

SavedModel仅导出训练和评估签名,缺少推理所需的默认服务签名。

English

The SavedModel was exported with only training and evaluation signatures, lacking the default serving signature required for inference.

generic

官方文档

https://www.tensorflow.org/guide/saved_model

解决方案

  1. Re-export the model with `tf.saved_model.save` and include a serving signature by specifying `signatures` parameter with a concrete function.
  2. Use `model.save('model.h5')` to save in HDF5 format and then convert to SavedModel with the correct signatures using `tf.keras.models.load_model` and `tf.saved_model.save`.

无效尝试

常见但无效的做法:

  1. 95% 失败

    Reinstalling TensorFlow does not affect the SavedModel content; the issue is in the export process.

  2. 85% 失败

    Changing the input data shape does not add missing signatures; it only affects the data passed to existing signatures.