I am trying to save a tensorflow keras model with this summary:
Model: "sequential_2" etc.
using the following command:
model.save('my_model.h5')
I got the following error (in Jupyter Notebook):
ImportError: `save_model` requires h5py.
So, I installed h5py, using
conda install h5py
After the installation, I got the version of h5py in the Jupyter Notebook(same place I am trying to save the model):
h5py.__version__
'2.8.0'
Still, I got the same error. Even though, I imported h5py manually.
import h5py
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
filename = 'model.h5'
model.save(filename)
---------------------------------------------------------------------------
**ImportError** Traceback (most recent call last)
<ipython-input-54-9160eee81fe6> in <module>
5 from tensorflow.keras import layers
6 filename = 'model.h5'
----> 7 model.save(filename)
~/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/network.py in save(self, filepath, overwrite, include_optimizer, save_format, signatures)
~/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/keras/saving/save.py in save_model(model, filepath, overwrite, include_optimizer, save_format, signatures)
~/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/keras/saving/hdf5_format.py in save_model_to_hdf5(model, filepath, overwrite, include_optimizer)
**ImportError:** save_model requires h5py.