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

代码调试问题 #10

Closed
ouyangshixiong opened this issue Sep 17, 2021 · 7 comments
Closed

代码调试问题 #10

ouyangshixiong opened this issue Sep 17, 2021 · 7 comments

Comments

@ouyangshixiong
Copy link

ouyangshixiong commented Sep 17, 2021

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

{  
    "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
Copy link
Owner

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
Copy link
Author

ouyangshixiong commented Sep 18, 2021

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

@hhhusiyi-monash
Copy link
Collaborator

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
Copy link
Author

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
Copy link
Author

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

@honghd16
Copy link

@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
Copy link
Author

Thank you. The issue is fixed for me now.

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

No branches or pull requests

4 participants