Open joleeson opened 5 years ago
modify the code like following: action = q_value.max(1)[1].data[0] -> action = q_value.max(1)[1].item() losses.append(loss.data[0]) -> losses.append(loss.item())
it's works for me, and my PyTorch version is 1.0
modify the code like following: action = q_value.max(1)[1].data[0] ->
action = q_value.max(1)[1].item()
losses.append(loss.data[0]) ->losses.append(loss.item())
it's works for me, and my PyTorch version is 1.0
Hi kinghs, Many thanks for your reply.
For the benefit of other users who may or may not be familiar with PyTorch: I assume you made your suggested modification because Variables now "return tensors instead of variables". See the Pytorch 0.40 documentation on Variable (deprecated).
The issue was raised here: https://github.com/higgsfield/RL-Adventure/pull/20
It is also possible to create tensors as such state = torch.FloatTensor(state, device=device)
, but it appears the changes you mentioned are still necessary.
Hi, many thanks for sharing the code.
I have experienced an error running 1.dqn straight out of the box. The error message shown after I run the 12th cell of code is as shown below.
My computer is running with PyTorch 0.4.1, and I suspect that the error is due to a change in the "Variable" API (as used in cells 8 and 10 for example)? If so, has anyone updated the code for the latest PyTorch 0.4.1?
Any ideas would be appreciated! Thanks in advance!
Error message after cell 12: