sound-rnn
sound-rnn copied to clipboard
Generating samples from GPU-trained model
After running the sine example described in the README with -gpu_id 0 (so running with CUDA), attempts to generate samples with that model generates the error unknown Torch class <torch.CudaTensor>.
I tried adding require 'cunn' and require 'cutorch' to sample.lua, but that generates another error about invalid arguments to addmm.
Running Arch Linux 4.9.11-1 on x64 laptop. GPU is GTX 1060.
I should also note that I did not test with CPU-trained model because it runs significantly slower (about 2 seconds per 100 iterations on GPU vs 90 seconds on CPU).
Update: the issue is due to type-mismatches. CUDA tensors use float by default, whereas the normal torch tensor uses double. I hacked together a little python script to convert the model data to use torch.DoubleTensor instead of torch.CudaTensor, and the regeneration now works.
Perhaps the eventual solution is to add GPU support to sample.lua.
@quantumdude836: thanks for the update, hopefully a good pointer for anyone else who runs into this. I haven't looked at this project for a while, but PRs welcome if you get around to it :)
@quantumdude836 any chance of sharing your Python script or a pull request? :-)
I've uploaded the scripts at https://github.com/quantumdude836/sound-rnn-fixup