-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
66 lines (51 loc) · 1.41 KB
/
run.sh
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
#!/bin/sh
python -u -c 'import torch; print(torch.__version__)'
CODE_PATH=codes
DATA_PATH=data
SAVE_PATH=models_benchmark
# SAVE_PATH=models
#The first four parameters must be provided
MODE=$1
MODEL=$2
DATASET=$3
GPU_DEVICE=$4
SAVE_ID=$5
FULL_DATA_PATH=$DATA_PATH/$DATASET
SAVE=$SAVE_PATH/"$MODEL"_"$DATASET"_"$SAVE_ID"
#Only used in training
BATCH_SIZE=$6
NEGATIVE_SAMPLE_SIZE=$7
HIDDEN_DIM=$8
GAMMA=$9
ALPHA=${10}
LEARNING_RATE=${11}
MAX_STEPS=${12}
TEST_BATCH_SIZE=${13}
STUDY_VALID_ID=${14}
if [ $MODE == "train" ]
then
echo "Start Training......"
CUDA_VISIBLE_DEVICES=$GPU_DEVICE python -u $CODE_PATH/run.py --do_train \
--cuda \
--do_valid \
--do_test \
--data_path $FULL_DATA_PATH \
--model $MODEL \
-n $NEGATIVE_SAMPLE_SIZE -b $BATCH_SIZE -d $HIDDEN_DIM \
-g $GAMMA -a $ALPHA \
-lr $LEARNING_RATE --max_steps $MAX_STEPS \
-save $SAVE --test_batch_size $TEST_BATCH_SIZE \
--study_valid_id $STUDY_VALID_ID \
${15} ${16} ${17} ${18} ${19} ${20} ${21}
# ${14} ${15} ${16} ${17} ${18} ${19} ${20}
elif [ $MODE == "valid" ]
then
echo "Start Evaluation on Valid Data Set......"
CUDA_VISIBLE_DEVICES=$GPU_DEVICE python -u $CODE_PATH/run.py --do_valid --cuda -init $SAVE
elif [ $MODE == "test" ]
then
echo "Start Evaluation on Test Data Set......"
CUDA_VISIBLE_DEVICES=$GPU_DEVICE python -u $CODE_PATH/run.py --do_test --cuda -init $SAVE
else
echo "Unknown MODE" $MODE
fi