# 值错误：未知模型格式 'h5'。支持的格式：'tf', 'keras'

- **ID:** `tensorflow/unknown-model-save-format`
- **领域:** tensorflow
- **类别:** config_error
- **错误码:** `MSF`
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

在TF2默认保存格式中不支持使用.h5扩展名保存模型；只允许SavedModel或Keras原生格式。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| tensorflow 2.13.0 | active | — | — |
| tensorflow 2.14.0 | active | — | — |

## 解决方案

1. ```
   Use model.save('my_model.keras') with the native Keras format.
   ```
2. ```
   Use model.save('my_model', save_format='tf') for SavedModel format.
   ```
3. ```
   Explicitly set save_format='h5' in model.save() to force HDF5: model.save('my_model.h5', save_format='h5')
   ```

## 无效尝试

- **** — Renaming file extension to .tf doesn't change underlying format. (60% 失败率)
- **** — Installing h5py doesn't add .h5 support to TF2 save API. (90% 失败率)
