【解决error】 ValueError: No model found in config file.

raise ValueError('No model found in config file.') ValueError: No model found in config file.

解决方法

1.需要import

python 复制代码
from tensorflow.keras.models import load_model

如果加上import还报同样的错误,那么:

2.修改保存模型的参数

python 复制代码
model_save_path = "/hy-tmp/data/output/" + str(fold) + "/best_mode.h5"
cp_callback = tensorflow.keras.callbacks.ModelCheckpoint(filepath=model_save_path,
                                                         save_weights_only=False, # 只保存权重
                                                         save_best_only=True, # 只保存最佳模型
                                                         monitor='val_loss',
                                                         mode='min',
                                                         verbose=1)

save_weights_only参数的值修改为False即可。

参考博客

https://blog.csdn.net/qq_44761819/article/details/128704080

感谢大佬的分享,本博客只用作学习笔记,侵删!

相关推荐
Warson_L11 小时前
Python `Annotated` 与 LangGraph Reducer 学习笔记
python
韩师傅11 小时前
海天线算法的前世今生
python·计算机视觉
韩师傅11 小时前
当你的甲方设备过烂,要如何快速出效果?
python·计算机视觉
Warson_L11 小时前
LangGraph的MessageState and HumanMessage
python
韩师傅12 小时前
当你的甲方吐槽天空不够蓝,你应该如何应对
python·计算机视觉
Warson_L12 小时前
python的类&继承
python
Warson_L12 小时前
类型标注/type annotation
python
ThreeS14 小时前
手搓MiniVLA全实战教程-一步一步用pytorch解释原理与思路
人工智能·python
金銀銅鐵16 小时前
[Python] 模 n 乘法的逆元计算器
python·数学·游戏