背景
大家在使用Vscode Debug 代码时,会由于一些代码没有适配单机单卡而导致无法直接使用Vscode Debug,转而使用pdb方法,这样的效率会相对较低,本文章使用分布式debug,相同远离可以进行单机单卡debug,便于大家找到问题
解决办法如下
调整launch.json,如下,改成分布式debug即可
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: train",
"type": "python",
"request": "launch",
"program": "/root/miniconda3/envs/toponet/lib/python3.8/site-packages/torch/distributed/run.py",
"console": "integratedTerminal",
"justMyCode": false,
"args": [
"--nproc_per_node", "1",
"tools/train.py", "projects/configs/toponet_r50_8x1_24e_olv2_subset_A.py",
"--launcher", "pytorch",
"--work-dir", "work_dirs/toponet"]
},
{
"name": "Python: eval",
"type": "python",
"request": "launch",
"program": "/root/miniconda3/envs/toponet/lib/python3.8/site-packages/torch/distributed/run.py",
"console": "integratedTerminal",
"justMyCode": false,
"args": [
"--nproc_per_node", "1",
"tools/test.py", "projects/configs/toponet_r50_8x1_24e_olv2_subset_A.py", "toponet_r50_8x1_24e_olv2_subset_A.pth",
"--launcher", "pytorch",
"--out-dir", "work_dirs/test",
"--eval", "openlane_v2", "--show"]
}
]
}