-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patht2i_pipeline.sh
executable file
·62 lines (50 loc) · 1.69 KB
/
t2i_pipeline.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
#!/bin/bash
source activate unmt
echo $(which python)
git rev-parse HEAD
LANG=$1
DATA=$2
UNROLL=$3
SEED=$4
SEED_OFFSET=$5
if [ ! -z $SEED_OFFSET ]; then
SEED=$(($SEED + $SEED_OFFSET))
fi
EC_TYPE=t2i
EX_ABBR=${DATA}
export PYTHONPATH=".:${PYTHONPATH}"
OUTPUT_ROOT_DIR=Output
OUTPUT_BASE_DIR=${LANG}/${EC_TYPE}/${DATA}+${UNROLL}/seed${SEED}
CAPTIONS_CONFIG=${EC_TYPE}_caption
EC_CONFIG=${EC_TYPE}_ec
BT_CONFIG=t2i_bt
# Do caption training
BT_CKPT_CHOICE=pretrained
CAPTION_OUT_DIR=captions_from-${BT_CKPT_CHOICE}
python -u -m EC_finetune +ec=${CAPTIONS_CONFIG} \
ec/language=${LANG} \
ec/data=${DATA} \
ec.train_eval.seed=${SEED} \
ec.model.image_unroll=${UNROLL} \
ec.output_dir=${OUTPUT_ROOT_DIR}/${OUTPUT_BASE_DIR}/${CAPTION_OUT_DIR} \
ec.model.model_name=facebook/mbart-large-cc25 \
# Do EC
# ec_distractor=15
EC_OUT_DIR=ec_from-${BT_CKPT_CHOICE}
python -u -m EC_finetune +ec=${EC_CONFIG} \
ec/language=${LANG} \
ec/data=${DATA} \
ec.train_eval.seed=${SEED} \
ec.model.image_unroll=${UNROLL} \
ec.model.model_name=${OUTPUT_ROOT_DIR}/${OUTPUT_BASE_DIR}/${CAPTION_OUT_DIR} \
ec.output_dir=${OUTPUT_ROOT_DIR}/${OUTPUT_BASE_DIR}/${EC_OUT_DIR} \
rm -rf ${OUTPUT_ROOT_DIR}/${OUTPUT_BASE_DIR}/${CAPTION_OUT_DIR}
# Do rest of backtranslation
OUTPUT_DIR=bt_sec_from-${BT_CKPT_CHOICE}
python -u BackTranslation/backtranslate.py \
+backtranslate=${BT_CONFIG} \
backtranslate/data=${LANG} \
backtranslate.train_eval.seed=$((SEED + 0)) \
backtranslate.model_path=${OUTPUT_ROOT_DIR}/${OUTPUT_BASE_DIR}/${EC_OUT_DIR} \
backtranslate.output_dir=${OUTPUT_ROOT_DIR}/${OUTPUT_BASE_DIR}/${OUTPUT_DIR}
rm -rf ${OUTPUT_ROOT_DIR}/${OUTPUT_BASE_DIR}/${EC_OUT_DIR}