Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Use with Keras Model" in Tutorioal does not work properly #735

Closed
tomoyukilabs opened this issue Jan 18, 2018 · 6 comments
Closed

"Use with Keras Model" in Tutorioal does not work properly #735

tomoyukilabs opened this issue Jan 18, 2018 · 6 comments
Assignees
Labels

Comments

@tomoyukilabs
Copy link

I'd like to know how to solve the following problem. I've tried a tutorial "Use with Keras Model" as shell command and python script, but both would result in an error like:

AttributeError: 'Model' object has no attribute 'nodes_by_depth'

I really appreciate your help.

@milhidaka milhidaka self-assigned this Jan 18, 2018
@milhidaka milhidaka added the bug label Jan 18, 2018
@milhidaka
Copy link
Member

Thanks for reporting.
I will investigate it.

@iver56
Copy link

iver56 commented Jan 18, 2018

I got the same error message

play.py:

from keras.applications import resnet50
model = resnet50.ResNet50(include_top=True, weights='imagenet')
model.save("resnet50.h5")


from webdnn.frontend.keras import KerasConverter
from webdnn.backend import generate_descriptor

graph = KerasConverter(batch_size=1).convert(model)
exec_info = generate_descriptor("fallback", graph)  # also "webassembly", "webgl", "fallback" are available.
exec_info.save("./output")
Traceback (most recent call last):
  File "play.py", line 9, in <module>
    graph = KerasConverter(batch_size=1).convert(model)
  File "/home/iverjo/anaconda3/lib/python3.6/site-packages/webdnn-1.1.0-py3.6.egg/webdnn/frontend/keras/converter.py", line 115, in convert
    return self._convert_fallback(model)
  File "/home/iverjo/anaconda3/lib/python3.6/site-packages/webdnn-1.1.0-py3.6.egg/webdnn/frontend/keras/converter.py", line 127, in _convert_fallback
    for depth in sorted(list(model.nodes_by_depth.keys()), reverse=True):
AttributeError: 'Model' object has no attribute 'nodes_by_depth'

In my environment (Bash on Ubuntu 16.04 on Windows), pip freeze returns the following:

