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

nil value #42

Closed
zhuyating opened this issue Jul 20, 2019 · 8 comments
Closed

nil value #42

zhuyating opened this issue Jul 20, 2019 · 8 comments

Comments

@zhuyating
Copy link

Hey,Thank you for your shared code.I have modified the opts.lua:
cmd:option('-threads', 0, 'number of main threads')
cmd:option('-nDonkeys', 0, 'number of donkeys to initialize (data loading threads)')
And I got an error when make this command: th main.lua -nEpochs 451 -save scale3

the error is :
epoch begins : 1
==> training!
==> doing epoch on training data:
==> online epoch # 1 [mini-batchSize = 1]
/home/username/torch/install/bin/lua: train.lua:259: attempt to call field 'log10' (a nil value)
stack traceback:
train.lua:259: in function 'cumulate_error'
train.lua:283: in function 'f2'
data.lua:117: in function 'addjob'
train.lua:275: in function 'train'
main.lua:89: in main chunk
[C]: in function 'dofile'
...name/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: in ?

the error mentioned above is located in train.lua:259: cPSNR = cPSNR - 10math.log10(mse),
I rewrote it as cPSNR = cPSNR - 10
math.log10(math.abs(mse)+0.01),but makes no difference.
Could you help me for this problem?Thank you very much.

@SeungjunNah
Copy link
Owner

Hi @zhuyating,
Did you install torch correctly?
'math' package should have no problem calling math.log10
Could you check if the following code runs smoothly?
Otherwise, you will need to fix or reinstall torch.

require 'math'
val = 5
val2 = math.log10(val)
print('math.log10(' .. val .. ') = ' .. val2)

@zhuyating
Copy link
Author

Thank you for your reply.I have installed torch corretly like you mentioned before:
require 'cutorch'
require 'nn'
require 'cunn'
require 'cudnn'

But still got this error when running your code above :

/home/username/torch/install/bin/lua: torch.lua:3: attempt to call field 'log10' (a nil value)
stack traceback:
torch.lua:3: in main chunk
[C]: in function 'dofile'
...name/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: in ?

Is there any problem with my cuda or cudnn?I use cuda-9.2 and cudnn7,is it compatible with torch?But I have tried this command below,and it runs smoothly:
cd ~/torch/extra/cudnn
git checkout R6 # replace with a specefic version you would like
luarocks make

But still have the error with math.log10.Do you have another suggestion?Thank you so much.

@zhuyating
Copy link
Author

By the way ,I installed torch with Lua 5.2 instead of LuaJIT.

@zhuyating
Copy link
Author

I use ubuntu16.04.It is said that torch7 is not compatible with cuda9.2,is it wright?Should I use cuda8.x?

@SeungjunNah
Copy link
Owner

I never had problems with math.log10, I don't really know what the main problem could be.
I always used luajit and it might be the problem, but I'm not sure.

Regarding cuda version, torch7 hasn't been maintained for a while and it doesn't support cuda 9.2
I believe cuda 9.0 is the latest one you can use by setting an environment variable.
You may want to look at this issue
I usually put cudnn files in the cuda installation directory so that $LD_LIBRARY_PATH finds it together with cuda.

export TORCH_NVCC_FLAGS="-D__CUDA_NO_HALF_OPERATORS__"
./install.sh

# after installation is complete
cd ~/torch/extra/cudnn
git checkout R6 # replace with the version you installed in $LD_LIBRARY_PATH
luarocks make

@zhuyating
Copy link
Author

Thanks for your kind help.I will have a try.

@SeungjunNah
Copy link
Owner

PyTorch version now available here: https://github.com/SeungjunNah/DeepDeblur-PyTorch

@zhuyating
Copy link
Author

Hi @zhuyating,
Did you install torch correctly?
'math' package should have no problem calling math.log10
Could you check if the following code runs smoothly?
Otherwise, you will need to fix or reinstall torch.

require 'math'
val = 5
val2 = math.log10(val)
print('math.log10(' .. val .. ') = ' .. val2)

Thank you very much! I will have a try.

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