Complete Training Script
Here’s the complete training script with full parameter documentation:launch_training.sh
Parameter Categories
The script accepts arguments in three main categories:Model Arguments
Training Arguments
Component Training Flags
Precision & Memory
Learning Rate Configuration
Sequence Configuration
Data Arguments
Dataset Selection
Data Processing
data_flatten=Truemeans data in a batch are concatenated into one sequencedata_packing=Truerequires preprocessing withtools/pack_data.py
Image Processing
Video Processing
Training Schedule
Logging & Checkpoints
Advanced Options
DeepSpeed Configuration
Flash Attention
To enable Flash Attention 2, add the following to your model’sconfig.json:
config.json
Hardware Requirements
Training Qwen2.5-VL-3B
Minimum requirements:- 4x GPUs with 24GB VRAM (e.g., RTX 3090, RTX 4090)
- With DeepSpeed ZeRO-3 and gradient checkpointing
Training Qwen2.5-VL-32B
Recommended configuration:- 8x 80GB GPUs (e.g., A100, H100)
- Refer to
scripts/sft_32b.shfor configuration
Example Usage
Basic Training
Single GPU Training
Multi-node Training
On the master node:Monitoring Training
Monitor your training progress:Troubleshooting
Out of Memory (OOM) Errors
Out of Memory (OOM) Errors
Try these solutions:
- Reduce
--per_device_train_batch_size - Increase
--gradient_accumulation_steps - Reduce
--model_max_length - Enable gradient checkpointing in DeepSpeed config
- Use DeepSpeed ZeRO-3 for larger models
Slow Training Speed
Slow Training Speed
Optimize performance:
- Enable Flash Attention 2 in config.json
- Use
--data_packing Truewith preprocessed data - Ensure
--bf16is enabled on Ampere+ GPUs - Check if GPU utilization is at 100%
- Increase batch size if memory allows
Training Instability
Training Instability
If you see NaN losses or diverging training:
- Lower the learning rate (try
1e-7or5e-8) - Set
--tune_mm_vision Falsewhen using mixed image/video data - Increase warmup ratio to
0.05or0.1 - Check data for corrupted images or invalid annotations
- Reduce
--max_pixelsif processing very large images