TODOLIST
- gpu가 n대 인 경우, 실험을 항상 새 브랜치에서 해서 귀찮음.
알고리즘
- $GPU_IDX 가 1이면, DATASET_PATH = "dataset_1"
사용법
./nl_navigation.sh [target_branch] [note] [gpu_idx]
./nl_navigation.sh dev test 0
- note와 gpu_idx는 모두 optional 입니다!
개인 pc용
#!/bin/bash
TARGET_BRANCH=$1
WORKSPACE=${TARGET_BRANCH//\//_}
if [ -z "$2" ]; then
NAMESPACE="note"
else
NAMESPACE="note_$2"
fi
if [ -z "$3" ]; then
GPU_IDX=0
else
GPU_IDX=$3
fi
DATASET_PATH="dataset"
DATASET_PATH="${DATASET_PATH}_${GPU_IDX}"
PORT=10001
PORT=$((PORT+GPU_IDX))
cd ~/PycharmProjects/nl_navigation/nl_navigation
source ~/anaconda3/etc/profile.d/conda.sh
conda activate nl_navigation
conda info --envs
git config --global credential.helper store
git stash
BRANCH_EXISTS=$(git branch --list $TARGET_BRANCH)
if [ "$BRANCH_EXISTS" ]; then
echo "Switching to $TARGET_BRANCH"
git checkout dev
git branch -d $TARGET_BRANCH
git fetch origin $TARGET_BRANCH
git checkout $TARGET_BRANCH
else
echo "Creating and switching to $TARGET_BRANCH from origin/$TARGET_BRANCH"
git fetch origin $TARGET_BRANCH
git checkout $TARGET_BRANCH
fi
echo "python3 launch_rl_training.py --gpu_idx $GPU_IDX --workspace $WORKSPACE --namespace $NAMESPACE --dataset_path $DATASET_PATH --port $PORT"
python3 launch_rl_training.py --gpu_idx $GPU_IDX --workspace $WORKSPACE --namespace $NAMESPACE --dataset_path $DATASET_PATH --port $PORT
공용 서버 용
#!/bin/bash
TARGET_BRANCH=$1
WORKSPACE=${TARGET_BRANCH//\//_}
if [ -z "$2" ]; then
NAMESPACE="note"
else
NAMESPACE="note_$2"
fi
if [ -z "$3" ]; then
GPU_IDX=0
else
GPU_IDX=$3
fi
DATASET_PATH="dataset"
DATASET_PATH="${DATASET_PATH}_${GPU_IDX}"
PORT=10001
PORT=$((PORT+GPU_IDX))
cd /shared_storage/hsb/nl_navigation
source nl_navigation/bin/activate
cd /shared_storage/hsb/nl_navigation/nl_navigation
git config --global credential.helper store
git stash
BRANCH_EXISTS=$(git branch --list $TARGET_BRANCH)
if [ "$BRANCH_EXISTS" ]; then
echo "Switching to $TARGET_BRANCH"
git checkout dev
git branch -d $TARGET_BRANCH
git fetch origin $TARGET_BRANCH
git checkout $TARGET_BRANCH
else
echo "Creating and switching to $TARGET_BRANCH from origin/$TARGET_BRANCH"
git fetch origin $TARGET_BRANCH
git checkout $TARGET_BRANCH
fi
echo "python3 launch_rl_training.py --gpu_idx $GPU_IDX --workspace $WORKSPACE --namespace $NAMESPACE --dataset_path $DATASET_PATH --port $PORT"
python3 launch_rl_training.py --gpu_idx $GPU_IDX --workspace $WORKSPACE --namespace $NAMESPACE --dataset_path $DATASET_PATH --port $PORT