Open macwiatrak opened 5 years ago
I have the same problem when trying to run deep_RL_game_ai/play.py It seems to be a change in torch.gather in new PyTorch version.
Update line 152 of dqn.py with : q2_max = q2_max.gather(1, q2_max_actions.unsqueeze(1))
(see https://discuss.pytorch.org/t/did-torch-gather-change-in-new-pytorch-version/547)
Thanks!
Hi there, I get running error when trying to run an agent, any tips on solving it?
Traceback (most recent call last): File "play.py", line 20, in
Game.fit_model()
File "/Users/maciejwiatrak/Deep-Reinforcement-learning-for-Gathering-game/deep_RL_game_ai/game/trainer.py", line 184, in fit_model
self.train_episode()
File "/Users/maciejwiatrak/Deep-Reinforcement-learning-for-Gathering-game/deep_RL_game_ai/game/trainer.py", line 151, in train_episode
self.move(agent, running, 1)
File "/Users/maciejwiatrak/Deep-Reinforcement-learning-for-Gathering-game/deep_RL_game_ai/game/trainer.py", line 108, in move
agent.learn(cur_reward, term)
File "/Users/maciejwiatrak/Deep-Reinforcement-learning-for-Gathering-game/deep_RL_gameai/agent/dqn.py", line 228, in learn
, delta = self.get_Q_update(state, action, reward, next_state, term, None)
File "/Users/maciejwiatrak/Deep-Reinforcement-learning-for-Gathering-game/deep_RL_game_ai/agent/dqn.py", line 152, in get_Q_update
q2_max = q2_max.gather(1, q2_max_actions)
RuntimeError: invalid argument 4: Index tensor must have same dimensions as input tensor at /Users/soumith/code/builder/wheel/pytorch-src/aten/src/TH/generic/THTensorMath.cpp:601