README.md

February 12, 2025 · View on GitHub

Data Organization Guidelines

Your training data should include a CSV file and a video folder structured as follows:

├── example.csv
└── videos/
    ├── example_1_A.mp4
    ├── example_1_B.mp4
    ├── example_2_A.mp4
    ├── example_2_B.mp4
    └── ...

CSV File Format

The CSV file must contain the following columns with exact header names:

  • path_A: Path to video A (e.g., ./videos/example_1_A.mp4).
  • path_B: Path to video B (e.g., ./videos/example_1_B.mp4).
  • prompt: Text description outlining the video content or scene.
  • VQ: Visual quality preference label (possible values: A, B, same).
  • MQ: Motion quality preference label (possible values: A, B, same).
  • TA: Text alignment preference label (possible values: A, B, same).
  • fps_A: Frame rate of video A.
  • num_frames_A: Number of frames in video A.
  • fps_B: Frame rate of video B.
  • num_frames_B: Number of frames in video B.

We provide an example here

Training Script Parameters

The following table summarizes the parameters used in the training script. You can adjust these values as needed for your experiments.

ParameterDescriptionExample Value
--lora_enableEnable LoRA tuning for the model.True
--vision_loraEnable LoRA tuning for the vision component.False
--freeze_vision_towerFreeze the vision tower parameters during training.False
--freeze_llmFreeze the language model parameters during training.False
--tune_mergerEnable tuning for the merger module(between the vision encoder and the LLM).True
--fpsFPS to sample from the video.2
--max_frame_pixelsMaximum number of pixels per frame allowed.200704(448*448)
--sample_typeFrame sampling strategy."uniform"
--lora_rLoRA Rank64
--lora_alphaLoRA Alpha128
--lora_namespan_excludeModel parts to exclude from LoRA tuning."['lm_head', 'rm_head', 'embed_tokens']"
--bf16Use bfloat16 precision training.True
--torch_dtypeTorch data type to use during training."bfloat16"
--num_lora_modulesNumber of LoRA modules to apply (-1 for all available modules).-1
--model_name_or_pathIdentifier or path for the pre-trained model.Qwen/Qwen2-VL-2B-Instruct
--meta_dataPath to the training metadata CSV file."./datasets/train/example.csv"
--meta_data_testPath to the valid metadata CSV file."./datasets/train/example.csv"
--data_dirDirectory of the training data."./datasets/train"
--output_dirDirectory where model outputs will be saved.rm_output
--eval_dimEvaluation dimensions (single dimension or multiple dimensions)."VQ" "MQ" "TA"
--output_dimNumber of output dimensions.1
--use_special_tokensEnable the use of special tokens during training.True
--reward_tokenThe token used to indicate reward in the text."special"
--loss_typeSpecifies the loss function type."btt"
--use_tied_dataUse tied data for training.True
--prompt_template_typeThe template type for input template."detailed_special"
--per_device_train_batch_sizeBatch size per device for training.1
--per_device_eval_batch_sizeBatch size per device for evaluation.4
--gradient_accumulation_stepsNumber of gradient accumulation steps.4
--num_train_epochsTotal number of training epochs.3
--learning_rateBase learning rate for training.2e-6
--merger_lrLearning rate for the merger module.2e-6
--vision_lrLearning rate for the vision components.2e-6
--special_token_lrLearning rate for the special tokens.2e-6
--report_toLogging backend for training reports.tensorboard
--warmup_ratioWarmup ratio for the learning rate scheduler.0.05
--lr_scheduler_typeType of learning rate scheduler."constant_with_warmup"
--eval_strategyStrategy for evaluation during training."steps"
--logging_epochsFrequency of logging (in terms of epochs).0.01
--eval_epochsFrequency of evaluation (in terms of epochs).0.1
--save_epochsFrequency of saving the model (in terms of epochs).0.25
--max_lengthMaximum sequence length(just to avoid OOM).6144
--gradient_checkpointingEnable gradient checkpointing to save memory.False
--deepspeedPath to the DeepSpeed configuration file.(zero0, zero2, zero3)ds_config/zero0.json
--save_only_modelSave only the model weights.True
--save_full_modelSave the full model (including optimizer states, etc.).False
--dataloader_num_workersNumber of workers for data loading.8

By following these guidelines and understanding the parameters, you can customize the training process to suit your specific needs.