SMSIG tensorflow config_error ai_generated true

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

ID: tensorflow/savedmodel-signature-key-error

Also available as: JSON · Markdown · 中文
90%Fix Rate
87%Confidence
1Evidence
2023-08-05First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
tensorflow==2.10.0 active
tensorflow==2.12.0 active
tensorflow==2.15.0 active

Root Cause

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

generic

中文

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

Official Documentation

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

Workarounds

  1. 95% success Re-export the model with `tf.saved_model.save` and include a serving signature by specifying `signatures` parameter with a concrete function.
    Re-export the model with `tf.saved_model.save` and include a serving signature by specifying `signatures` parameter with a concrete function.
  2. 85% success 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`.
    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. 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`.

Dead Ends

Common approaches that don't work:

  1. 95% fail

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

  2. 85% fail

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