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

unknown Torch class <nn.LinearNoBias> #70

Open
ChenyuLInx opened this issue Aug 16, 2016 · 4 comments
Open

unknown Torch class <nn.LinearNoBias> #70

ChenyuLInx opened this issue Aug 16, 2016 · 4 comments

Comments

@ChenyuLInx
Copy link

When I try to use Threads with a lstm model, I met this when running the code.
Do anyone know why this happens?

Thanks for the reply in advance

@albanD
Copy link

albanD commented Aug 16, 2016

You get this error message because when receiving the data in the thread, it does not know what are the objects you are sending him. You should require all necessary libraries inside the threads before using them. You can easily do this in the initialization function when creating the thread pool (see doc here).

@ChenyuLInx
Copy link
Author

Thanks for the help.
Could you please tell me how to require a local file in the initialization function?
I got the lua script called util.lua. Require ‘util.lua’ works at the beginning of my main code. But this does not work in the initialization function. I added its path in the front but it still does not work. Here is the error I have.

/Users/chenyu/torch/install/bin/luajit: ...s/chenyu/torch/install/share/lua/5.1/threads/threads.lua:183: [thread 2 callback] parallel-train.lua:454: module '/Desktop/seq2seq-attn/data.lua' not found:
no field package.preload['
/Desktop/seq2seq-attn/data.lua']
no file './/Desktop/seq2seq-attn/data/lua.lua'
no file '/Users/chenyu/torch/install/share/luajit-2.1.0-beta1/
/Desktop/seq2seq-attn/data/lua.lua'
no file '/usr/local/share/lua/5.1//Desktop/seq2seq-attn/data/lua.lua'
no file '/usr/local/share/lua/5.1/
/Desktop/seq2seq-attn/data/lua/init.lua'
no file '/Users/chenyu/torch/install/share/lua/5.1//Desktop/seq2seq-attn/data/lua.lua'
no file '/Users/chenyu/torch/install/share/lua/5.1/
/Desktop/seq2seq-attn/data/lua/init.lua'
no file './/Desktop/seq2seq-attn/data/lua.so'
no file '/usr/local/lib/lua/5.1/
/Desktop/seq2seq-attn/data/lua.so'
no file '/Users/chenyu/torch/install/lib/lua/5.1//Desktop/seq2seq-attn/data/lua.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
no file './
/Desktop/seq2seq-attn/data.so'
no file '/usr/local/lib/lua/5.1//Desktop/seq2seq-attn/data.so'
no file '/Users/chenyu/torch/install/lib/lua/5.1/
/Desktop/seq2seq-attn/data.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
[C]: in function 'require'
parallel-train.lua:454: in function parallel-train.lua:451
[C]: in function 'xpcall'
...s/chenyu/torch/install/share/lua/5.1/threads/threads.lua:234: in function 'callback'
/Users/chenyu/torch/install/share/lua/5.1/threads/queue.lua:65: in function </Users/chenyu/torch/install/share/lua/5.1/threads/queue.lua:41>
[C]: in function 'pcall'
/Users/chenyu/torch/install/share/lua/5.1/threads/queue.lua:40: in function 'dojob'
[string " local Queue = require 'threads.queue'..."]:13: in main chunk
stack traceback:
[C]: in function 'error'
...s/chenyu/torch/install/share/lua/5.1/threads/threads.lua:183: in function 'dojob'
...s/chenyu/torch/install/share/lua/5.1/threads/threads.lua:264: in function 'synchronize'
...s/chenyu/torch/install/share/lua/5.1/threads/threads.lua:142: in function 'specific'
...s/chenyu/torch/install/share/lua/5.1/threads/threads.lua:125: in function 'Threads'
parallel-train.lua:450: in function 'train_batch'
parallel-train.lua:1132: in function 'train'
parallel-train.lua:1548: in function 'main'
parallel-train.lua:1554: in main chunk
[C]: in function ‘dofile'

Thanks,
Chenyu

On Aug 16, 2016, at 5:49 AM, albanD <[email protected]mailto:[email protected]> wrote:

You get this error message because when receiving the data in the thread, it does not know what are the objects you are sending him. You should require all necessary libraries inside the threads before using them. You can easily do this in the initialization function when creating the thread pool (see doc herehttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_torch_threads-23threadsthreadsnf1f2&d=CwMFaQ&c=imBPVzF25OnBgGmVOlcsiEgHoG1i6YHLR0Sj_gZ4adc&r=17sDuGpCLWOErAUEqb2yxA&m=ptaKEGx-VitM-aOOgbASIdLfSvUvaF6zOmzGoj1iowE&s=YPIO1ZJp8uE55nH7qk8pLfIL1OyHffk5Js8hPeGhKkQ&e=).


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_torch_threads_issues_70-23issuecomment-2D240057007&d=CwMFaQ&c=imBPVzF25OnBgGmVOlcsiEgHoG1i6YHLR0Sj_gZ4adc&r=17sDuGpCLWOErAUEqb2yxA&m=ptaKEGx-VitM-aOOgbASIdLfSvUvaF6zOmzGoj1iowE&s=H2odKDy994Nw7Leq6bBSNPGphHAF6_uViF5mMqQbNGw&e=, or mute the threadhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AQTQNI5Xd1QE6vVUgBd-2D9El9mXK0Llmhks5qgYfBgaJpZM4Jk-5FH1&d=CwMFaQ&c=imBPVzF25OnBgGmVOlcsiEgHoG1i6YHLR0Sj_gZ4adc&r=17sDuGpCLWOErAUEqb2yxA&m=ptaKEGx-VitM-aOOgbASIdLfSvUvaF6zOmzGoj1iowE&s=w8Ylo5atRVJi8ublzaRpYxfEZbhDzvvG0JBye4VESBA&e=.

@albanD
Copy link

albanD commented Aug 16, 2016

HI,

If the script is in the current directory, have you tried require('util') ? I think the .lua is appended automatically
Also when you provide a full path, you should not use ~/ but /home/username/.

@ChenyuLInx
Copy link
Author

That solved the problem perfectly.

Thanks for the help,
Chenyu

On Aug 16, 2016, at 10:52 AM, albanD <[email protected]mailto:[email protected]> wrote:

HI,

If the script is in the current directory, have you tried require('util') ? I think the .lua is appended automatically
Also when you provide a full path, you should not use ~/ but /home/username/.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_torch_threads_issues_70-23issuecomment-2D240126682&d=CwMCaQ&c=imBPVzF25OnBgGmVOlcsiEgHoG1i6YHLR0Sj_gZ4adc&r=17sDuGpCLWOErAUEqb2yxA&m=VRXcvH5BAxoxlV3jDdFVT9g-ZfyrhZntZyCWHws1KF8&s=8ZXIiPR6ZkO1BGPYCIWWM7ewpD6gBTxxFW53TqvI_7I&e=, or mute the threadhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AQTQNB6wDy1EyvX28iq-2DMcEFzVHsvi4Nks5qgc6rgaJpZM4Jk-5FH1&d=CwMCaQ&c=imBPVzF25OnBgGmVOlcsiEgHoG1i6YHLR0Sj_gZ4adc&r=17sDuGpCLWOErAUEqb2yxA&m=VRXcvH5BAxoxlV3jDdFVT9g-ZfyrhZntZyCWHws1KF8&s=NZHe-DOm9A5vgjU9gUQZPOkZ72TY9zcWyAym2qd5Tkc&e=.

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