如何将加速器启动添加到 VS Code 调试器?

问题描述 投票:0回答:1

我的终端中不断出现错误:

ConnectionRefusedError: [Errno 111] Connection refused

我尝试添加此命令时出现上述错误:

accelerate launch --num_processes=1 --num_machines=1 --mixed_precision=fp16 --dynamo_backend=no alpaca.py

我的调试命令如下:

cd /its/home/ar810/Project2 ; /usr/bin/env /its/home/ar810/Project2/.venv/bin/python /its/home/ar810/.vscode-server/extensions/ms-python.debugpy-2024.10.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher 45401 accelerate launch --num_processes=1 --num_machines=1 --mixed_precision=fp16 --dynamo_backend=no  --  /its/home/msu22/Project2/1.DataGeneration/1.1PromptGeneration/alpaca.py 

尝试在 vs code debug 上运行我的加速器启动以节省时间。

cuda vscode-debugger accelerator huggingface-trainer
1个回答
0
投票

Nvm 我想通了:

我将此配置添加到我的 launch.json 中:-


{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        
        {
            "name": "Python Debugger: Current File",
            "type": "debugpy",
            "request": "launch",
            "module": "accelerate.commands.launch",
            "args": [
                "__REPLACE__WITH__YOUR__FILE__PATH",
                "--num_processes=1",
                "--num_machines=1",
                "--mixed_precision=fp16",
                "--dynamo_backend=no",
            ],
            "console": "integratedTerminal",
            "justMyCode": false
        },
        {
            "name": "Python Debugger: Current File",
            "type": "debugpy",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal"
        }
    ]
}


我为此参考了文档:

在此输入链接描述

注意事项

  1. 顺便说一句,你必须在 launch.json 中的参数之前进行模块
  2. 复制您的绝对路径而不是相对路径
© www.soinside.com 2019 - 2024. All rights reserved.