Aaron
Aaron

Reputation: 1

How to add accelerator launch to VS Code Debugger?

Keep getting the error in my terminal:

ConnectionRefusedError: [Errno 111] Connection refused

I got the above error by trying to add in this command:

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

to my debugging command as so:

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 

tried running my accelerator launch on vs code debug to save time.

Upvotes: 0

Views: 297

Answers (1)

Aaron
Aaron

Reputation: 1

Nvm i figured it out:

I added this configuration to my 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"
        }
    ]
}


I refered the documentation for this:

enter link description here

Things to Note

  1. BTW you have to module before the args in launch.json
  2. Copy your ABSOLUTE PATH and not RELATIVE PATH

Upvotes: 0

Related Questions