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

plot_model has a AssertionError #12538

Closed
jhhuang96 opened this issue Mar 24, 2019 · 6 comments
Closed

plot_model has a AssertionError #12538

jhhuang96 opened this issue Mar 24, 2019 · 6 comments
Assignees
Labels
stat:awaiting response from contributor type:support User is asking for help / asking an implementation question. Stackoverflow would be better suited.

Comments

@jhhuang96
Copy link

When I run the following code
plot_model(model,show_shapes=True,to_file="test.png")

It appears following error:

"dot" with args ['-Tps', 'C:\Users\Public\Documents\Wondershare\CreatorTemp\tmpknhr3o1n'] returned code: 1

stdout, stderr:
b''
b"'D:\Program' \xb2\xbb\xca\xc7\xc4\xda\xb2\xbf\xbb\xf2\xcd\xe2\xb2\xbf\xc3\xfc\xc1\xee\xa3\xac\xd2\xb2\xb2\xbb\xca\xc7\xbf\xc9\xd4\xcb\xd0\xd0\xb5\xc4\xb3\xcc\xd0\xf2\r\n\xbb\xf2\xc5\xfa\xb4\xa6\xc0\xed\xce\xc4\xbc\xfe\xa1\xa3\r\n"


AssertionError Traceback (most recent call last)
in
4 model = Model(inputs=[encoder_inputs, decoder_inputs], outputs=decoder_outputs)
5 # plot the model
----> 6 plot_model(model,show_shapes=True,to_file="encoder_decoder.png")

D:\Program Files\Anaconda3\envs\tensorflow\lib\site-packages\keras\utils\vis_utils.py in plot_model(model, to_file, show_shapes, show_layer_names, rankdir)
130 'LR' creates a horizontal plot.
131 """
--> 132 dot = model_to_dot(model, show_shapes, show_layer_names, rankdir)
133 _, extension = os.path.splitext(to_file)
134 if not extension:

D:\Program Files\Anaconda3\envs\tensorflow\lib\site-packages\keras\utils\vis_utils.py in model_to_dot(model, show_shapes, show_layer_names, rankdir)
53 from ..models import Sequential
54
---> 55 _check_pydot()
56 dot = pydot.Dot()
57 dot.set('rankdir', rankdir)

D:\Program Files\Anaconda3\envs\tensorflow\lib\site-packages\keras\utils\vis_utils.py in _check_pydot()
24 # Attempt to create an image of a blank graph
25 # to check the pydot/graphviz installation.
---> 26 pydot.Dot.create(pydot.Dot())
27 except OSError:
28 raise OSError(

D:\Program Files\Anaconda3\envs\tensorflow\lib\site-packages\pydot.py in create(self, prog, format, encoding)
1943 print(message)
1944
-> 1945 assert process.returncode == 0, process.returncode
1946
1947 return stdout_data

AssertionError: 1

I can import successfully with
import pydot import graphviz

But when I run
pydot.Dot.create(pydot.Dot())
It happens the same error: AssertionError

@ymodak ymodak self-assigned this Mar 25, 2019
@ymodak ymodak added backend:tensorflow type:support User is asking for help / asking an implementation question. Stackoverflow would be better suited. labels Mar 25, 2019
@ymodak
Copy link
Collaborator

ymodak commented Mar 25, 2019

In order to expedite the trouble-shooting process, please provide a code snippet to reproduce the issue reported here. Thanks!

@jhhuang96
Copy link
Author

@ymodak I solved it. I uninstall pydot and pip install pydot-ng. Then change the code in '...\keras\utils\vis_utils.py'

import pydot_ng as pydot
instead of
import pydot

@ranbix666
Copy link

It works for pydotplus too. Thanks!

@LucaAmerio
Copy link

I solved the issue commenting line 117 program += extension in pydot.py

@GokulMahendran
Copy link

it works fine

@samerzahra
Copy link

I solved the issue commenting line 117 program += extension in pydot.py

Thanks @LucaAmerio

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:awaiting response from contributor type:support User is asking for help / asking an implementation question. Stackoverflow would be better suited.
Projects
None yet
Development

No branches or pull requests

6 participants