szagoruyko / pytorchviz

A small package to create visualizations of PyTorch execution graphs
MIT License
3.24k stars 279 forks source link

graphviz.backend.CalledProcessError: Command '['dot', '-Tpng', '-O', 'torchviz-sample']' returned non-zero exit status 1. [stderr: b'Format: "png" not recognized. Use one of:\r\n'] #44

Closed ShenDC closed 4 years ago

ShenDC commented 4 years ago

I used this to test,but get an error,how can I fix it? TY model = nn.Sequential() model.add_module('W0', nn.Linear(8, 16)) model.add_module('tanh', nn.Tanh()) model.add_module('W1', nn.Linear(16, 1))

x = torch.randn(1, 8)

dot = make_dot(model(x), params=dict(model.named_parameters()))
dot.format = 'png'
dot.render('torchviz-sample')
lvjiujin commented 4 years ago
  1. first, you cann't use the 2.4.2 version, you must use the version 2.38 msi version.
  2. second you should install graphviz-2.3.8.msi on your windows system and then add the path to your environmental variable path.
  3. pip install graphviz.