-
Notifications
You must be signed in to change notification settings - Fork 255
/
Copy pathrun_appzoo_cli_local.sh
85 lines (79 loc) · 2.58 KB
/
run_appzoo_cli_local.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
export CUDA_VISIBLE_DEVICES=$1
mode=$2
# Local training example
cur_path=$PWD/../../
cd ${cur_path}
# Download data
if [ ! -f ./tmp/MUGE_train_text_imgbase64.tsv ]; then
wget -P ./tmp https://atp-modelzoo-sh.oss-cn-shanghai.aliyuncs.com/release/tutorials/painter_text2image/MUGE_train_text_imgbase64.tsv
wget -P ./tmp https://atp-modelzoo-sh.oss-cn-shanghai.aliyuncs.com/release/tutorials/painter_text2image/MUGE_val_text_imgbase64.tsv
wget -P ./tmp https://atp-modelzoo-sh.oss-cn-shanghai.aliyuncs.com/release/tutorials/painter_text2image/MUGE_test.text.tsv
fi
if [ "$mode" = "pretrain" ]; then
easynlp \
--mode=train \
--worker_gpu=1 \
--tables=./tmp/MUGE_train_text_imgbase64.tsv,./tmp/MUGE_val_text_imgbase64.tsv \
--input_schema=idx:str:1,text:str:1,imgbase64:str:1 \
--first_sequence=text \
--second_sequence=imgbase64 \
--checkpoint_dir=./tmp/continue_pretrain_model/ \
--learning_rate=4e-5 \
--epoch_num=40 \
--random_seed=42 \
--logging_steps=100 \
--save_checkpoint_steps=1000 \
--sequence_length=288 \
--micro_batch_size=16 \
--app_name=text2image_generation \
--user_defined_parameters='
pretrain_model_name_or_path=alibaba-pai/pai-painter-base-zh
size=256
text_len=32
img_len=256
img_vocab_size=16384
'
elif [ "$mode" = "finetune" ]; then
easynlp \
--mode=train \
--worker_gpu=1 \
--tables=./tmp/MUGE_train_text_imgbase64.tsv,./tmp/MUGE_val_text_imgbase64.tsv \
--input_schema=idx:str:1,text:str:1,imgbase64:str:1 \
--first_sequence=text \
--second_sequence=imgbase64 \
--checkpoint_dir=./tmp/finetune_model \
--learning_rate=4e-5 \
--epoch_num=40 \
--random_seed=42 \
--logging_steps=100 \
--save_checkpoint_steps=1000 \
--sequence_length=288 \
--micro_batch_size=8 \
--app_name=text2image_generation \
--user_defined_parameters='
pretrain_model_name_or_path=./tmp/continue_pretrain_model/
size=256
text_len=32
img_len=256
'
elif [ "$mode" = "predict" ]; then
easynlp \
--mode=predict \
--worker_gpu=1 \
--tables=./tmp/MUGE_test.text.tsv \
--input_schema=idx:str:1,text:str:1 \
--first_sequence=text \
--outputs=./tmp/T2I_outputs.tsv \
--output_schema=idx,text,gen_imgbase64 \
--checkpoint_dir=./tmp/finetune_model \
--sequence_length=288 \
--micro_batch_size=8 \
--app_name=text2image_generation \
--user_defined_parameters='
size=256
text_len=32
img_len=256
img_vocab_size=16384
max_generated_num=4
'
fi