#!/bin/bash
export MODEL_PATH="../pretrained_weights/CogVideoX1.5-5B" # YOUR CHECKPOINT PATH
export CACHE_PATH="~/.cache"
export DATASET_PATH="" # YOUR DATASET ROOT
export OUTPUT_PATH="" # YOUR PATH
export TRAIN_NUM=5
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
export CUDA_VISIBLE_DEVICES=0,1

# if you are not using wth 2 gus, change `accelerate_config_machine_single.yaml` num_processes as your gpu number
accelerate launch --config_file accelerate_config_machine_single.yaml --multi_gpu \
  train_ip_lora.py \
  --pretrained_model_name_or_path $MODEL_PATH \
  --cache_dir $CACHE_PATH \
  --instance_data_root $DATASET_PATH \
  --video_column videos.txt \
  --caption_column prompts.txt \
  --instance_clolumn instance.txt \
  --seed 42 \
  --rank 256 \
  --lora_alpha 256 \
  --mixed_precision bf16 \
  --output_dir $OUTPUT_PATH \
  --height 512 \
  --width 512 \
  --fps 16 \
  --skip_frames_start 0 \
  --skip_frames_end 0 \
  --train_batch_size 44 \
  --num_train_epochs $TRAIN_NUM \
  --checkpointing_steps 1000 \
  --gradient_accumulation_steps 1 \
  --learning_rate 1e-4 \
  --lr_scheduler constant_with_warmup \
  --lr_warmup_steps 500 \
  --lr_num_cycles 1 \
  --gradient_checkpointing \
  --optimizer AdamW \
  --adam_beta1 0.9 \
  --adam_beta2 0.95 \
  --max_grad_norm 1.0 \
  --allow_tf32 \
  --report_to wandb \
  --num_frames 1 \
