forked from THUNLP-MT/MEAN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rabd_test.sh
41 lines (36 loc) · 801 Bytes
/
rabd_test.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
#!/bin/bash
if [ -z ${GPU} ]; then
GPU=0
fi
if [ -z ${MODE} ]; then
MODE=111
fi
if [ -z ${MODEL} ]; then
MODEL=mean
fi
if [ -z ${CDR} ]; then
CDR=3
fi
echo "Using GPU: ${GPU}"
export CUDA_VISIBLE_DEVICES=$GPU
VERSION=0
if [ $1 ]; then
VERSION=$1
fi
if [ $2 ]; then
CKPT_DIR=$(dirname $2)
CKPT=$2
else
CKPT_DIR=${DATA_DIR}/ckpt/${MODEL}_CDR${CDR}_${MODE}/version_${VERSION}
CKPT=${CKPT_DIR}/checkpoint/`ls ${CKPT_DIR}/checkpoint -l -t | head -n 2 | grep -o 'epoch[0-9]*_step[0-9]*.ckpt'`
fi
echo "Using checkpoint: ${CKPT}"
python generate.py \
--ckpt ${CKPT} \
--test_set ${DATA_DIR}/test.json \
--out ${CKPT_DIR}/results \
--gpu 0 \
--rabd_test \
--rabd_sample 1 \
--topk 100 \
--mode ${MODE} | tee -a ${CKPT_DIR}/rabd_log.txt