karpathy / neuraltalk2

Efficient Image Captioning code in Torch, runs on GPU
5.5k stars 1.26k forks source link

unknown Torch class <torch.CudaTensor> #129

Open bbhushan-ds opened 8 years ago

bbhushan-ds commented 8 years ago

while running NeuralTalk2 demo using the below command. I am getting error.

Command: th videocaptioning.lua -gpuid -1 -model ~/model_id1-501-1448236541.t7

opengl support available /home/.../torch/install/bin/luajit: /home/.../torch/install/share/lua/5.1/torch/File.lua:343: unknown Torch class stack traceback: [C]: in function 'error' /home/ptcuser/torch/install/share/lua/5.1/torch/File.lua:343: in function 'readObject' /home/ptcuser/torch/install/share/lua/5.1/torch/File.lua:369: in function 'readObject' /home/ptcuser/torch/install/share/lua/5.1/nn/Module.lua:158: in function 'read' /home/ptcuser/torch/install/share/lua/5.1/torch/File.lua:351: in function 'readObject' /home/ptcuser/torch/install/share/lua/5.1/torch/File.lua:369: in function 'readObject' /home/ptcuser/torch/install/share/lua/5.1/torch/File.lua:369: in function 'readObject' /home/ptcuser/torch/install/share/lua/5.1/torch/File.lua:409: in function 'load' videocaptioning.lua:74: in main chunk [C]: in function 'dofile' ...user/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk [C]: at 0x00406670

Thanks in Advance!!

chaonan99 commented 8 years ago

The model you use (model_id1-501-1448236541.t7) is a GPU model, but you run it with CPU mode (-gpuid -1). You can use convert_checkpoint_gpu_to_cpu.lua to replace CudaTensor with normal Tensor first.

clicman commented 7 years ago

Is it possible to convert model to CPU without GPU onboard? On my try it fails with

user@work-lpatop:~/sandbox/neuraltalk2$ luajit convert_checkpoint_gpu_to_cpu.lua -gpuid -1 -model ../model_id1-501-1448236541.t7 
NVIDIA: no NVIDIA devices found
THCudaCheck FAIL file=/tmp/luarocks_cutorch-scm-1-6930/cutorch/lib/THC/THCGeneral.c line=91 error=30 : unknown error
luajit: cuda runtime error (30) : unknown error at /tmp/luarocks_cutorch-scm-1-6930/cutorch/lib/THC/THCGeneral.c:91
stack traceback:
    [C]: at 0x7fbaf22e3d10
    [C]: in function 'require'
    .../sidochenko/torch/install/share/lua/5.1/cutorch/init.lua:2: in main chunk
    [C]: in function 'require'
    convert_checkpoint_gpu_to_cpu.lua:14: in main chunk
    [C]: at 0x00405d50
JiteshPshah commented 7 years ago

@chaonan99 How to I replace cuda tensor to normal tensor ?

himanshudce commented 6 years ago

just add -gpuid 1 at the end