Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(wzl): fix vdn mixer to avoid Q value dim mismatch with reward #13

Open
wants to merge 1 commit into
base: release
Choose a base branch
from

Conversation

zerlinwang
Copy link

command

./train_mpe_vdn.sh

problem

Traceback (most recent call last):
File "train/train_mpe.py", line 192, in
main(sys.argv[1:])
File "train/train_mpe.py", line 177, in main
total_num_steps = runner.run()
File "/home/zerlinwang/Projects/off-policy/offpolicy/runner/rnn/base_runner.py", line 190, in run
self.train()
File "/home/zerlinwang/Projects/off-policy/offpolicy/runner/rnn/base_runner.py", line 272, in batch_train_q
train_info, new_priorities, idxes = self.trainer.train_policy_on_batch(sample)
File "/home/zerlinwang/Projects/off-policy/offpolicy/algorithms/qmix/qmix.py", line 164, in train_policy_on_batch
Q_tot_target_seq = rewards + (1 - dones_env_batch) * self.args.gamma * next_step_Q_tot_seq
RuntimeError: The size of tensor a (32) must match the size of tensor b (800) at non-singleton dimension 1

reason

next_step_Q_tot_seq dim error

solution

return agent_q_inps.sum(dim=-1).view(-1, 1, 1)
->
batch_size = agent_q_inps.size(1)
return agent_q_inps.sum(dim=-1).view(-1, batch_size, 1, 1)

result

图片

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant