You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When running the gan.py script with the only change in script
trainer = pl.Trainer(max_nb_epochs=10, gpus=1, distributed_backend='dp')
or with gpus=[0]
script fails with error on the loss function not being on GPU
File "/home/marko/anaconda2/envs/py36_torch13/lib/python3.6/site-packages/torch/nn/modules/module.py", line 541, in call
result = self.forward(*input, **kwargs)
File "/home/marko/anaconda2/envs/py36_torch13/lib/python3.6/site-packages/pytorch_lightning/pt_overrides/override_data_parallel.py", line 58, in forward
return self.module.training_step(*inputs[0], **kwargs[0])
File "gan.py", line 116, in training_step
g_loss = self.adversarial_loss(self.discriminator(self.generated_imgs), valid)
File "gan.py", line 89, in adversarial_loss
return F.binary_cross_entropy(y_hat, y)
File "/home/marko/anaconda2/envs/py36_torch13/lib/python3.6/site-packages/torch/nn/functional.py", line 2065, in binary_cross_entropy
input, target, weight, reduction_enum)
RuntimeError: Expected object of device type cuda but got device type cpu for argument #2 'target' in call to _thnn_binary_cross_entropy_forward
Epoch 1: 0%| | 0/938 [00:00<?, ?batch/s]
To Reproduce
Steps to reproduce the behavior:
Go to gan.py
Change the trainer= pl.Trainer() to above on a GPU system
Expected behavior
A clear and concise description of what you expected to happen.
Desktop (please complete the following information):
OS: Ubuntu 16.04
The text was updated successfully, but these errors were encountered:
Common bugs:
Describe the bug
When running the gan.py script with the only change in script
trainer = pl.Trainer(max_nb_epochs=10, gpus=1, distributed_backend='dp')
or with gpus=[0]
script fails with error on the loss function not being on GPU
File "/home/marko/anaconda2/envs/py36_torch13/lib/python3.6/site-packages/torch/nn/modules/module.py", line 541, in call
result = self.forward(*input, **kwargs)
File "/home/marko/anaconda2/envs/py36_torch13/lib/python3.6/site-packages/pytorch_lightning/pt_overrides/override_data_parallel.py", line 58, in forward
return self.module.training_step(*inputs[0], **kwargs[0])
File "gan.py", line 116, in training_step
g_loss = self.adversarial_loss(self.discriminator(self.generated_imgs), valid)
File "gan.py", line 89, in adversarial_loss
return F.binary_cross_entropy(y_hat, y)
File "/home/marko/anaconda2/envs/py36_torch13/lib/python3.6/site-packages/torch/nn/functional.py", line 2065, in binary_cross_entropy
input, target, weight, reduction_enum)
RuntimeError: Expected object of device type cuda but got device type cpu for argument #2 'target' in call to _thnn_binary_cross_entropy_forward
Epoch 1: 0%| | 0/938 [00:00<?, ?batch/s]
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: