diffusers icon indicating copy to clipboard operation
diffusers copied to clipboard

Text encoder errors in both SD3 dreambooth training scripts

Open neuron-party opened this issue 1 year ago • 6 comments

Describe the bug

Multiple mismatched argument errors in train_dreambooth_sd3.py when training with train_text_encoder set to True. Ordering/assignment errors in train_dreambooth_lora_sd3.py when training with train_text_encoder set to True.

Reproduction

set --train_text_encoder and all other necessary args appropriately

Logs

For train_dreambooth_sd3.py: encode_prompt got unexpected argument text_input_ids

For train_dreambooth_lora_sd3.py UnboundLocalError: local variable 'text_encoder_one' referenced before assignment

No response

System Info

diffusers from source (bleeding edge)

Who can help?

No response

neuron-party avatar Jun 28 '24 00:06 neuron-party

Possible to share your exact training command?

Cc: @linoytsaban here.

sayakpaul avatar Jun 28 '24 02:06 sayakpaul

@sayakpaul Sure

Essentially the same for both train_dreambooth_lora_sd3.py and train_dreambooth_sd3.py, the only difference is that i specify the rank for the lora script. I train on A100s.

accelerate launch --config_file config_file_path train_dreambooth_lora_sd3.py (or train_dreambooth_sd3.py)
 --mixed_precision=fp16
 --resolution=1024
 --pretrained_model_name_or_path=stabilityai/stable-diffusion-3-medium-diffusers
 --num_validation_images=8
 --validation_epochs=100
 --train_batch_size=2
 --lr_scheduler=cosine
 --checkpointing_steps=200
 --report_to=tensorboard
 --train_text_encoder
 --instance_prompt=xyz
 --instance_data_dir=xyz
 --validation_prompt=xyz
 --max_train_steps=1600
 --rank=64
 --learning_rate=5e-6
 --text_encoder_lr=1e-6
 --output_dir=xyz
 --logging_dir=xyz

neuron-party avatar Jun 28 '24 03:06 neuron-party

@linoytsaban could you take a look here?

sayakpaul avatar Jun 28 '24 06:06 sayakpaul

hey @neuron-party! just to make sure, you're using only the instance prompt - no custom prompts per image?

linoytsaban avatar Jun 28 '24 07:06 linoytsaban

@linoytsaban Yup

neuron-party avatar Jun 28 '24 18:06 neuron-party

hey @neuron-party! could you please try again with the PR #8755 script? when I ran an experiment with text encoder training & no custom instance prompts I also got an error (that is fixed by #8755) but it was a different one than you got

linoytsaban avatar Jul 01 '24 11:07 linoytsaban

@linoytsaban Sorry for the late reply, I'm running into some function errors on train_dreambooth_sd3.py

TypeError: encode_prompt() got an unexpected keyword argument text_input_ids_list

train_dreambooth_lora_sd3.py seems to be working now though. Thanks for the fixes!

neuron-party avatar Jul 12 '24 03:07 neuron-party

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

github-actions[bot] avatar Sep 14 '24 15:09 github-actions[bot]