config.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. source /home/korsch/.anaconda3/etc/profile.d/conda.sh
  2. conda activate chainer4
  3. if [[ $GDB == "1" ]]; then
  4. PYTHON="gdb -ex run --args python"
  5. elif [[ $MPI == "1" ]]; then
  6. N_MPI=${N_MPI:-2}
  7. HOSTFILE=${HOSTFILE:-hosts.conf}
  8. PYTHON="mpirun -n $N_MPI --hostfile ${HOSTFILE} -x PATH -x CUDA_PATH python"
  9. OPTS="${OPTS} --mpi"
  10. elif [[ $PROFILE == "1" ]]; then
  11. PYTHON="python -m cProfile -o profile"
  12. else
  13. PYTHON="python"
  14. fi
  15. RUN_SCRIPT="../main.py"
  16. ###### Dataset config ######
  17. BASE_DIR=/home/korsch/Data
  18. OPTIMIZER=${OPTIMIZER:-adam}
  19. MODEL_TYPE=${MODEL_TYPE:-resnet}
  20. PREPARE_TYPE=${PREPARE_TYPE:-model}
  21. MODEL_DIR=${BASE_DIR}/MODELS/${MODEL_TYPE}
  22. OUTPUT_DIR=${OUTPUT_DIR:-../.results/ft_${DATASET}/${OPTIMIZER}${OUTPUT_SUFFIX}}
  23. ###### Training config ######
  24. BATCH_SIZE=${BATCH_SIZE:-24}
  25. GPU=${GPU:-"0"}
  26. EPOCHS=${EPOCHS:-100}
  27. DECAY=${DECAY:-5e-4}
  28. LR=${LR:-"-lr 1e-3 -lrd 1e-1 -lrt 1e-8 -lrs 20"}
  29. FINAL_POOLING=${FINAL_POOLING:-g_avg}
  30. N_JOBS=${N_JOBS:-1}
  31. if [[ $N_JOBS != "0" ]]; then
  32. export OMP_NUM_THREADS=2
  33. fi
  34. ###### OPTIONS ######
  35. OPTS="${OPTS} --epochs ${EPOCHS}"
  36. OPTS="${OPTS} --gpu ${GPU}"
  37. OPTS="${OPTS} --batch_size ${BATCH_SIZE}"
  38. # if [[ -f sacred/creds.sh ]]; then
  39. # source sacred/creds.sh
  40. # else
  41. # echo "No sacred credentials found! Disabling sacred."
  42. # OPTS="${OPTS} --no_sacred"
  43. # fi
  44. OPTS="${OPTS} --augment"
  45. OPTS="${OPTS} --model_type ${MODEL_TYPE}"
  46. OPTS="${OPTS} --prepare_type ${PREPARE_TYPE}"
  47. OPTS="${OPTS} --n_jobs ${N_JOBS}"
  48. OPTS="${OPTS} --optimizer ${OPTIMIZER}"
  49. OPTS="${OPTS} --output ${OUTPUT_DIR}"
  50. OPTS="${OPTS} --pooling ${FINAL_POOLING}"
  51. OPTS="${OPTS} --decay ${DECAY}"
  52. OPTS="${OPTS} ${LR}"