Skip to content

Conversation

@leisuzz
Copy link
Contributor

@leisuzz leisuzz commented Dec 11, 2025

What does this PR do?

I'm training the flux2 img2img with 8 GPUs, the running scripts is using the script from examples/dreambooth/README_flux2.md:

bash
accelerate launch train_dreambooth_lora_flux2_img2img.py \
  --pretrained_model_name_or_path=black-forest-labs/FLUX.2-dev  \
  --output_dir="flux2-i2i" \
  --dataset_name="kontext-community/relighting" \
  --image_column="output" --cond_image_column="file_name" --caption_column="instruction" \
  --do_fp8_training \
  --gradient_checkpointing \
  --remote_text_encoder \
  --cache_latents \
  --resolution=1024 \
  --train_batch_size=1 \
  --guidance_scale=1 \
  --gradient_accumulation_steps=4 \
  --gradient_checkpointing \
  --optimizer="adamw" \
  --use_8bit_adam \
  --cache_latents \
  --learning_rate=1e-4 \
  --lr_scheduler="constant_with_warmup" \
  --lr_warmup_steps=200 \
  --max_train_steps=1000 \
  --rank=16\
  --seed="0" 

There are three different errors occured, and this PR is doing these fix:

  1. Fix the issue that --instance_prompt is required as True, but the script does not need it.

  2. Fix the error:
    AttributeError: type object 'Flux2ImageProcessor' has no attribute 'image_processor'

  3. Fix the error:
    AttributeError: 'Tensor' object has no attribute 'load'

The dest_image has to be converted to PIL to keep the same logic after preprocess .

  1. Fix the issue that validation_image is required to be loaded, but the datasets relighting and the script does not provide it
validation_image = load_image(args.validation_image_path).convert("RGB")
validation_kwargs = {"image": validation_image}

Before submitting

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@leisuzz
Copy link
Contributor Author

leisuzz commented Dec 13, 2025

@sayakpaul Please take a look at this PR, thank you!

Copy link
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants