Spaces:
Running
on
Zero
Running
on
Zero
File size: 1,337 Bytes
4893ce0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
#!/bin/sh
cd $(dirname $(dirname "$0")) || exit
PYTHON=python
TEST_CODE=test.py
DATASET=scannet
CONFIG="None"
EXP_NAME=debug
WEIGHT=model_best
GPU=None
while getopts "p:d:c:n:w:g:" opt; do
case $opt in
p)
PYTHON=$OPTARG
;;
d)
DATASET=$OPTARG
;;
c)
CONFIG=$OPTARG
;;
n)
EXP_NAME=$OPTARG
;;
w)
WEIGHT=$OPTARG
;;
g)
GPU=$OPTARG
;;
\?)
echo "Invalid option: -$OPTARG"
;;
esac
done
if [ "${NUM_GPU}" = 'None' ]
then
NUM_GPU=`$PYTHON -c 'import torch; print(torch.cuda.device_count())'`
fi
echo "Experiment name: $EXP_NAME"
echo "Python interpreter dir: $PYTHON"
echo "Dataset: $DATASET"
echo "GPU Num: $GPU"
EXP_DIR=exp/${DATASET}/${EXP_NAME}
MODEL_DIR=${EXP_DIR}/model
CODE_DIR=${EXP_DIR}/code
CONFIG_DIR=${EXP_DIR}/config.py
if [ "${CONFIG}" = "None" ]
then
CONFIG_DIR=${EXP_DIR}/config.py
else
CONFIG_DIR=configs/${DATASET}/${CONFIG}.py
fi
echo "Loading config in:" $CONFIG_DIR
#export PYTHONPATH=./$CODE_DIR
export PYTHONPATH=./
echo "Running code in: $CODE_DIR"
echo " =========> RUN TASK <========="
#$PYTHON -u "$CODE_DIR"/tools/$TEST_CODE \
$PYTHON -u tools/$TEST_CODE \
--config-file "$CONFIG_DIR" \
--num-gpus "$GPU" \
--options save_path="$EXP_DIR" weight="${MODEL_DIR}"/"${WEIGHT}".pth
|