forked from apple/ml-ferret
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ferret_13b_train.sh
100 lines (94 loc) · 3.01 KB
/
ferret_13b_train.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/usr/bin/env bash
set -xe
mkdir -p checkpoints
echo "Start Fine-Tuning"
# =================== Training ======================
data_path=(
'dataset/git_instruction.json'
'dataset/vg_objects.json'
'dataset/vg_relations.json'
'dataset/vg_regions.json'
'dataset/grounded_llava_boxes_detail.json'
'dataset/grounded_llava_boxes_complex_reasoning.json'
'dataset/grounded_llava_boxes_conversation.json'
'dataset/refexp_all.json'
'dataset/flickr.json'
'dataset/objects365.json'
)
image_folder=(
'dataset/coco2014/train2014'
'dataset/vg/images'
'dataset/vg/images'
'dataset/vg/images'
'dataset/coco2014/train2014'
'dataset/coco2014/train2014'
'dataset/coco2014/train2014'
'data/refcoco/train2014'
'data/flickr30k/flickr30k_images_split/train'
'data/objects365_v1/train'
)
data_multiple=(
3
1
0.2
0.2
1
1
1
1
1
1
)
# convert array to string
data_path="${data_path[@]}"
image_folder="${image_folder[@]}"
data_multiple="${data_multiple[@]}"
################## VICUNA ##################
PROMPT_VERSION=v1
MODEL_VERSION="vicuna-13b-v1-3"
################## VICUNA ##################
torchrun --nnodes=1 --nproc_per_node=8 --master_port=25001 \
ferret/train/train_mem.py \
--lora_enable False \
--model_name_or_path ./model/$MODEL_VERSION \
--version $PROMPT_VERSION \
--data_path $data_path \
--image_folder $image_folder \
--data_multiple $data_multiple \
--vision_tower openai/clip-vit-large-patch14-336 \
--pretrain_mm_mlp_adapter ./model/llava-336px-pretrain-$MODEL_VERSION/mm_projector.bin \
--mm_vision_select_layer -2 \
--mm_use_im_start_end False \
--mm_use_im_patch_token False \
--bf16 True \
--output_dir ./checkpoints/ferret_13b \
--num_train_epochs 3 \
--per_device_train_batch_size 16 \
--per_device_eval_batch_size 4 \
--gradient_accumulation_steps 1 \
--evaluation_strategy "no" \
--save_strategy "steps" \
--save_steps 1500 \
--save_total_limit 3 \
--learning_rate 2e-5 \
--weight_decay 0. \
--warmup_ratio 0.03 \
--lr_scheduler_type "cosine" \
--logging_steps 1 \
--tf32 True \
--fsdp "full_shard auto_wrap" \
--fsdp_transformer_layer_cls_to_wrap 'LlamaDecoderLayer' \
--model_max_length 2048 \
--gradient_checkpointing True \
--dataloader_num_workers 8 \
--lazy_preprocess True \
--report_to tensorboard \
--point_input_sample 'segment_mask|center' \
--add_region_feature True \
--region_geo_sampler True \
--sampler_pooler_mode 'max' \
--add_region_feature True \
--refer_previous_point False \
--resized_image_h 336 \
--resized_image_w 336 \
--save_vision_tower True