OpenNMT tagger (CUDA -> CPU) release model


(Rickychanhoyin) #1

Hi,

I am running sequence to sequence tagging. When I train the model with GPU using CUDA, and then release the model with tools/release_model.lua , the resulting model can’t be run with e.g. tag.lua using CPU only. I take a look of the release binary and find that there are 2 torch.CudaTensor items inside and 1 torch.CudaStorage item inside (this doesn’t happened to release model trained for translation purpose instead of tagging) , may I know how to fix it ?

/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:192: 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:369: in function ‘readObject’
/root/torch/install/share/lua/5.1/torch/File.lua:369: in function ‘readObject’
/root/torch/install/share/lua/5.1/torch/File.lua:409: in function ‘load’
./onmt/tagger/Tagger.lua:28: in function ‘__init’
/root/torch/install/share/lua/5.1/torch/init.lua:91: in function 'new’
tag.lua:41: in function 'main’
tag.lua:125: in main chunk
[C]: in function ‘dofile’
/root/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x00405d50

Thanks,

Chan


(Guillaume Klein) #2

Hello,

Could you open an issue on GitHub? I confirm this is an actual bug.

Thanks.


(Guillaume Klein) #3

The GitHub issue for reference: