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

AttributeError: 'Dot' object has no attribute '_repr_svg_' #52

Open
lijipeng787 opened this issue Dec 5, 2019 · 5 comments
Open

AttributeError: 'Dot' object has no attribute '_repr_svg_' #52

lijipeng787 opened this issue Dec 5, 2019 · 5 comments

Comments

@lijipeng787
Copy link

my usage like this:
model = Model()
tw.draw_model(model, [1, 2, 256, 256])

and get error message:

AttributeError Traceback (most recent call last)
~/miniconda2/envs/pytorch_env/lib/python3.6/site-packages/IPython/core/formatters.py in call(self, obj)
343 method = get_real_method(obj, self.print_method)
344 if method is not None:
--> 345 return method()
346 return None
347 else:

~/miniconda2/envs/pytorch_env/lib/python3.6/site-packages/tensorwatch/model_graph/hiddenlayer/pytorch_draw_model.py in repr_svg(self)
11 def repr_svg(self):
12 """Allows Jupyter notebook to render the graph automatically."""
---> 13 return self.dot.repr_svg()
14 def save(self, filename, format="png"):
15 # self.dot.format = format

AttributeError: 'Dot' object has no attribute 'repr_svg'

@xsola
Copy link

xsola commented Dec 12, 2019

I also encountered this problem, have you solved it?

@cloudpanl
Copy link

This issue has been fixed, modifying pytorch_draw_model.py like this can be solved. #51

@pranavsekhar
Copy link

Hm, the fix in #51 isn't working for me. Did it work for either of you?

@xsola
Copy link

xsola commented Dec 27, 2019

Hm, the fix in #51 isn't working for me. Did it work for either of you?

Yes, it works for me. Maybe you should try to restart your jupyter notebook or just reimport tensorwatch after modifying pytorch_draw_model.py

@sytelus
Copy link
Contributor

sytelus commented Feb 7, 2020

I debugged this issue and it appears that pydot needs to be updated to resolve this error (see this comment). Unfortunately, pydot seems like an unmaintained project so I forked pydot and applied open PRs against it which resolves this issue. If you are facing this issue, I would suggest to reinstall pydot from my fork: https://github.com/sytelus/pydot.

TensorWatch is updated to use pydot from above fork however it will only affect new installations because pip doesn't detect vertion changes from package installed from git URLs.

So in nutshell, do this:

pip uninstall pydot
pip install git+https://github.com/sytelus/[email protected]#egg=pydot

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

No branches or pull requests

5 participants