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

- **ID:** `tensorflow/savedmodel-signature-key-error`
- **领域:** tensorflow
- **类别:** config_error
- **错误码:** `SMSIG`
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

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

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| tensorflow==2.10.0 | active | — | — |
| tensorflow==2.12.0 | active | — | — |
| tensorflow==2.15.0 | active | — | — |

## 解决方案

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`.
   ```

## 无效尝试

- **** — Reinstalling TensorFlow does not affect the SavedModel content; the issue is in the export process. (95% 失败率)
- **** — Changing the input data shape does not add missing signatures; it only affects the data passed to existing signatures. (85% 失败率)
