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

An error in BinaryNet_SVHN_Model.lua #8

Closed
kwakai3 opened this issue Jun 16, 2016 · 2 comments
Closed

An error in BinaryNet_SVHN_Model.lua #8

kwakai3 opened this issue Jun 16, 2016 · 2 comments

Comments

@kwakai3
Copy link

kwakai3 commented Jun 16, 2016

I attempted to execute the BinaryNet_SVHN.lua but got an error "bad argument #4 to '?' (cannot convert 'int *' to 'int')" as follows. Re-install of nn, cutorch, cunn and cudnn did not work. Do you have any suggestions?
Thank you in advance for your cooperation.

BinaryNet user$ th Main_BinaryNet_SVHN.lua -network BinaryNet_SVHN_Model
sh: mk1ir: command not found
0
6406494
6397632
6406494
/Users/user/BinaryNet/PreProcData/SVHN/rgbGCN_LCN_valid.t7
applying GCN preprocessing
[================== 598388/598388 ============>]ETA: 0ms | Step: 0ms
applying LeCunLCN preprocessing
[================== 598388/598388 ============>]ETA: 0ms | Step: 0ms
applying GCN preprocessing
[================== 6000/6000 ================>]ETA: 0ms | Step: 0ms
applying LeCunLCN preprocessing
[================== 6000/6000 ================>]ETA: 0ms | Step: 0ms
applying GCN preprocessing
[================== 26032/26032 ==============>]ETA: 0ms | Step: 0ms
applying LeCunLCN preprocessing
[================== 26032/26032 ==============>]ETA: 0ms | Step: 0ms
[program started on Fri Jun 17 05:39:50 2016]
[command line arguments]
stcWeights false
LR 0.0078125
modelsFolder ./Models/
batchSize 200
optimization adam
preProcDir /Users/user/BinaryNet/PreProcData/SVHN
network ./Models/BinaryNet_SVHN_Model
stcNeurons true
constBatchSize false
LRDecay 0
whiten false
augment false
load
nGPU 1
dp_prepro true
format rgb
save /Users/user/BinaryNet/Results/FriJun1705:33:592016
dataset SVHN
normalization simple
devid 1
visualize 1
type cuda
threads 8
SBN true
momentum 0
weightDecay 0
runningVal true
epoch -1
[----------------------]
==> Network
nn.Sequential {
input -> (1) -> (2) -> (3) -> (4) -> (5) -> (6) -> (7) -> (8) -> (9) -> (10) -> (11) -> (12) -> (13) -> (14) -> (15) -> (16) -> (17) -> (18) -> (19) -> (20) -> (21) -> (22) -> (23) -> (24) -> (25) -> (26) -> (27) -> (28) -> (29) -> (30) -> (31) -> (32) -> (33) -> (34) -> (35) -> (36) -> (37) -> (38) -> output: cudnnBinarySpatialConvolution(3 -> 64, 3x3, 1,1, 1,1)
(2): SpatialBatchNormalizationShiftPow2
(3): nn.HardTanh
(4): BinarizedNeurons
(5): cudnnBinarySpatialConvolution(64 -> 64, 3x3, 1,1, 1,1)
(6): cudnn.SpatialMaxPooling(2x2, 2,2)
(7): SpatialBatchNormalizationShiftPow2
(8): nn.HardTanh
(9): BinarizedNeurons
(10): cudnnBinarySpatialConvolution(64 -> 128, 3x3, 1,1, 1,1)
(11): SpatialBatchNormalizationShiftPow2
(12): nn.HardTanh
(13): BinarizedNeurons
(14): cudnnBinarySpatialConvolution(128 -> 128, 3x3, 1,1, 1,1)
(15): cudnn.SpatialMaxPooling(2x2, 2,2)
(16): SpatialBatchNormalizationShiftPow2
(17): nn.HardTanh
(18): BinarizedNeurons
(19): cudnnBinarySpatialConvolution(128 -> 256, 3x3, 1,1, 1,1)
(20): SpatialBatchNormalizationShiftPow2
(21): nn.HardTanh
(22): BinarizedNeurons
(23): cudnnBinarySpatialConvolution(256 -> 256, 3x3, 1,1, 1,1)
(24): cudnn.SpatialMaxPooling(2x2, 2,2)
(25): SpatialBatchNormalizationShiftPow2
(26): nn.HardTanh
(27): BinarizedNeurons
(28): nn.View(4096)
(29): BinaryLinear(4096 -> 1024)
(30): BatchNormalizationShiftPow2
(31): nn.HardTanh
(32): BinarizedNeurons
(33): BinaryLinear(1024 -> 1024)
(34): BatchNormalizationShiftPow2
(35): nn.HardTanh
(36): BinarizedNeurons
(37): BinaryLinear(1024 -> 10)
(38): nn.BatchNormalization
}
==>6406494 Parameters
==> Loss
SqrtHingeEmbeddingCriterion

