SPEN icon indicating copy to clipboard operation
SPEN copied to clipboard

Denoising example

Open DmitryUlyanov opened this issue 8 years ago • 10 comments

Hello David, I cannot get working SPEN denoising example. First I got an exception about inference_net being nil in RNNInference.lua, which I fixed somehow by setting inference_net = nn.Identity. But now I get an error because inference_net is nil:

2: attempt to index local 'module' (a nil value)
stack traceback:
        ...e/dulyanov/torch/install/share/lua/5.1/nn/Sequential.lua:12: in function 'add'
        ./RNNInference.lua:68: in function '__init'

Can you please try to reproduce it?

I used this fork to run the experiments, since it provided a helpful script. Wondering if denoising worked for xuexue.

DmitryUlyanov avatar Jan 05 '17 14:01 DmitryUlyanov

Hi Dmitry, Thanks for your interest in SPENs. inference_net should be a member of the problem object passed to the RNNInference constructor. See SPENDenoise.lua. The inference_net is the energy network that is learned (without the feature computation): This comment in RNNInference.lua explains the API of the inference_net: This takes {labels, features} and returns a single number per minibatch element--the energy network E_x(y)

I have a new version of the SPEN code that I am going to make public in the next few days. The code makes prototyping new applications substantially easier. I recommend switching to that. I'll let you know when I push it.

David

On Thu, Jan 5, 2017 at 9:12 AM Dmitry Ulyanov [email protected] wrote:

Hello David, I cannot get working SPEN denoising example. First I got an exception about inference_net being nil in RNNInference.lua, which I fixed somehow by setting inference_net = nn.Identity. But now I get an error because inference_net is nil:

2: attempt to index local 'module' (a nil value) stack traceback: ...e/dulyanov/torch/install/share/lua/5.1/nn/Sequential.lua:12: in function 'add' ./RNNInference.lua:68: in function '__init'

Can you please try to reproduce it?

I used this https://github.com/xuexue/SPEN fork to run the experiments, since it provided a helpful script. Wondering if denoising worked for xuexue.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/davidBelanger/SPEN/issues/4, or mute the thread https://github.com/notifications/unsubscribe-auth/ABH_qv6NSdz2QebCyL-9DYI4HS7T25QBks5rPPpGgaJpZM4Lbuav .

davidBelanger avatar Jan 05 '17 14:01 davidBelanger

OK. I just pushed a branch 'v2' to the SPEN repo. The internal code is substantially different, but the high-level stuff is the same. See Denoising.md for a quick start. Let me know if you have any questions. David

On Thu, Jan 5, 2017 at 9:32 AM David Belanger [email protected] wrote:

Hi Dmitry, Thanks for your interest in SPENs. inference_net should be a member of the problem object passed to the RNNInference constructor. See SPENDenoise.lua. The inference_net is the energy network that is learned (without the feature computation): This comment in RNNInference.lua explains the API of the inference_net: This takes {labels, features} and returns a single number per minibatch element--the energy network E_x(y)

I have a new version of the SPEN code that I am going to make public in the next few days. The code makes prototyping new applications substantially easier. I recommend switching to that. I'll let you know when I push it.

David

On Thu, Jan 5, 2017 at 9:12 AM Dmitry Ulyanov [email protected] wrote:

Hello David, I cannot get working SPEN denoising example. First I got an exception about inference_net being nil in RNNInference.lua, which I fixed somehow by setting inference_net = nn.Identity. But now I get an error because inference_net is nil:

2: attempt to index local 'module' (a nil value) stack traceback: ...e/dulyanov/torch/install/share/lua/5.1/nn/Sequential.lua:12: in function 'add' ./RNNInference.lua:68: in function '__init'

Can you please try to reproduce it?

I used this https://github.com/xuexue/SPEN fork to run the experiments, since it provided a helpful script. Wondering if denoising worked for xuexue.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/davidBelanger/SPEN/issues/4, or mute the thread https://github.com/notifications/unsubscribe-auth/ABH_qv6NSdz2QebCyL-9DYI4HS7T25QBks5rPPpGgaJpZM4Lbuav .

davidBelanger avatar Jan 05 '17 16:01 davidBelanger

