boxu1995 commited on
Commit
9b31ba8
·
verified ·
1 Parent(s): 1f9127d

Upload sft_8frames.sh

Browse files
Files changed (1) hide show
  1. sft_8frames.sh +86 -0
sft_8frames.sh ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Set default values for distributed training parameters
3
+ # 禁用WandB
4
+ export WANDB_DISABLED=true
5
+ # ===== GPU配置参数 =====
6
+ # export CUDA_VISIBLE_DEVICES=0,1,2,3 # 使用4张GPU
7
+ export CUDA_VISIBLE_DEVICES=0 # GPU编号
8
+ export GPUS_PER_NODE=1 # 每个节点GPU数量
9
+ export n_node=1 # 单节点
10
+ export CURRENT_RANK=0 # 当前节点rank
11
+ export MASTER_ADDR="localhost" # 主节点地址
12
+ export MASTER_PORT=48057 # 主节点端口
13
+
14
+ llama3_model_path="/home/user/NaVILA/checkpoints/navila-llama3-8b-8f"
15
+ GEOMETRY_ENCODER_TYPE="pi3"
16
+ GEOMETRY_ENCODER_PATH="/home/user/NaVILA/checkpoints/Pi3"
17
+ # GEOMETRY_ENCODER_TYPE="vggt"
18
+ # GEOMETRY_ENCODER_PATH="/home/user/NaVILA/checkpoints/VGGT-1B"
19
+
20
+ OUTPUT="/home/user/NaVILA/sft_8frames"
21
+
22
+ # 检查是否有检查点可以resume
23
+ if [ -d "$OUTPUT" ] && [ "$(ls -A $OUTPUT | grep -E 'tmp-checkpoint-|checkpoint-')" ]; then
24
+ echo "Found existing checkpoints, will resume from the latest one"
25
+ # 找到最新的检查点
26
+ LATEST_CHECKPOINT=$(ls -t $OUTPUT | grep -E 'tmp-checkpoint-|checkpoint-' | head -1)
27
+ RESUME_PATH="$OUTPUT/$LATEST_CHECKPOINT"
28
+ echo "Resuming from: $RESUME_PATH"
29
+ # 不删除输出目录,让训练自动resume
30
+ else
31
+ echo "No existing checkpoints found, starting fresh training"
32
+ # rm -rf /home/user/NaVILA/output*
33
+ RESUME_PATH="$llama3_model_path"
34
+ fi
35
+
36
+ torchrun --nnodes=$n_node --nproc_per_node=$GPUS_PER_NODE --master_port=$MASTER_PORT \
37
+ --master_addr $MASTER_ADDR --node_rank=$CURRENT_RANK \
38
+ llava/train/train_mem.py \
39
+ --longvila_sampler True \
40
+ --deepspeed ./scripts/zero3.json \
41
+ --model_name_or_path $RESUME_PATH \
42
+ --version llama_3 \
43
+ --seed 3407 \
44
+ --data_mixture r2r+rxr \
45
+ --vision_tower google/siglip-so400m-patch14-384 \
46
+ --mm_vision_select_feature cls_patch \
47
+ --mm_projector mlp_downsample \
48
+ --num_video_frames 16 \
49
+ --tune_vision_tower False \
50
+ --tune_mm_projector True \
51
+ --tune_language_model True \
52
+ --mm_vision_select_layer -2 \
53
+ --mm_use_im_start_end False \
54
+ --mm_use_im_patch_token False \
55
+ --image_aspect_ratio resize \
56
+ --bf16 True \
57
+ --output_dir $OUTPUT \
58
+ --num_train_epochs 5 \
59
+ --per_device_train_batch_size 10 \
60
+ --gradient_accumulation_steps 2 \
61
+ --do_eval False \
62
+ --save_strategy "steps" \
63
+ --save_steps 2000 \
64
+ --fps 0.0 \
65
+ --save_total_limit 10 \
66
+ --learning_rate 1e-4 \
67
+ --mm_projector_lr 1e-5 \
68
+ --geometry_merger_lr 1e-4 \
69
+ --feature_fusion_lr 1e-4 \
70
+ --llm_lr 1e-6 \
71
+ --weight_decay 0. \
72
+ --warmup_ratio 0.03 \
73
+ --lr_scheduler_type "cosine" \
74
+ --logging_steps 1 \
75
+ --tf32 True \
76
+ --model_max_length 4096 \
77
+ --gradient_checkpointing True \
78
+ --dataloader_num_workers 16 \
79
+ --lazy_preprocess True \
80
+ --report_to tensorboard \
81
+ --logging_dir $OUTPUT/runs \
82
+ --use_geometry_encoder True \
83
+ --geometry_encoder_type $GEOMETRY_ENCODER_TYPE \
84
+ --geometry_encoder_path $GEOMETRY_ENCODER_PATH \
85
+ --feature_fusion_method "residual" \
86
+ --voxel_size 0.2 \