You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

run_train.sh 745 B

5 years ago
123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env bash
  2. if [ $# != 4 ]
  3. then
  4. echo "Usage: sh run_train.sh [DEVICE_NUM] [SERVER_IP(x.x.x.x)] [VISIABLE_DEVICES(0,1,2,3,4,5,6,7)] [DATASET_PATH]"
  5. exit 1
  6. fi
  7. if [ $1 -lt 1 ] && [ $1 -gt 8 ]
  8. then
  9. echo "error: DEVICE_NUM=$1 is not in (1-8)"
  10. exit 1
  11. fi
  12. if [ ! -d $4 ]
  13. then
  14. echo "error: DATASET_PATH=$4 is not a directory"
  15. exit 1
  16. fi
  17. BASEPATH=$(cd "`dirname $0`" || exit; pwd)
  18. export PYTHONPATH=${BASEPATH}:$PYTHONPATH
  19. if [ -d "train" ];
  20. then
  21. rm -rf ./train
  22. fi
  23. mkdir ./train
  24. cd ./train || exit
  25. python ${BASEPATH}/launch.py \
  26. --nproc_per_node=$1 \
  27. --visible_devices=$3 \
  28. --server_id=$2 \
  29. --training_script=${BASEPATH}/train.py \
  30. --dataset_path=$4 &> train.log & # dataset train folder