fatchord/WaveRNN

Tensor CPU issue

ayunus22198 opened this issue · 3 comments

i am trying to run on gpu using google colab. I get this error: File "/usr/local/lib/python3.6/dist-packages/torch/tensor.py", line 492, in array
return self.numpy()
TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.

I had the same problem when running train_wavernn.py.
In my case it was solved by changing line 129 in voc_train_loop function to

if np.isnan(grad_norm.cpu()):
Covac commented

You can also change self.numpy() to self.cpu().numpy() in tensor.py

You can also use if torch.isnan(grad_norm):