dist_train.sh 490 B

1234567891011121314151617181920
  1. #!/usr/bin/env bash
  2. # Copyright (c) OpenMMLab. All rights reserved.
  3. CONFIG=$1
  4. GPUS=$2
  5. NNODES=${NNODES:-1}
  6. NODE_RANK=${NODE_RANK:-0}
  7. PORT=${PORT:-29500}
  8. MASTER_ADDR=${MASTER_ADDR:-"127.0.0.1"}
  9. PYTHONPATH="$(dirname $0)/..":$PYTHONPATH \
  10. python -m torch.distributed.launch \
  11. --nnodes=$NNODES \
  12. --node_rank=$NODE_RANK \
  13. --master_addr=$MASTER_ADDR \
  14. --nproc_per_node=$GPUS \
  15. --master_port=$PORT \
  16. $(dirname "$0")/train.py \
  17. $CONFIG \
  18. --launcher pytorch ${@:3}