Skip to content

AttributeError: type object 'Flux2ImageProcessor' has no attribute 'image_processor' #12778

@hannalaguilar

Description

@hannalaguilar

Describe the bug

I'm trying to run train_dreambooth_flux2_img2img.py from the DreamBooth examples, but I encountered this error. I inspected the Flux2ImageProcessor code in diffusers.pipelines.flux2.image_processor, and it turns out that Flux2ImageProcessor does not have an image_processor attribute. The same is true for the VaeImageProcessor class.

from diffusers.pipelines.flux2.image_processor import Flux2ImageProcessor


File "/home/datascience/flux2_img2img/train_lora.py", line 358, in __init__
[rank1]:     dest_image = Flux2ImageProcessor.image_processor._resize_to_target_area(dest_image, 1024 * 1024)
[rank1]:                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank1]: AttributeError: type object 'Flux2ImageProcessor' has no attribute 'image_processor'

Reproduction

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" 

### Logs

```shell

System Info

diffusers 0.36.0.dev0

Who can help?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions