LuoweiZhou / e2e-gLSTM-sc

Code for paper "Image Caption Generation with Text-Conditional Semantic Attention"

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error while running both CPU or GPU mode

utsavgarg opened this issue · comments

/home/torch/install/bin/luajit: /home/torch/install/share/lua/5.1/nn/Linear.lua:66: size mismatch at /home/torch/extra/cutorch/lib/THC/THCTensorMathBlas.cu:90
stack traceback:
[C]: in function 'addmm'
/home/babu/torch/install/share/lua/5.1/nn/Linear.lua:66: in function 'func'
/home/babu/torch/install/share/lua/5.1/nngraph/gmodule.lua:345: in function 'neteval'
/home/babu/torch/install/share/lua/5.1/nngraph/gmodule.lua:380: in function 'forward'
./misc_new/LanguageModel.lua:277: in function 'sample'
eval_new.lua:135: in function 'eval_split'
eval_new.lua:173: in main chunk
[C]: in function 'dofile'
...babu/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
[C]: at 0x00406620

Please refer to the code for NeuralTalk2 to run the code.
It seems like a size mismatch issue, please check ./misc_new/LanguageModel.lua:277: in function 'sample' to debug your settings.

Best

I ran the NeuralTalk2 model and it runs fine.
The error is in ./misc_new/LanguageModel.lua:198: in function 'sample' where xt is being defined. Its giving a size of 2 1536 instead of 2 768.
What should I change in it so that it works fine ?

Yup, same error with VGG as the input CNN.

@LuoweiZhou i have the same error, neuraltalk2 works fine but this doesn't work
any help please

@utsavgarg Hi, sorry for the delay. Have you figured out the issues? It works fine for me when I train my model from scratch. It notes that the pre-trained model of NeuralTalk2 has 768 input states (LSTM) which might not be evaluated directly with our code. Also, we double the input size of LSTM to allow the text-conditional guidance, that's probably why the size of xt should be 1536 instead of 768.

@arunmallya Hi, what model did you use to evaluate?

@MironaGamil I assume you directly feed the NeuralTalk2 pre-trained model into the eval code which would not work since the LSTM input structure is not the same.

I trained from scratch using your code. Using the model saved after the first step, i tried to run the second step, which then failed giving the error above.

@arunmallya Just want to confirm. So, you got the error while fine-tuning the model? Or same as others while having the evaluation?

Yes, I got the error while training/fine-tuning.
I used the following commands:

  1. th train_new.lua -max_iters 250000 -finetune_cnn_after 100000
  2. th train_sc.lua -max_iters 150000 -start_from <model_of_step_2>.t7