vscode分布式调试

CUDA_VISIBLE_DEVICES=1 tools/dist_test.sh projects/configs/StreamPETR/stream_petr_r50_flash_704_bs2_seq_90e.py /home2/workspace/zxy/StreamPETR-main/work_dirs/stream_petr_r50_flash_704_bs2_seq_90e/latest.pth 1 --eval bbox
sh文件
#!/usr/bin/env bash

CONFIG=$1
CHECKPOINT=$2
GPUS=$3
NNODES=${NNODES:-1}
NODE_RANK=${NODE_RANK:-0}
PORT=${PORT:-29500}
MASTER_ADDR=${MASTER_ADDR:-"127.0.0.1"}

PYTHONPATH="$(dirname $0)/..":$PYTHONPATH \
python -m torch.distributed.launch \
    --nnodes=$NNODES \
    --node_rank=$NODE_RANK \
    --master_addr=$MASTER_ADDR \
    --use_env \
    --nproc_per_node=$GPUS \
    --master_port=$PORT \
    $(dirname "$0")/test.py \
    $CONFIG \
    $CHECKPOINT \
    --launcher pytorch \
    ${@:4}

分布式训练脚本:

{
    // 使用 IntelliSense 了解相关属性。
    // 悬停以查看现有属性的描述。
    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
    // CUDA_VISIBLE_DEVICES=1 tools/dist_test.sh projects/configs/StreamPETR/stream_petr_r50_flash_704_bs2_seq_90e.py /home2/workspace/zxy/StreamPETR-main/work_dirs/stream_petr_r50_flash_704_bs2_seq_90e/latest.pth 1 --eval bbox
    // CUDA_VISIBLE_DEVICES=1 /home/student/anaconda3/envs/streampetrzxy/bin/python ./tools/test.py /home/student/home2/workspace/zxy/StreamPETR-main/projects/configs/StreamPETR/stream_petr_r50_flash_704_bs2_seq_90e.py /home2/workspace/zxy/StreamPETR-main/work_dirs/stream_petr_r50_flash_704_bs2_seq_90e/latest.pth--eval bbox
    // CUDA_VISIBLE_DEVICES=1 tools/dist_test.sh projects/configs/StreamPETR/stream_petr_r50_flash_704_bs2_seq_90e.py /home2/workspace/zxy/StreamPETR-main/work_dirs/stream_petr_r50_flash_704_bs2_seq_90e/latest.pth 1 --eval bbox
    "version": "0.2.0",
    "configurations": [
        {
            "python":"/home/student/anaconda3/envs/streampetrzxy/bin/python",
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "/home/student/anaconda3/envs/streampetrzxy/lib/python3.8/site-packages/torch/distributed/launch.py",
            "console": "integratedTerminal",
            "justMyCode": true,
            "args": [
                "--nnodes", "1",
                "--node_rank", "0",
                "--master_addr", "127.0.0.1",
                "--nproc_per_node", "1",
                "--master_port", "29500",
                "./tools/test.py",
                "/home/student/home2/workspace/zxy/StreamPETR-main/projects/configs/StreamPETR/stream_petr_r50_flash_704_bs2_seq_90e.py",
                "/home2/workspace/zxy/StreamPETR-main/work_dirs/stream_petr_r50_flash_704_bs2_seq_90e/latest.pth",
                "--eval", "bbox",
                "--launcher", "pytorch"
            ],
             "env": {"CUDA_VISIBLE_DEVICES":"1"}
        }
    ]
}
posted @ 2024-09-29 20:44  风影旋新月  阅读(12)  评论(0编辑  收藏  举报