-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathadvanced-visual-attention-lexical-finetune-with-decay.sh
38 lines (33 loc) · 1.46 KB
/
advanced-visual-attention-lexical-finetune-with-decay.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
#!/bin/bash
# the script directory
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
INCEPTION_CHECKPOINT="${DIR}/pretrained_model/inception_v3/inception_v3.ckpt"
TFRECORD_DIR="${DIR}/data/TFRecord_data"
MODEL_DIR="${DIR}/model"
model=ShowAndTellAdvancedModel
model_dir_name=show_and_tell_advanced_model_visual_attention_lexical_finetune_with_decay
original_model_dir_name=show_and_tell_advanced_model_visual_attention_lexical
start_ckpt=105000
# copy the starting checkpoint
if [ ! -d ${MODEL_DIR}/${model_dir_name} ]; then
mkdir -p ${MODEL_DIR}/${model_dir_name}
cp ${MODEL_DIR}/${original_model_dir_name}/model.ckpt-${start_ckpt}.* ${MODEL_DIR}/${model_dir_name}/
echo "model_checkpoint_path: \"${MODEL_DIR}/${model_dir_name}/model.ckpt-${start_ckpt}\"" > ${MODEL_DIR}/${model_dir_name}/checkpoint
fi
cd im2txt && CUDA_VISIBLE_DEVICES=1 python train.py \
--input_file_pattern="${TFRECORD_DIR}/train-?????-of-?????.tfrecord" \
--inception_checkpoint_file="${INCEPTION_CHECKPOINT}" \
--train_dir="${MODEL_DIR}/${model_dir_name}" \
--model=${model} \
--initial_learning_rate=1.0 \
--learning_rate_decay_factor=0.6 \
--inception_return_tuple=True \
--use_scheduled_sampling=False \
--use_attention_wrapper=True \
--attention_mechanism=BahdanauAttention \
--num_lstm_layers=2 \
--use_lexical_embedding=True \
--lexical_mapping_file="${DIR}/data/word2postag.txt" \
--support_ingraph=True \
--train_inception_with_decay=True \
--number_of_steps=600000