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: 'Digraph' object has no attribute '_repr_svg_' #92

Open
Uday-Shankar-Shanthamallu opened this issue Jan 25, 2022 · 2 comments

Comments

@Uday-Shankar-Shanthamallu
Copy link

Uday-Shankar-Shanthamallu commented Jan 25, 2022

I am following the demo notebook for pytorch (version 1.9.1) and I get the following error:

model = torchvision.models.alexnet()

# Build HiddenLayer graph
hl_graph = hl.build_graph(model, torch.zeros([1, 3, 224, 224]))

# Use a different color theme
hl_graph.theme = hl.graph.THEMES["blue"].copy()  # Two options: basic and blue
hl_graph

AttributeError Traceback (most recent call last)
~/opt/anaconda3/envs/gexp/lib/python3.8/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:

~/opt/anaconda3/envs/gexp/lib/python3.8/site-packages/hiddenlayer/graph.py in repr_svg(self)
357 def repr_svg(self):
358 """Allows Jupyter notebook to render the graph automatically."""
--> 359 return self.build_dot().repr_svg()
360
361 def save(self, path, format="pdf"):

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

@lpacit
Copy link

lpacit commented Feb 1, 2022

Same issue here, did you manage to solve it?

@pyjhzwh
Copy link

pyjhzwh commented Feb 7, 2022

return self.build_dot()._repr_svg_()

replace this line with
return self.build_dot()._repr_image_svg_xml()

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

3 participants