Not able to import saving
See original GitHub issueI’m trying to use Intel NLP Architect and its example has this line that makes it not working:
>>> from keras.engine import saving
Using TensorFlow backend.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'saving'
Anyone knows how to fix it? Thank you! Also this is a link to the whole framework: http://nlp_architect.nervanasys.com/ner_crf.html But the line that makes it not working is just that one line.
========================================================================
Please make sure that the boxes below are checked before you submit your issue. If your issue is an implementation question, please ask your question on StackOverflow or join the Keras Slack channel and ask there instead of filing a GitHub issue.
Thank you!
-
Check that you are up-to-date with the master branch of Keras. You can update with: pip install git+git://github.com/keras-team/keras.git --upgrade --no-deps
-
If running on TensorFlow, check that you are up-to-date with the latest version. The installation instructions can be found here.
-
If running on Theano, check that you are up-to-date with the master branch of Theano. You can update with: pip install git+git://github.com/Theano/Theano.git --upgrade --no-deps
-
Provide a link to a GitHub Gist of a Python script that can reproduce your issue (or just copy the script here if it is short).
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (2 by maintainers)
It is super late but I want to give the solution in case somebody is still looking for it.
I am using Keras (2.1.3) and Tensorflow (1.3.0) and I saw that the developers rewrote the word saving as topology.
Therefore, in order to make it work, you need to modify (in your model file of …\site-packages\mrcnn) this:
From:
from keras.engine import saving
To:
from keras.engine import topology
And from:
if by_name: saving.load_weights_from_hdf5_group_by_name(f, layers)
else: saving.load_weights_from_hdf5_group(f, layers)
To:
if by_name: topology.load_weights_from_hdf5_group_by_name(f, layers)
else: topology.load_weights_from_hdf5_group(f, layers)
Hi!
It seems the
saving
file inkeras.engine
has been initialized after the last release of keras (2.1.6 – relevant commit).You can either: