microsoft / tensorwatch

Debugging, monitoring and visualization for Python Machine Learning and Data Science
MIT License
3.42k stars 362 forks source link

Issue with draw model #50

Closed mondeg0 closed 4 years ago

mondeg0 commented 4 years ago

Hello,

I've just installed tensorwatch and try to reproduce the example :

import tensorwatch as tw
import torchvision.models

alexnet_model = torchvision.models.alexnet()
tw.draw_model(alexnet_model, [1, 3, 224, 224])

and unfortunately I'm gettind the following error :

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
~/anaconda3/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:

~/anaconda3/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_'

My versions are:

I also try to run the given example on google colab and it raises the same error...

Maybe the error comes from my version of IPython ?

XYZ0901 commented 4 years ago

I have the same err in colab, so how did you solve it

mondeg0 commented 4 years ago

No, unfortunately I didn't manage to solve the issue... I'm waiting for an answer here =)

wangcan1213 commented 4 years ago

I got the same error with you, looking for a solution

mondeg0 commented 4 years ago

@lasp73 has proposed a pull request with a fix, I'm waiting this to be pushed to the master to test again.

Sheathluo commented 4 years ago

I have the same error.

qiang92 commented 4 years ago

I solved this by installing Graphviz2.38 in win10. You not only to "conda install graphviz", but also you need to download the msi file from https://graphviz.gitlab.io/_pages/Download/Download_windows.html and install it. Then you need to add its bin path to your environment path. Then change the pydot.py in your python package. From "self.prog = 'dot'" to "self.prog = 'dot.exe'".

Sheathluo commented 4 years ago

Thank you

------------------ 原始邮件 ------------------ 发件人: "qiang92"<notifications@github.com>; 发送时间: 2019年12月12日(星期四) 中午12:47 收件人: "microsoft/tensorwatch"<tensorwatch@noreply.github.com>; 抄送: "罗韬"<454230747@qq.com>;"Comment"<comment@noreply.github.com>; 主题: Re: [microsoft/tensorwatch] Issue with draw model (#50)

I solved this by installing Graphviz2.38 in win10. not conda install graphviz. You need to download the msi file from https://graphviz.gitlab.io/_pages/Download/Download_windows.html and install it. The add its bin path to environment path. Then change the pydot.py in your environment. From "self.prog = 'dot'" to "self.prog = 'dot.exe'".

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.