export NCCL_P2P_DISABLE=0
export NCCL_P2P_LEVEL=NVL
project_path=$(realpath -es .)
export PYTHONPATH=$PYTHONPATH:${project_path}/data
export CAUGHT_ALL_EXCEPTIONS=1
validation_prompt="val_6_views.json"
dataset_name_1="training_data_path1"
dataset_name_2="training_data_path2"
dataset_name_3="training_data_path3"
dataset_name_4="training_data_path4"   
   # --resume_from_checkpoint= None \ --both_ccm_normal_condition
python \
    launch.py \
    --pretrained_model_name_or_path="pretrain_models/black-forest-labs/FLUX.1-dev" \
    --pretrained_redux_name_or_path="pretrain_models/black-forest-labs/FLUX.1-Redux-dev" \
    --dataset_name_list "${dataset_name_1}" "${dataset_name_2}" "${dataset_name_3}" "${dataset_name_4}" \
    --use_complex_dataset \
    --six_views_or_four_views \
    --dataloader_num_workers=0 \
    --output_dir="output/flux_texture_train" \
    --dual_image \
    --resume_from_checkpoint="latest" \
    --control_image \
    --both_ccm_normal_condition \
    --mixed_precision="bf16" \
    --resolution 512 3072 \
    --n_rows 1 \
    --n_cols 6 \
    --lora_rank=16 \
    --lora_alpha=16 \
    --optimizer="prodigy" \
    --cond_image_type='rgb' \
    --learning_rate=1.0 \
    --guidance_scale=1.0 \
    --max_train_steps=20000 \
    --validation_steps=10000000 \
    --validation_prompt "${validation_prompt}" \
    --num_validation_images=1 \
    --checkpointing_steps=500 \
    --train_batch_size=1 \
    --gradient_accumulation_steps=8 \
    --gradient_checkpointing \
    --multiscale_training_heights 128 256 512 \
    --multiscale_training_widths 128 256 512 \
    --multiscale_training_probabilities 0.25 0.5 0.2 \
    --multiscale_training_step_range 0 10000 \
    --random_drop_noise \
    --random_drop_noise_probability 0.75 \
    --random_drop_condition \
    --random_drop_condition_probability 0.25 \
    --attn_random_drop_noise_probability 0.5 \
    --attn_random_drop_condition_probability 0.7 \
    --report_to="tensorboard" \
    --tasks='texturing' \
    --seed=666