==> Starting Training

Epoch 1
/Users/user/torch/install/bin/luajit: /Users/user/torch/install/share/lua/5.1/nn/Container.lua:67:
In 1 module of nn.Sequential:
/Users/user/torch/install/share/lua/5.1/cudnn/init.lua:55: bad argument #4 to '?' (cannot convert 'int *' to 'int')
stack traceback:
[builtin#173]: at 0x0107d55450
/Users/user/torch/install/share/lua/5.1/cudnn/init.lua:55: in function 'errcheck'
.../user/BinaryNet/Models/cudnnBinarySpatialConvolution.lua:71: in function 'resetWeightDescriptors'
...torch/install/share/lua/5.1/cudnn/SpatialConvolution.lua:364: in function 'updateOutput'
.../user/BinaryNet/Models/cudnnBinarySpatialConvolution.lua:146: in function <.../user/BinaryNet/Models/cudnnBinarySpatialConvolution.lua:142>
[C]: in function 'xpcall'
/Users/user/torch/install/share/lua/5.1/nn/Container.lua:63: in function 'rethrowErrors'
/Users/user/torch/install/share/lua/5.1/nn/Sequential.lua:44: in function 'forward'
Main_BinaryNet_SVHN.lua:215: in function 'Train'
Main_BinaryNet_SVHN.lua:279: in main chunk
[C]: in function 'dofile'
...user/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:131: in main chunk
[C]: at 0x0107cd61a0

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'
/Users/user/torch/install/share/lua/5.1/nn/Container.lua:67: in function 'rethrowErrors'
/Users/user/torch/install/share/lua/5.1/nn/Sequential.lua:44: in function 'forward'
Main_BinaryNet_SVHN.lua:215: in function 'Train'
Main_BinaryNet_SVHN.lua:279: in main chunk
[C]: in function 'dofile'
...user/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:131: in main chunk
[C]: at 0x0107cd61a0

@kwakai3
Copy link
Author

kwakai3 commented Jun 17, 2016

I could fix the error by modification of cudnnBinarySpatialConvolution.lua as follows.

Lines 71 to 73:
Original
errcheck('cudnnSetFilterNdDescriptor', self.weightDesc[0],
'CUDNN_DATA_FLOAT', 4,
desc:data());

Modified
errcheck('cudnnSetFilterNdDescriptor', self.weightDesc[0],
'CUDNN_DATA_FLOAT', 'CUDNN_TENSOR_NCHW', 4,
desc:data());

@MinLiAmoy
Copy link

same error occurs when using "nn" library on CPU, but BinarySpatialConvolution.lua doesn't have such errcheck code. How to modify it?
the error is shown below:
Epoch 1
/home/ml/torch/install/bin/luajit: /home/ml/torch/install/share/lua/5.1/nn/Container.lua:67:
In 23 module of nn.Sequential:
/home/ml/torch/install/share/lua/5.1/nn/THNN.lua:110: bad argument #8 to 'v' (cannot convert 'struct THFloatTensor *' to 'int')
stack traceback:
[C]: in function 'v'
/home/ml/torch/install/share/lua/5.1/nn/THNN.lua:110: in function 'SpatialConvolutionMM_updateGradInput'
...CLA/work/BinaryNet-1/Models/BinarySpatialConvolution.lua:150: in function 'updateGradInput'
/home/ml/torch/install/share/lua/5.1/nn/Module.lua:31: in function </home/ml/torch/install/share/lua/5.1/nn/Module.lua:29>
[C]: in function 'xpcall'
/home/ml/torch/install/share/lua/5.1/nn/Container.lua:63: in function 'rethrowErrors'
/home/ml/torch/install/share/lua/5.1/nn/Sequential.lua:84: in function 'backward'
Main_BinaryNet_Cifar10.lua:227: in function 'opfunc'
./adaMax_binary_clip_shift.lua:38: in function 'adaMax_binary_clip_shift'
Main_BinaryNet_Cifar10.lua:231: in function 'Train'
Main_BinaryNet_Cifar10.lua:270: in main chunk
[C]: in function 'dofile'
...e/ml/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x00405d50

WARNING: If you see a stack trace below, it doesn't point to the place where this error occurred. Please use only the one above.
stack traceback:
[C]: in function 'error'
/home/ml/torch/install/share/lua/5.1/nn/Container.lua:67: in function 'rethrowErrors'
/home/ml/torch/install/share/lua/5.1/nn/Sequential.lua:84: in function 'backward'
Main_BinaryNet_Cifar10.lua:227: in function 'opfunc'
./adaMax_binary_clip_shift.lua:38: in function 'adaMax_binary_clip_shift'
Main_BinaryNet_Cifar10.lua:231: in function 'Train'
Main_BinaryNet_Cifar10.lua:270: in main chunk
[C]: in function 'dofile'
...e/ml/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x00405d50

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