导入训练好的模型参数代码报错

img


Unsuccessful TensorSliceReader constructor: Failed to find any matching files for ram://6102fbb2-f55f-443e-821c-678ad13fc107/variables/variables
You may be trying to load on a different device from the computational device. Consider setting the experimental_io_device option in tf.saved_model.LoadOptions to the io_device such as '/job:localhost'.

我的和你一样也是用joblib加载模型错误,joblib新版本不能保存深度学习模型
保存的对象是空的
修改后:

model.save('model.h5')# 保存模型 'model.h5'是保存的文件名
import tensorflow.keras.models
model2 = tensorflow.keras.models.load_model('model.h5')#加载模型
model2.summary()#查看
这样就行了

请问解决问题了吗?我也遇到了这个问题,但是解决不了

看提示应该是模型文件的路径有问题,找不到文件,导致这个pickle_in对象是空的,load失败