jcjohnson / densecap

Dense image captioning in Torch
MIT License
1.58k stars 432 forks source link

Does cnDNN version need 5? #27

Closed PPeiMi closed 8 years ago

PPeiMi commented 8 years ago

As I'm following the Installation guide, and going to train with GPU after install cuDNN. But there are some bugs:

[/home/PPeiMi/densecap-master] 10:06
$ ./../torch/install/bin/th train.lua -data_h5 output.HDF5 -data_json output.json -gpu 2
{
  finetune_cnn_after : -1
  weight_decay : 1e-06
  optim_beta2 : 0.999
  val_images_use : 1000
  timing : false
  optim_epsilon : 1e-08
  test_num_proposals : 1000
  input_encoding_size : 512
  losses_log_every : 10
  id : ""
  gpu : 2
  drop_prob : 0.5
  data_json : "output.json"
  clip_final_boxes : 1
  sampler_batch_size : 256
  rnn_size : 512
  test_rpn_nms_thresh : 0.7
  progress_dump_every : 100
  optim_beta1 : 0.9
  end_objectness_weight : 0.1
  seed : 123
  test_final_nms_thresh : 0.3
  eval_first_iteration : 0
  captioning_weight : 1
  checkpoint_start_from : ""
  sampler_high_thresh : 0.7
  mid_objectness_weight : 0.1
  data_h5 : "output.HDF5"
  train_remove_outbounds_boxes : 1
  sampler_low_thresh : 0.3
  debug_max_train_images : -1
  learning_rate : 1e-05
  rpn_hidden_dim : 512
  max_iters : -1
  checkpoint_path : "checkpoint.t7"
  save_checkpoint_every : 10000
  end_box_reg_weight : 0.1
  proposal_regions_h5 : ""
  backend : "cudnn"
  mid_box_reg_weight : 0.05
  box_reg_decay : 5e-05
}
nil 
/home/PPeiMi/torch/install/bin/luajit: /home/PPeiMi/torch/install/share/lua/5.1/trepl/init.lua:384: /home/PPeiMi/torch/install/share/lua/5.1/trepl/init.lua:384: /home/PPeiMi/.luarocks/share/lua/5.1/cudnn/ffi.lua:1598: 'libcudnn (R5) not found in library path.
Please install CuDNN from https://developer.nvidia.com/cuDNN
Then make sure files named as libcudnn.so.5 or libcudnn.5.dylib are placed in your library load path (for example /usr/local/lib , or manually add a path to LD_LIBRARY_PATH)

stack traceback:
    [C]: in function 'error'
    /home/PPeiMi/torch/install/share/lua/5.1/trepl/init.lua:384: in function 'require'
    train.lua:35: in main chunk
    [C]: in function 'dofile'
    ...eiMi/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
    [C]: at 0x00405840

It says the version of cuDNN needs to be version 5. In the CUDA website, the cuDNN v5 according to CUDA 7.5, however, my CUDA version is only 7.0. Do I have to update my CUDA, or is there any method that can fix this problem?

jcjohnson commented 8 years ago

If you don't want to update your CUDA then you'll have to stick with cuDNN v4; if you want to do that then you can install the cuDNN v4 Torch bindings like this:

luarocks install https://raw.githubusercontent.com/soumith/cudnn.torch/R4/cudnn-scm-1.rockspec
PPeiMi commented 8 years ago

Hi @jcjohnson , I installed cuDNN v4, but there is still the same error. Is there anything I must do?

jcjohnson commented 8 years ago

Installing cuDNN requires two steps:

(1) Download the cuDNN v4 library from the NVIDIA website and copy the libraries to /usr/local/cuda/lib64

(2) Run the luarocks command above to install the Torch bindings for cuDNN v4.

I suspect maybe you did step (2) but not step (1)?

PPeiMi commented 8 years ago

@jcjohnson thank you. I follow the guide here (Step 6: Install cuDNN): neural-style Installation, but still have this error. The only change as I know is that, I installed torch in my own home path, not the system path. Does that matter?

jcjohnson commented 8 years ago

That guide is a little outdated (I need to update it) - the line

luarocks install cudnn

will install the Torch bindings for cuDNN v5, which won't work if you want to use cuDNN v4. Instead you need to do:

luarocks install https://raw.githubusercontent.com/soumith/cudnn.torch/R4/cudnn-scm-1.rockspec

If you are still seeing the error after this, then try

``bash ls /usr/local/cuda/lib64/cudnn


You should see a file named libcudnn.so.4.
PPeiMi commented 8 years ago

My libcudnn.so.4 is in /usr/local/cuda/lib64.

PPeiMi commented 8 years ago

I solved this by: cd /usr/local/cuda/lib64;export LD_LIBRARY_PATH=pwd:$LD_LIBRARY_PATH Thank you! :)