ketranm / neuralHMM

code for unsupervised learning Neural Hidden Markov Models paper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Running on CPU - Invalid arguments:DoubleTensor ByteTensor

createmomo opened this issue · comments

Hi,

I am running the model on my own laptop using CPU. However, I encountered the error. Probably it is the compatibility between using CPU and GPU?

(I did not install cudnn.torch, because for now, I don't have GPUs to train)

/home/*/torch/install/bin/luajit: ./BaumWelch.lua:146: invalid arguments: DoubleTensor ByteTensor
expected arguments: DoubleTensor [DoubleTensor] DoubleTensor
stack traceback:
[C]: in function 'cmul'
./BaumWelch.lua:146: in function 'run'
main.lua:160: in function 'train'
main.lua:300: in main chunk
[C]: in function 'dofile'
...olin/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x00406670

Please find more details below:

Command:
th main.lua -datapath ../wsj -nstates 45 -niters 20 -hidsize 512 -mnbz 256 -nloops 6 -maxlen 81 -nlayers 3 -modelpath ../save -model noextra

Output:
{
hidsize : 512
output : "../data/pred.txt"
cuda : false
max_word_len : 15
model : "noextra"
max_norm : 5
niters : 20
nstates : 45
debug : false
maxlen : 81
kernels :
{
1 : 1
2 : 2
3 : 3
4 : 4
5 : 5
6 : 6
7 : 7
}
nlayers : 3
nloops : 6
feature_maps :
{
1 : 50
2 : 100
3 : 128
4 : 128
5 : 128
6 : 128
7 : 128
}
charsize : 15
report_every : 10
maxchars : 15
modelpath : "../save"
datapath : "../wsj"
input : ""
lstm : false
dropout : 0.5
mnbz : 256
vocabsize : -1
conv : false
}
run preprocessing
use all words!
vocabulary size: 19160
create networks
use Feed-forward Emission Model
/home/*/torch/install/bin/luajit: ./BaumWelch.lua:146: invalid arguments: DoubleTensor ByteTensor
expected arguments: DoubleTensor [DoubleTensor] DoubleTensor
stack traceback:
[C]: in function 'cmul'
./BaumWelch.lua:146: in function 'run'
main.lua:160: in function 'train'
main.lua:300: in main chunk
[C]: in function 'dofile'
...olin/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x00406670

Hi,
I fixed the bug. Basically, the masked variable needs to be converted to double.

Thank you very much! Now it runs very well!