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

Can't create graph visualizations with resnet #11

Closed
lim0606 opened this issue Apr 26, 2016 · 8 comments
Closed

Can't create graph visualizations with resnet #11

lim0606 opened this issue Apr 26, 2016 · 8 comments

Comments

@lim0606
Copy link

lim0606 commented Apr 26, 2016

Hi,

I tried to draw ResNet (https://github.com/facebook/fb.resnet.torch/blob/master/models/resnet.lua)

However, I got following error;

/home/jaehyun/github/torch/install/bin/lua: ...hyun/github/torch/install/share/lua/5.2/nn/Container.lua:67: 
In 2 module of nn.Sequential:
...ub/torch/install/share/lua/5.2/nn/BatchNormalization.lua:112: attempt to index field 'THNN' (a nil value)
stack traceback:
        ...ub/torch/install/share/lua/5.2/nn/BatchNormalization.lua:112: in function <...ub/torch/install/share/lua/5.2/nn/BatchNormalization.lua:101>
        [C]: in function 'xpcall'
        ...hyun/github/torch/install/share/lua/5.2/nn/Container.lua:63: in function 'rethrowErrors'
        ...yun/github/torch/install/share/lua/5.2/nn/Sequential.lua:44: in function <...yun/github/torch/install/share/lua/5.2/nn/Sequential.lua:41>
        (...tail calls...)
        ...n/github/torch/install/share/lua/5.2/optnet/graphgen.lua:218: in function 'generateGraph'
        models/draw_model.lua:51: in function 'drawModel'
        models/create-resnet.lua:53: in main chunk
        [C]: in function 'dofile'
        ...thub/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
        [C]: in ?

WARNING: If you see a stack trace below, it doesn't point to the place where this error occured. Please use only the one above.
stack traceback:
        [C]: in function 'error'
        ...hyun/github/torch/install/share/lua/5.2/nn/Container.lua:67: in function 'rethrowErrors'
        ...yun/github/torch/install/share/lua/5.2/nn/Sequential.lua:44: in function <...yun/github/torch/install/share/lua/5.2/nn/Sequential.lua:41>
        (...tail calls...)
        ...n/github/torch/install/share/lua/5.2/optnet/graphgen.lua:218: in function 'generateGraph'
        models/draw_model.lua:51: in function 'drawModel'
        models/create-resnet.lua:53: in main chunk
        [C]: in function 'dofile'
        ...thub/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
        [C]: in ?

Is there anyone who can help me to find this problem?

Thanks

Best regards,

Jaehyun

@fmassa
Copy link
Owner

fmassa commented Apr 26, 2016

I think you need to require cunn as well as nn.

@fmassa
Copy link
Owner

fmassa commented Apr 26, 2016

Also, do you have up-to-date versions of both nn and cunn ?

@lim0606
Copy link
Author

lim0606 commented Apr 26, 2016

@fmassa

Thank you for kind response!

I inattentively disregarded `require 'cunn', since I thought that the code does not have any explicit usage with it.

Despite of the cunn, I got new error messages as follows;

/home/jaehyun/github/torch/install/bin/lua: ...hyun/github/torch/install/share/lua/5.2/nn/Container.lua:67: 
In 5 module of nn.Sequential:
In 1 module of nn.Sequential:
In 2 module of nn.Sequential:
...hyun/github/torch/install/share/lua/5.2/nn/CAddTable.lua:16: bad argument #2 to 'add' (sizes do not match at /tmp/luarocks_cutorch-scm-1-4411/cutorch/lib/THC/THCTensorMathPointwise.cu:121)
stack traceback:
        [C]: in function 'add'
        ...hyun/github/torch/install/share/lua/5.2/nn/CAddTable.lua:16: in function <...hyun/github/torch/install/share/lua/5.2/nn/CAddTable.lua:9>
        [C]: in function 'xpcall'
        ...hyun/github/torch/install/share/lua/5.2/nn/Container.lua:63: in function 'rethrowErrors'
        ...yun/github/torch/install/share/lua/5.2/nn/Sequential.lua:44: in function <...yun/github/torch/install/share/lua/5.2/nn/Sequential.lua:41>
        [C]: in function 'xpcall'
        ...hyun/github/torch/install/share/lua/5.2/nn/Container.lua:63: in function 'rethrowErrors'
        ...yun/github/torch/install/share/lua/5.2/nn/Sequential.lua:44: in function <...yun/github/torch/install/share/lua/5.2/nn/Sequential.lua:41>
        [C]: in function 'xpcall'
        ...hyun/github/torch/install/share/lua/5.2/nn/Container.lua:63: in function 'rethrowErrors'
        ...yun/github/torch/install/share/lua/5.2/nn/Sequential.lua:44: in function <...yun/github/torch/install/share/lua/5.2/nn/Sequential.lua:41>
        (...tail calls...)
        ...n/github/torch/install/share/lua/5.2/optnet/graphgen.lua:218: in function 'generateGraph'
        models/draw_model.lua:51: in function 'drawModel'
        models/create-resnet.lua:49: in main chunk
        [C]: in function 'dofile'
        ...thub/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
        [C]: in ?

WARNING: If you see a stack trace below, it doesn't point to the place where this error occured. Please use only the one above.
stack traceback:
        [C]: in function 'error'
        ...hyun/github/torch/install/share/lua/5.2/nn/Container.lua:67: in function 'rethrowErrors'
        ...yun/github/torch/install/share/lua/5.2/nn/Sequential.lua:44: in function <...yun/github/torch/install/share/lua/5.2/nn/Sequential.lua:41>
        (...tail calls...)
        ...n/github/torch/install/share/lua/5.2/optnet/graphgen.lua:218: in function 'generateGraph'
        models/draw_model.lua:51: in function 'drawModel'
        models/create-resnet.lua:49: in main chunk
        [C]: in function 'dofile'
        ...thub/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
        [C]: in ?

I would appreciate if you help me to solve this issue.

Thank you for your assistance.

Jaehyun

@fmassa
Copy link
Owner

fmassa commented Apr 26, 2016

This looks like a problem with your model definition, or with your input dimension. Can your forward the input into your model, like

output = model:forward(input)

?

@lim0606
Copy link
Author

lim0606 commented Apr 27, 2016

@fmassa

Thank you for your kind responses!

There was a problem in model definition in ResNet. (I made a bug fix for it. facebookarchive/fb.resnet.torch#37)

After the modification, I applied model:forward(input) to the model, and I works well. yay!

However..... I got new errors with following messages...;

/home/jaehyun/github/torch/install/bin/lua: ...hyun/github/torch/install/share/lua/5.2/nn/Container.lua:67: 
In 5 module of nn.Sequential:
In 1 module of nn.Sequential:
In 1 module of nn.Sequential:
In 2 module of nn.ConcatTable:
In 2 module of nn.Sequential:
...n/github/torch/install/share/lua/5.2/optnet/graphgen.lua:202: attempt to call method 'size' (a nil value)
stack traceback:
        ...n/github/torch/install/share/lua/5.2/optnet/graphgen.lua:202: in function <...n/github/torch/install/share/lua/5.2/optnet/graphgen.lua:190>
        [C]: in function 'xpcall'
        ...hyun/github/torch/install/share/lua/5.2/nn/Container.lua:63: in function 'rethrowErrors'
        ...yun/github/torch/install/share/lua/5.2/nn/Sequential.lua:44: in function <...yun/github/torch/install/share/lua/5.2/nn/Sequential.lua:41>
        (...tail calls...)
        [C]: in function 'xpcall'
        ...hyun/github/torch/install/share/lua/5.2/nn/Container.lua:63: in function 'rethrowErrors'
        ...un/github/torch/install/share/lua/5.2/nn/ConcatTable.lua:11: in function <...un/github/torch/install/share/lua/5.2/nn/ConcatTable.lua:9>
        (...tail calls...)
        [C]: in function 'xpcall'
        ...hyun/github/torch/install/share/lua/5.2/nn/Container.lua:63: in function 'rethrowErrors'
        ...
        ...hyun/github/torch/install/share/lua/5.2/nn/Container.lua:63: in function 'rethrowErrors'
        ...yun/github/torch/install/share/lua/5.2/nn/Sequential.lua:44: in function <...yun/github/torch/install/share/lua/5.2/nn/Sequential.lua:41>
        (...tail calls...)
        [C]: in function 'xpcall'
        ...hyun/github/torch/install/share/lua/5.2/nn/Container.lua:63: in function 'rethrowErrors'
        ...yun/github/torch/install/share/lua/5.2/nn/Sequential.lua:44: in function <...yun/github/torch/install/share/lua/5.2/nn/Sequential.lua:41>
        (...tail calls...)
        ...n/github/torch/install/share/lua/5.2/optnet/graphgen.lua:223: in function 'generateGraph'
        models/draw_model.lua:51: in function 'drawModel'
        models/create-resnet.lua:57: in main chunk
        [C]: in function 'dofile'
        ...thub/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
        [C]: in ?

WARNING: If you see a stack trace below, it doesn't point to the place where this error occured. Please use only the one above.
stack traceback:
        [C]: in function 'error'
        ...hyun/github/torch/install/share/lua/5.2/nn/Container.lua:67: in function 'rethrowErrors'
        ...yun/github/torch/install/share/lua/5.2/nn/Sequential.lua:44: in function <...yun/github/torch/install/share/lua/5.2/nn/Sequential.lua:41>
        (...tail calls...)
        ...n/github/torch/install/share/lua/5.2/optnet/graphgen.lua:223: in function 'generateGraph'
        models/draw_model.lua:51: in function 'drawModel'
        models/create-resnet.lua:57: in main chunk
        [C]: in function 'dofile'
        ...thub/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
        [C]: in ?

Thank you so much for your assistance :)

Best regards,

Jaehyun

fmassa added a commit that referenced this issue Apr 27, 2016
Fix is included in PR #10, but I fix it here for #11
@fmassa
Copy link
Owner

fmassa commented Apr 27, 2016

Hi,

Thanks for pointing this out. I had a fix for the error you are experiencing in a pending PR, but I just integrated the changes in b24b0e5 . Could you try updating optnet and check if it works now ?

@lim0606 lim0606 changed the title Can't create graph visualizations with resnet (maybe because of BatchNormalization?) Can't create graph visualizations with resnet Apr 27, 2016
@lim0606
Copy link
Author

lim0606 commented Apr 27, 2016

@fmassa

Thank you so much for your kind response!

I works! and thus I made example figures as follows
type A shortcut: https://github.com/lim0606/optimize-net/blob/master/tmp/resnet-cls-A.svg
type B shortcut: https://github.com/lim0606/optimize-net/blob/master/tmp/resnet-cls-B.svg

Once again thank you for assistance :)

Best regards,

Jaehyun

@fmassa
Copy link
Owner

fmassa commented Apr 27, 2016

Great ! Nice plots btw.
I'm closing the issue then. Feel free to reopen if you meet any other problems.

@fmassa fmassa closed this as completed Apr 27, 2016
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

2 participants