1.
出现
WARNING:absl:Found untraced functions such as lstm_cell_2_layer_call_fn, lstm_cell_2_layer_call_and_return_conditional_losses, lstm_cell_2_layer_call_fn, lstm_cell_2_layer_call_and_return_conditional_losses, lstm_cell_2_layer_call_and_return_conditional_losses while saving (showing 5 of 5). These functions will not be directly callable after loading
修改model.save('uv.model') 为 model.save('uv.h5'),成功保存
加载使用
from tensorflow import keras
model = keras.models.load_model('uv.h5')
model.summary()
成功
2.或者载入时候出现
[Errno 13] Permission denied: 'Uw2v_model.pkl'
不是权限问题,就是因为保存模型时候有上文的警告,导致写入问题,此时模型文件会是个文件夹而不是一个文件。
改正方式,和上文一样
修改model.save('uv.model') 为 model.save('uv.h5'),成功保存
加载使用
from tensorflow import keras
model = keras.models.load_model('uv.h5')
model.summary()
成功