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
I use Py-THUMT as the framework of new NMT algorithm. I only replace Transformer with another module and other parts remain unchanged. I use THUMT add_name() to add parameters to variables pool. When I run the code, I encount the following error. I don't know what reason cause the error. Would you give me some advice?
Traceback (most recent call last):
File "../neuron/thumt/bin/trainer.py", line 528, in
cli_main()
File "../neuron/thumt/bin/trainer.py", line 524, in cli_main
process_fn(0, parsed_args)
File "../neuron/thumt/bin/trainer.py", line 502, in process_fn
main(local_args)
File "../neuron/thumt/bin/trainer.py", line 467, in main
optimizer.apply_gradients(grads_and_vars)
File "/data/code/nmt/neuron/thumt/optimizers/optimizers.py", line 480, in apply_gradients
self.optimizer.apply_gradients(zip(grads, var_list))
File "/data/code/nmt/neuron/thumt/optimizers/optimizers.py", line 231, in apply_gradients
m.mul(beta_1).add_(grad, alpha=1 - beta_1)
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
The text was updated successfully, but these errors were encountered:
This bug is caused by tensors defined by torch.FloatTensor(), while all tensors in the original framework are defined by torch.Tensor(). Why this happens is unknown.
I use Py-THUMT as the framework of new NMT algorithm. I only replace Transformer with another module and other parts remain unchanged. I use THUMT add_name() to add parameters to variables pool. When I run the code, I encount the following error. I don't know what reason cause the error. Would you give me some advice?
Traceback (most recent call last):
File "../neuron/thumt/bin/trainer.py", line 528, in
cli_main()
File "../neuron/thumt/bin/trainer.py", line 524, in cli_main
process_fn(0, parsed_args)
File "../neuron/thumt/bin/trainer.py", line 502, in process_fn
main(local_args)
File "../neuron/thumt/bin/trainer.py", line 467, in main
optimizer.apply_gradients(grads_and_vars)
File "/data/code/nmt/neuron/thumt/optimizers/optimizers.py", line 480, in apply_gradients
self.optimizer.apply_gradients(zip(grads, var_list))
File "/data/code/nmt/neuron/thumt/optimizers/optimizers.py", line 231, in apply_gradients
m.mul(beta_1).add_(grad, alpha=1 - beta_1)
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
The text was updated successfully, but these errors were encountered: