Theohhhu / UPDeT

Official Implementation of 'UPDeT: Universal Multi-agent Reinforcement Learning via Policy Decoupling with Transformers' ICLR 2021(spotlight)
MIT License
129 stars 17 forks source link

代码调试问题 #10

Closed ouyangshixiong closed 3 years ago

ouyangshixiong commented 3 years ago

我尝试debug您的代码。 1.VSCode配置(无法配置README.md 里面要求的参数:_with env_args.map_name=5m_vs6m):

{  
    "version": "0.2.0",  
    "configurations": [  
        {  
            "name": "Python: Current File",   
            "type": "python",  
            "request": "launch",   
            "program": "${file}",  
            "console": "integratedTerminal",  
            "args": ["--config=qmix", "--env-config=sc2"]  
        }  
    ]  
}  

2.使用CPU运行 3.发现basic_controller.py的方法_build_inputs_transformer有数组尺寸错误问题:

arranged_obs.size()  
torch.Size([1, 3, 30])  

显然,arranged_obs摊平的尺寸为90。 下面这行代码试图把它的尺寸修改为(-1,11,5) reshaped_obs = arranged_obs.view(-1, 1 + (self.args.enemy_num - 1) + self.args.ally_num, self.args.token_dim) 这显然是不行的,麻烦您抽空帮忙解答。截图如下 Screenshot from 2021-09-17 11-27-20

Theohhhu commented 3 years ago

Please do not include the 'obs_agent_id' and 'obs_last_action' into the input. You should refer to default.yaml and set these two options to false.

ouyangshixiong commented 3 years ago

无论从配置上看还是从debug输出看,这两个参数都是False。另外,我建议您回答问题时候最好带上原因(或者解释),这样方便其他人理解你的thinking。请看下面的截图: Screenshot from 2021-09-18 09-37-19

hhhusiyi-monash commented 3 years ago

I think you might get the wrong version of SMAC. Please check whether you get the original version of Starcraft2.py.. If everything is good, the shape of reshaped_obs should be (5,11,5) in 5m_vs_6m.

Besides, the output of arranged_obs.size() should be [1,5,55]. The first dimension is for the batchsize and the second dimension is for the agent number. While in your output, this number is 3. In my mind, size [1,3,30] looks like the pattern for battle scenario 3m. You should check whether you have set this map name in your configuration file.

ouyangshixiong commented 3 years ago

Thank you for your quick answer. At my side the input size actually is [1,3,30] I think the battle scenario may be 3m. Because I didnot know how to set this param: "with env_args.map_name=5m_vs_6m" with in vscode( VSCode can not recongnize such args, as I show in my first post ), So do you known how to pass such param into program in VSCode. I only known pass params such as pattern xx=xx, I have no idea on how to pass params such as pattern "with xx"

ouyangshixiong commented 3 years ago

Add a screenshot for better understand 企业微信20210922-100252 :

honghd16 commented 3 years ago

@ouyangshixiong you can try to set the args in launch.json as this Screenshot from 2021-09-27 15-58-28 to pass params like "with env_args.map_name=5m_vs_6m" It seems like a special way for sacred to update the params

ouyangshixiong commented 3 years ago

Thank you. The issue is fixed for me now.