Actually, I made the new code 'master.' The old code is released under the 0.1 tag.

On Thu, Jan 5, 2017 at 11:50 AM David Belanger [email protected] wrote:

OK. I just pushed a branch 'v2' to the SPEN repo. The internal code is substantially different, but the high-level stuff is the same. See Denoising.md for a quick start. Let me know if you have any questions. David

On Thu, Jan 5, 2017 at 9:32 AM David Belanger [email protected] wrote:

Hi Dmitry, Thanks for your interest in SPENs. inference_net should be a member of the problem object passed to the RNNInference constructor. See SPENDenoise.lua. The inference_net is the energy network that is learned (without the feature computation): This comment in RNNInference.lua explains the API of the inference_net: This takes {labels, features} and returns a single number per minibatch element--the energy network E_x(y)

I have a new version of the SPEN code that I am going to make public in the next few days. The code makes prototyping new applications substantially easier. I recommend switching to that. I'll let you know when I push it.

David

On Thu, Jan 5, 2017 at 9:12 AM Dmitry Ulyanov [email protected] wrote:

Hello David, I cannot get working SPEN denoising example. First I got an exception about inference_net being nil in RNNInference.lua, which I fixed somehow by setting inference_net = nn.Identity. But now I get an error because inference_net is nil:

2: attempt to index local 'module' (a nil value) stack traceback: ...e/dulyanov/torch/install/share/lua/5.1/nn/Sequential.lua:12: in function 'add' ./RNNInference.lua:68: in function '__init'

Can you please try to reproduce it?

I used this https://github.com/xuexue/SPEN fork to run the experiments, since it provided a helpful script. Wondering if denoising worked for xuexue.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/davidBelanger/SPEN/issues/4, or mute the thread https://github.com/notifications/unsubscribe-auth/ABH_qv6NSdz2QebCyL-9DYI4HS7T25QBks5rPPpGgaJpZM4Lbuav .

davidBelanger avatar Jan 05 '17 22:01 davidBelanger

Thank you David, I will give it a try today!

DmitryUlyanov avatar Jan 06 '17 09:01 DmitryUlyanov

By the way, any plans to make a standalone hypergrad for torch? It looks like you have everything for it.

DmitryUlyanov avatar Jan 06 '17 09:01 DmitryUlyanov

At a high level, hypergrad is very similar to what I'm doing, but the internals are quite different. They don't explicitly unroll a computation graph for gradient-based optimization, and they don't save snapshots of the weights and gradients at every intermediate iteration. In the backwards pass, when backpropagating through the gradient update for a certain timestep, they reconstruct what the weights and gradients would have been, by inverting the update rules for gradient descent with momentum. That's why they need to use momentum, and not plain gradient descent. The dynamics need to be 1-to-1.

I could have done this in my code, but it would have been more software engineering overhead. Also, the main motivation for doing their reversible dynamics trick is to support optimization with many timesteps. However, I'm not too interested in supporting this case, since it would result in very slow prediction times for each data case.

David

On Thu, Jan 5, 2017 at 5:19 PM David Belanger [email protected] wrote:

Actually, I made the new code 'master.' The old code is released under the 0.1 tag.

On Thu, Jan 5, 2017 at 11:50 AM David Belanger [email protected] wrote:

OK. I just pushed a branch 'v2' to the SPEN repo. The internal code is substantially different, but the high-level stuff is the same. See Denoising.md for a quick start. Let me know if you have any questions. David

On Thu, Jan 5, 2017 at 9:32 AM David Belanger [email protected] wrote:

Hi Dmitry, Thanks for your interest in SPENs. inference_net should be a member of the problem object passed to the RNNInference constructor. See SPENDenoise.lua. The inference_net is the energy network that is learned (without the feature computation): This comment in RNNInference.lua explains the API of the inference_net: This takes {labels, features} and returns a single number per minibatch element--the energy network E_x(y)

I have a new version of the SPEN code that I am going to make public in the next few days. The code makes prototyping new applications substantially easier. I recommend switching to that. I'll let you know when I push it.

David

On Thu, Jan 5, 2017 at 9:12 AM Dmitry Ulyanov [email protected] wrote:

Hello David, I cannot get working SPEN denoising example. First I got an exception about inference_net being nil in RNNInference.lua, which I fixed somehow by setting inference_net = nn.Identity. But now I get an error because inference_net is nil:

2: attempt to index local 'module' (a nil value) stack traceback: ...e/dulyanov/torch/install/share/lua/5.1/nn/Sequential.lua:12: in function 'add' ./RNNInference.lua:68: in function '__init'

Can you please try to reproduce it?

I used this https://github.com/xuexue/SPEN fork to run the experiments, since it provided a helpful script. Wondering if denoising worked for xuexue.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/davidBelanger/SPEN/issues/4, or mute the thread https://github.com/notifications/unsubscribe-auth/ABH_qv6NSdz2QebCyL-9DYI4HS7T25QBks5rPPpGgaJpZM4Lbuav .

davidBelanger avatar Jan 06 '17 13:01 davidBelanger

I am trying to run denoising example, I get a following error:

USING GPU 0
using cudnn
/home/dulyanov/torch/install/bin/luajit: cannot open <denoise-runs/Пт._янв.__6_16:37:09_MSK_2017/problem-config> in mode r  at /tmp/luarocks_torch-scm-1-9560/torch7/lib/TH/THDiskFile.c:668
stack traceback:
        [C]: at 0x7f8b2fb4dad0
        [C]: in function 'DiskFile'
        /home/dulyanov/torch/install/share/lua/5.1/torch/File.lua:405: in function 'load'
        main.lua:73: in function 'load_problem'
        main.lua:122: in main chunk
        [C]: in function 'dofile'
        ...anov/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
        [C]: at 0x00406670

Have no idea where to find this config. Did you forget to upload it?

DmitryUlyanov avatar Jan 06 '17 13:01 DmitryUlyanov

I just fixed a naming fix that should make it work. At the last minute, I had changed some naming stuff around. The problem_config gets populated in a call to denoise_cmd.sh Basically, it's hard to pass nested structures of command line options to th, so I make a separate lua call (using DenoiseOptions.lua) to populate options that are particular to the application. These get stored to file, and then are loaded as a lua table in main.lua.

On Fri, Jan 6, 2017 at 8:45 AM Dmitry Ulyanov [email protected] wrote:

I am trying to run denoising example, I get a following error:

USING GPU 0 using cudnn /home/dulyanov/torch/install/bin/luajit: cannot open <denoise-runs/Пт._янв.__6_16:37:09_MSK_2017/problem-config> in mode r at /tmp/luarocks_torch-scm-1-9560/torch7/lib/TH/THDiskFile.c:668 stack traceback: [C]: at 0x7f8b2fb4dad0 [C]: in function 'DiskFile' /home/dulyanov/torch/install/share/lua/5.1/torch/File.lua:405: in function 'load' main.lua:73: in function 'load_problem' main.lua:122: in main chunk [C]: in function 'dofile' ...anov/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk [C]: at 0x00406670

Have no idea where to find this config. Did you forget to upload it?

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/davidBelanger/SPEN/issues/4#issuecomment-270905796, or mute the thread https://github.com/notifications/unsubscribe-auth/ABH_qq70Yj52S_MZCGnY-DBcw2Hyvb4fks5rPkVogaJpZM4Lbuav .

davidBelanger avatar Jan 06 '17 13:01 davidBelanger

Thanks! It works!

DmitryUlyanov avatar Jan 06 '17 14:01 DmitryUlyanov

Cool. Also, the majority of my work has been some NLP applications, which aren't in the public repo. I haven't spent much time on the Denoising stuff. It's possible that the current denoising architecture, or various hyperparameters concerning the test-time optimization, will need to be changed.

On Fri, Jan 6, 2017 at 9:07 AM Dmitry Ulyanov [email protected] wrote:

Thanks! It works!

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/davidBelanger/SPEN/issues/4#issuecomment-270909476, or mute the thread https://github.com/notifications/unsubscribe-auth/ABH_quc9li1J-EQ0ZqIYLw9iGJgVNdq7ks5rPkqYgaJpZM4Lbuav .

davidBelanger avatar Jan 06 '17 14:01 davidBelanger