alabaster==0.7.10
anaconda-client==1.6.5
anaconda-navigator==1.6.9
anaconda-project==0.8.0
asn1crypto==0.22.0
astroid==1.5.3
astropy==2.0.2
Babel==2.5.0
backports.shutil-get-terminal-size==1.0.0
beautifulsoup4==4.6.0
bitarray==0.8.1
bkcharts==0.2
blaze==0.11.3
bleach==1.5.0
bokeh==0.12.10
boto==2.48.0
Bottleneck==1.2.1
certifi==2017.7.27.1
cffi==1.10.0
chardet==3.0.4
click==6.7
cloudpickle==0.4.0
clyent==1.2.2
colorama==0.3.9
conda==4.4.7
conda-build==3.0.27
conda-verify==2.0.0
contextlib2==0.5.5
cryptography==2.0.3
cycler==0.10.0
Cython==0.26.1
cytoolz==0.8.2
dask==0.15.3
datashape==0.5.4
decorator==4.1.2
distributed==1.19.1
docutils==0.14
entrypoints==0.2.3
enum34==1.1.6
et-xmlfile==1.0.1
fastcache==1.0.2
filelock==2.0.12
Flask==0.12.2
Flask-Cors==3.0.3
gevent==1.2.2
glob2==0.5
gmpy2==2.0.8
greenlet==0.4.12
h5py==2.7.0
heapdict==1.0.0
html5lib==0.9999999
idna==2.6
imageio==2.2.0
imagesize==0.7.1
ipykernel==4.6.1
ipython==6.1.0
ipython-genutils==0.2.0
ipywidgets==7.0.0
isort==4.2.15
itsdangerous==0.24
jdcal==1.3
jedi==0.10.2
Jinja2==2.9.6
jsonschema==2.6.0
jupyter-client==5.1.0
jupyter-console==5.2.0
jupyter-core==4.3.0
jupyterlab==0.27.0
jupyterlab-launcher==0.4.0
Keras==2.1.3
lazy-object-proxy==1.3.1
llvmlite==0.20.0
locket==0.2.0
lxml==4.1.0
Markdown==2.6.11
MarkupSafe==1.0
matplotlib==2.1.0
mccabe==0.6.1
mistune==0.7.4
mpmath==0.19
msgpack-python==0.4.8
multipledispatch==0.4.9
navigator-updater==0.1.0
nbconvert==5.3.1
nbformat==4.4.0
networkx==2.0
nltk==3.2.4
nose==1.3.7
notebook==5.0.0
numba==0.35.0+10.g143f70e90
numexpr==2.6.2
numpy==1.13.3
numpydoc==0.7.0
odo==0.5.1
olefile==0.44
openpyxl==2.4.8
packaging==16.8
pandas==0.20.3
pandocfilters==1.4.2
partd==0.3.8
path.py==10.3.1
pathlib2==2.3.0
patsy==0.4.1
pep8==1.7.0
pexpect==4.2.1
pickleshare==0.7.4
Pillow==4.2.1
pkginfo==1.4.1
ply==3.10
prompt-toolkit==1.0.15
protobuf==3.5.1
psutil==5.4.0
ptyprocess==0.5.2
py==1.4.34
pycodestyle==2.3.1
pycosat==0.6.3
pycparser==2.18
pycrypto==2.6.1
pycurl==7.43.0
pyflakes==1.6.0
Pygments==2.2.0
pylint==1.7.4
pyodbc==4.0.17
pyOpenSSL==17.2.0
pyparsing==2.2.0
PySocks==1.6.7
pytest==3.2.1
python-dateutil==2.6.1
pytz==2017.2
PyWavelets==0.5.2
PyYAML==3.12
pyzmq==16.0.2
QtAwesome==0.4.4
qtconsole==4.3.1
QtPy==1.3.1
requests==2.18.4
rope==0.10.5
ruamel-yaml==0.11.14
scikit-image==0.13.0
scikit-learn==0.19.1
scipy==1.0.0
seaborn==0.8
simplegeneric==0.8.1
singledispatch==3.4.0.3
six==1.11.0
snowballstemmer==1.2.1
sortedcollections==0.5.3
sortedcontainers==1.5.7
Sphinx==1.6.3
sphinxcontrib-websupport==1.0.1
spyder==3.2.4
SQLAlchemy==1.1.13
statsmodels==0.8.0
sympy==1.1.1
tables==3.4.2
tblib==1.3.2
tensorflow==1.4.1
tensorflow-tensorboard==0.4.0rc3
terminado==0.6
testpath==0.3.1
toolz==0.8.2
tornado==4.5.2
traitlets==4.3.2
typing==3.6.2
unicodecsv==0.14.1
urllib3==1.22
wcwidth==0.1.7
webdnn==1.1.0
webencodings==0.5.1
Werkzeug==0.12.2
widgetsnbextension==3.0.2
wrapt==1.10.11
xlrd==1.1.0
XlsxWriter==1.0.2
xlwt==1.3.0
zict==0.1.3

@zhaoming0 zhaoming0 mentioned this issue Jan 18, 2018
@zhaoming0
Copy link
Contributor

The same error throws on Benchmark setup

Error Log

Traceback (most recent call last):
 File "../../bin/convert_keras.py", line 113, in <module>
     main()
 File "../../bin/convert_keras.py", line 63, in main 
     graph = converter.convert(model)
 File "/usr/local/lib/python3.6/dist-packages/webdnn-1.1.0-py3.6.egg/webdnn/frontend/keras/converter.py", line 115, in convert
     return self._convert_fallback(model)
 File "/usr/local/lib/python3.6/dist-packages/webdnn-1.1.0-py3.6.egg/webdnn/frontend/keras/converter.py", line 127, in _convert_fallback
 for depth in sorted(list(model.nodes_by_depth.keys()), reverse=True):
 AttributeError: 'Model' object has no attribute 'nodes_by_depth'

Investigated python script, change #736 and re-install webdnn python3 setup.py install
This error will be fix

@milhidaka @Kiikurage PTAL

@milhidaka
Copy link
Member

This problem seems to be caused by following commit:
keras-team/keras@958239c#diff-98d8790a4331685d2a81334c398c4b58R573
And will be released as Keras 2.1.3.

@milhidaka
Copy link
Member

Thanks for the patch!
I also updated the document according to the support version change. #738

@tomoyukilabs
Copy link
Author

tomoyukilabs commented Jan 19, 2018

The patches has worked well on my environment. Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants