pretrain_openx.sh 1.49 KB
Newer Older
chenzk's avatar
v1.0  
chenzk committed
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
#!/bin/bash
# default MODEL_PATH or use the one from the environment
MODEL_PATH="meta-llama/Meta-Llama-3-8B-Instruct"
# default OUTPUT_DIR
OUTPUT_DIR="./checkpoints/pretrain-openx"

torchrun --nproc_per_node=4 train.py \
    --deepspeed ./trainer/deepspeed/zero3.json \
    --model_name_or_path $MODEL_PATH \
    --version magma_instruct \
    --data_path "data_configs/openx.yaml" \
    --vision_tower convnext_xxlarge \
    --img_size 512 \
    --max_num_crops 4 \
    --img_anyres_strategy crop \
    --vision_backbone "convnextxxlarge" \
    --is_multimodal True \
    --mm_projector_type mlp2x_gelu \
    --tune_mm_mlp_adapter True \
    --tune_vision_tokenizer 'none' \
    --mm_vision_select_layer -2 \
    --mm_use_image_start_end False \
    --group_by_modality_length False \
    --bf16 True \
    --output_dir $OUTPUT_DIR \
    --num_train_epochs 1 \
    --per_device_train_batch_size 4 \
    --per_device_eval_batch_size 1 \
    --gradient_accumulation_steps 1 \
    --evaluation_strategy "no" \
    --save_strategy "steps" \
    --save_steps 50000 \
    --save_total_limit 1 \
    --learning_rate 1e-5 \
    --weight_decay 0. \
    --warmup_ratio 0.03 \
    --lr_scheduler_type "cosine" \
    --logging_steps 10 \
    --tf32 True \
    --model_max_length 4096 \
    --gradient_checkpointing True \
    --dataloader_num_workers 4 \
    --lazy_preprocess True \
    --flash_attn_2_enabled True \
    --local_run False \
    --show_trace False \
    --run_name finetune_anyres \
    --remove_static_trace_pts True