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

There is a bug in def central_value_function(self, state, opponent_actions=None) in cc_mlp.py and needs to be modified. #200

Open
Maxwell-R opened this issue Nov 14, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@Maxwell-R
Copy link

If you use MultiDiscrete in Gym as the action space class, and use the mappo algorithm, an error will occur:

File "D:\anaconda3\envs\ray\lib\site-packages\marllib\marl\models\zoo\mlp\cc_mlp.py", line 125, in central_value_function
x = torch.cat([x.reshape(B, -1)] + opponent_actions_ls, 1)
RuntimeError: Tensors must have same number of dimensions: got 2 and 3

This is because the MultiDiscrete situation is not handled in def central_value_function(self, state, opponent_actions=None) of cc_mlp.py, resulting in different dimensions between opponent_actions_ls and [x.reshape(B, -1)].

======
如果使用Gym的MultiDiscrete作为行动空间,同时使用MAPPO类的算法(用了cc_mlp.py的算法都会出现问题)将会出现报错:
File "D:\anaconda3\envs\ray\lib\site-packages\marllib\marl\models\zoo\mlp\cc_mlp.py", line 125, in central_value_function
x = torch.cat([x.reshape(B, -1)] + opponent_actions_ls, 1)
RuntimeError: Tensors must have same number of dimensions: got 2 and 3

这是因为在cc_mlp.py文件里的def central_value_function(self, state, opponent_actions=None)函数中没有考虑MultiDiscrete作为动作空间的情况,从而使拼接时维数不兼容。请加上MultiDiscrete情况下opponent_actions_ls的计算结果。

@Theohhhu Theohhhu self-assigned this Dec 3, 2023
@Theohhhu Theohhhu added the bug Something isn't working label Dec 3, 2023
@Theohhhu
Copy link
Collaborator

Theohhhu commented Dec 3, 2023

Thank you for bringing this to our attention. We are currently investigating the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants