Skip to content

fix diffuser save_lora_weights crash#1633

Closed
sywangyi wants to merge 1 commit intov1.15-releasefrom
diffusers_fix
Closed

fix diffuser save_lora_weights crash#1633
sywangyi wants to merge 1 commit intov1.15-releasefrom
diffusers_fix

Conversation

@sywangyi
Copy link
Copy Markdown
Collaborator

fix crash in train_dreambooth_lora_sdxl.py in save_lora_weights
python ../../gaudi_spawn.py --world_size 8 --use_mpi train_dreambooth_lora_sdxl.py --pretrained_model_name_or_path="stabilityai/stable-diffusion-xl-base-1.0" --instance_data_dir="dog" --pretrained_vae_model_name_or_path="madebyollin/sdxl-vae-fp16-fix" --output_dir="lora-trained-xl" --mixed_precision="bf16" --instance_prompt="a photo of sks dog" --resolution=1024 --train_batch_size=1 --gradient_accumulation_steps=4 --learning_rate=1e-4 --lr_scheduler="constant" --lr_warmup_steps=0 --max_train_steps=100 --validation_prompt="A photo of sks dog in a bucket" --validation_epochs=25 --seed=0 --use_hpu_graphs_for_inference --use_hpu_graphs_for_training --gaudi_config_name Habana/stable-diffusion

Signed-off-by: Wang, Yi A <yi.a.wang@intel.com>
@sywangyi
Copy link
Copy Markdown
Collaborator Author

File "/root/optimum/optimum-habana/examples/stable-diffusion/training/train_dreambooth_lora_sdxl.py", line 1768, in
main(args)
File "/root/optimum/optimum-habana/examples/stable-diffusion/training/train_dreambooth_lora_sdxl.py", line 1679, in main
GaudiStableDiffusionXLPipeline.save_lora_weights(
File "/usr/local/lib/python3.10/dist-packages/optimum/habana/diffusers/pipelines/pipeline_utils.py", line 411, in save_lora_weights
return super().save_lora_weights(
File "/usr/local/lib/python3.10/dist-packages/diffusers/loaders/lora_pipeline.py", line 1023, in save_lora_weights
state_dict.update(cls.pack_weights(text_encoder_2_lora_layers, "text_encoder_2"))
File "/usr/local/lib/python3.10/dist-packages/diffusers/loaders/lora_base.py", line 716, in pack_weights
layers_state_dict = {f"{prefix}.{module_name}": param for module_name, param in layers_weights.items()}
AttributeError: 'bool' object has no attribute 'items'

@regisss
Copy link
Copy Markdown
Collaborator

regisss commented Dec 19, 2024

@sywangyi I merged #1626 as the change there is more generic

@regisss regisss closed this Dec 19, 2024
@regisss regisss deleted the diffusers_fix branch December 19, 2024 10:12
@sywangyi
Copy link
Copy Markdown
Collaborator Author

#1626 could not fix the crash in train_dreambooth_lora_sdxl , #1633 could fix both crash "train_dreambooth_lora_sdxl" and ddpo

@sywangyi sywangyi restored the diffusers_fix branch December 19, 2024 12:23
@sywangyi sywangyi reopened this Dec 19, 2024
@regisss
Copy link
Copy Markdown
Collaborator

regisss commented Dec 19, 2024

@sywangyi Please take a look at #1643 and let me know if that works on your side too. It should enable us to keep a generic solution while solving this issue for good.

@sywangyi
Copy link
Copy Markdown
Collaborator Author

@sywangyi Please take a look at #1643 and let me know if that works on your side too. It should enable us to keep a generic solution while solving this issue for good.

see comment in #1643

@sywangyi sywangyi closed this Dec 20, 2024
@regisss regisss deleted the diffusers_fix branch December 20, 2024 07:48
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