vscode debug大工程(torchrun,deepspeed等)最优雅的方式
reference: https://github.com/yuanzhoulvpi2017/vscode_debug_transformers
程序入口
import os
import debugpy
if os.environ.get('CODE_MODE') == 'debug':
try:
# 5678 is the default attach port in the VS Code debug configurations. Unless a host and port are specified, host defaults to 127.0.0.1
debugpy.listen(('localhost', 9501))
print('Waiting for debugger attach')
debugpy.wait_for_client()
except Exception as e:
pass
launch.json
{
"name": "sh_file_debug",
"type": "debugpy",
"request": "attach",
"connect": {
"host": "localhost",
"port": 9501
}
},

浙公网安备 33010602011771号