Skip to content

the dog example of train_dreambooth_lora_flux.py can not convergence #9164

Description

@chongxian

Describe the bug

export MODEL_NAME="black-forest-labs/FLUX.1-dev"
export INSTANCE_DIR="dog"
export OUTPUT_DIR="trained-flux-lora"
accelerate launch train_dreambooth_lora_flux.py \
--pretrained_model_name_or_path=$MODEL_NAME \
--instance_data_dir=$INSTANCE_DIR \
--output_dir=$OUTPUT_DIR \
--mixed_precision="bf16" \
--instance_prompt="a photo of sks dog" \
--resolution=512 \
--train_batch_size=1 \
--gradient_accumulation_steps=4 \
--learning_rate=1e-5 \
--report_to="wandb" \
--lr_scheduler="constant" \
--lr_warmup_steps=0 \
--max_train_steps=500 \
--validation_prompt="A photo of sks dog in a bucket" \
--validation_epochs=25 \
--seed="0" \
--push_to_hub

I follow this command to train lora of flux-dev and download the dog-example from huggingFace, but this setting could not get better result, the loss is normal
image

the dog-example look like this:

alvan-nee-9M0tSjb-cpA-unsplash

but my result look like below:
dog0 (6)

and don't use the lora to generate image of the same prompt look like below:
dog0

Reproduction

import torch
from diffusers import FluxPipeline
pipe = FluxPipeline.from_pretrained("/opt/ml/volume/default/aigc/project/FLUX.1-dev",torch_dtype=torch.bfloat16)
pipe.enable_model_cpu_offload()
pipe.lora_state_dict("/opt/ml/volume/default/aigc/project/diffusers/examples/dreambooth/trained-flux-lora/checkpoint-500")
prompts = []
prompts.append("an sks dog")
index = 0
for prompt in prompts:
image = pipe(
prompt=prompt,
num_inference_steps=20,
guidance_scale=7.5,
max_sequence_length=512,
width=1152,
height=768
).images[0]
save_file = "dog"+str(index)+'.png'
index+=1
image.save(save_file)

Logs

No response

System Info

ubuntu 20.04

Who can help?

@sayakpaul@linoytsaban

Activity

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

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