improve run.sh

This commit is contained in:
2020-08-10 08:50:58 +08:00
parent a5133e6795
commit 649f2244f7
3 changed files with 23 additions and 7 deletions

14
run.sh
View File

@@ -1,8 +1,14 @@
#!/usr/bin/env bash
CONFIG=$1
GPUS=$2
TASK=$2
GPUS=$3
# CUDA_VISIBLE_DEVICES=$GPUS \
PYTHONPATH=.:$PYTHONPATH OMP_NUM_THREADS=1 python -m torch.distributed.launch --nproc_per_node="$GPUS" \
main.py train "$CONFIG" --backup_config --setup_output_dir --setup_random_seed
_command="print(len('${GPUS}'.split(',')))"
GPU_COUNT=$(python3 -c "${_command}")
echo "GPU_COUNT:${GPU_COUNT}"
CUDA_VISIBLE_DEVICES=$GPUS \
PYTHONPATH=.:$PYTHONPATH OMP_NUM_THREADS=1 python -m torch.distributed.launch --nproc_per_node="$GPU_COUNT" \
main.py "$TASK" "$CONFIG" --backup_config --setup_output_dir --setup_random_seed