get_mmcv_var.sh 574 B

12345678910111213141516171819
  1. #!/bin/bash
  2. TORCH=$1
  3. CUDA=$2
  4. # 10.2 -> cu102
  5. MMCV_CUDA="cu`echo ${CUDA} | tr -d '.'`"
  6. # MMCV only provides pre-compiled packages for torch 1.x.0
  7. # which works for any subversions of torch 1.x.
  8. # We force the torch version to be 1.x.0 to ease package searching
  9. # and avoid unnecessary rebuild during MMCV's installation.
  10. TORCH_VER_ARR=(${TORCH//./ })
  11. TORCH_VER_ARR[2]=0
  12. printf -v MMCV_TORCH "%s." "${TORCH_VER_ARR[@]}"
  13. MMCV_TORCH=${MMCV_TORCH%?} # Remove the last dot
  14. echo "export MMCV_CUDA=${MMCV_CUDA}" >> $BASH_ENV
  15. echo "export MMCV_TORCH=${MMCV_TORCH}" >> $BASH_ENV