Comments (7)
That is an issue with the backend this uses of pytorch.jit.get_trace_graph which does not support dict input.
But these days more and more models are having dicts and this hl module is amazing for analysis maybe we should figure out a way to add this capability into this package. I can help with that.
from hiddenlayer.
I have the same problem with dict input:
File "/home/snow_ripple/workspace/01_detection/mmdet/apis/inference.py", line 96, in _inference_single
hl_graph = hl.build_graph(model, **data)
TypeError: build_graph() got an unexpected keyword argument 'img'
Is there a workaround solution?
from hiddenlayer.
That is an issue with the backend this uses of pytorch.jit.get_trace_graph which does not support dict input.
But these days more and more models are having dicts and this hl module is amazing for analysis maybe we should figure out a way to add this capability into this package. I can help with that.
Yeah. I also do think a model graph tool supporting dict is very helpful, especially for this hl module, because it definitely helps understand and present large network visually. Looking forward to your contribution. Thanks!
from hiddenlayer.
I have the same problem with dict input:
File "/home/snow_ripple/workspace/01_detection/mmdet/apis/inference.py", line 96, in _inference_single
hl_graph = hl.build_graph(model, **data)
TypeError: build_graph() got an unexpected keyword argument 'img'Is there a workaround solution?
Maybe you can try the code like the following:
test_buff = getBuff(0)
graph = make_dot(net(test_buff), params=dict(net.named_parameters()))
graph.format = 'pdf'
graph.render("visPDF")
This interface of plotting model seems to simply get the output after feeding into the network. So I just guess it may be helpful to you. BTW, credit to the AlexNet example on https://github.com/szagoruyko/pytorchviz/blob/master/examples.ipynb.
from hiddenlayer.
Thanks @zhangjing1997 !
What is the point of getBuff(0)? Which module have the definition of this function?
I assume it is just a placeholder so I modified it to:
graph = make_dot(model(torch.zeros([1, 3, 224, 224])), params=dict(model.named_parameters()))
But it is still complaining about hte lack of other dictionary arguments.
from hiddenlayer.
Thanks @zhangjing1997 !
What is the point of getBuff(0)? Which module have the definition of this function?
I assume it is just a placeholder so I modified it to:
graph = make_dot(model(torch.zeros([1, 3, 224, 224])), params=dict(model.named_parameters()))But it is still complaining about hte lack of other dictionary arguments.
In my project, getBuff(0) is just a function returning a dict as the input to the network. I think your code is good to run. But actually your model input seems to be a torch tensor, not input. If that's the case, I guess you don't need to use the previous way I mentioned and maybe you could refer to
import torch.onnx
dummy_input = Variable(torch.randn(1, 3, 224, 224))
torch.onnx.export(model, dummy_input, "model.onnx")
Otherwise, if your model needs a dict input, can you show the specific error.
from hiddenlayer.
Hey, any progress on this? Anyone making a PR?
from hiddenlayer.
Related Issues (20)
- AttributeError: module 'torch.onnx' has no attribute '_optimize_trace' HOT 7
- torch._C.Node' object is not subscriptable
- module 'torch.jit' has no attribute '_get_trace_graph' HOT 3
- Pytorch Model Branch Duplication
- AttributeError: module 'torch.jit' has no attribute '_get_trace_graph' HOT 3
- ONNX symbolic expected a constant value of the rand argument
- tensor shapes not displayed in rendered graph HOT 5
- can it show variable name at every node?
- demo pytorch_graph.ipynb not working
- How to display branch nodes / parallel blocks HOT 2
- Not displaying graph as expected in Jupyter Notebook (either during training or after training) HOT 1
- How exactly should look the second parametr?
- build_graph() does not return HOT 2
- AttributeError: 'Digraph' object has no attribute '_repr_svg_' HOT 2
- How to display dimensions and change font to Times HOT 1
- TypeError for Pytorch Model HOT 4
- support yolov5 HOT 2
- Error when trying to print the Model
- Error while trying to run the example
- How to plot bert model? (Transfomer models) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hiddenlayer.