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

unknown Torch class <torch.CudaTensor> #28

Closed
chrisnovello opened this issue Jul 27, 2016 · 2 comments
Closed

unknown Torch class <torch.CudaTensor> #28

chrisnovello opened this issue Jul 27, 2016 · 2 comments

Comments

@chrisnovello
Copy link

Hey - having some issues getting this running, would greatly appreciate some other eyes on this as I'm still young in my deep learning understanding.

It appears that I'm successfully able to generate checkpoints using
DATA_ROOT=500 dataset=folder gpu=1 th main.lua

I'm running a GTX 1080 with CUDA 8.0, and I get a folder full of checkpoints.

But when I try to run generate.lua, I get
"unknown Torch class <torch.CudaTensor>" errors.

Any thoughts? Here is what I'm seeing. Any tips would be majorly appreciated!

gpu=1 net=checkpoints/experiment1_10_net_G.t7 th generate.lua
{
  gpu : 1
  noisemode : "random"
  name : "generation1"
  noisetype : "normal"
  batchSize : 32
  net : "checkpoints/experiment1_10_net_G.t7"
  imsize : 1
  nz : 100
  display : 1
}
/root/torch/install/bin/luajit: /root/torch/install/share/lua/5.1/torch/File.lua:343: unknown Torch class <torch.CudaTensor>
stack traceback:
    [C]: in function 'error'
    /root/torch/install/share/lua/5.1/torch/File.lua:343: in function 'readObject'
    /root/torch/install/share/lua/5.1/torch/File.lua:369: in function 'readObject'
    /root/torch/install/share/lua/5.1/nn/Module.lua:158: in function 'read'
    /root/torch/install/share/lua/5.1/torch/File.lua:351: in function 'readObject'
    /root/torch/install/share/lua/5.1/torch/File.lua:409: in function 'load'
    generate.lua:24: in main chunk
    [C]: in function 'dofile'
    /root/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
    [C]: at 0x00406670

@Guim3
Copy link

Guim3 commented Jul 27, 2016

This happened to me, too. The code is loading the generator which is stored as a cuda tensor before importing cunn and cudnn, so it doesn't recognize cuda tensors.
Just add this after opt is initialized:

if opt.gpu > 0 then
  require 'cunn'
  require 'cudnn'
end

Also, this means that after this last commit e057802, you can't load a network in CPU if it was stored in GPU. This could be done with the util.save function which was erased in the mentioned commit.

@chrisnovello
Copy link
Author

Thanks!! That did the trick!!!

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