Skip to content

train_dreambooth_lora.py Does not run on latest #3454

Description

@Ambrosiussen

Describe the bug

train_dreambooth_lora.py example no longer runs when installing diffusers from source.
If I run the script using the provided snippet, I get the following error.

Command run:
accelerate launch train_dreambooth_lora.py --pretrained_model_name_or_path="runwayml/stable-diffusion-v1-5" --instance_data_dir="./dog/" --output_dir="./out/" --instance_prompt="a photo of sks dog" --resolution=512 --train_batch_size=1 --gradient_accumulation_steps=1 --checkpointing_steps=100 --learning_rate=1e-4 --lr_scheduler="constant" --lr_warmup_steps=0 --max_train_steps=500 --validation_prompt="A photo of sks dog in a bucket" --validation_epochs=50 --seed="0"

I am feeding it the dataset of the dog example provided (5 images)

Traceback (most recent call last):
File "H:\Github\MLOPs\MLOPs\scripts\python\sdpipeline\train_dreambooth_lora.py", line 1351, in
main(args)
File "H:\Github\MLOPs\MLOPs\scripts\python\sdpipeline\train_dreambooth_lora.py", line 1142, in main
model_pred = unet(noisy_model_input, timesteps, encoder_hidden_states).sample
File "C:\Users\Paul\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "C:\Users\Paul\AppData\Local\Programs\Python\Python39\lib\site-packages\diffusers\models\unet_2d_condition.py", line 718, in forward
sample = self.conv_in(sample)
File "C:\Users\Paul\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "C:\Users\Paul\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\nn\modules\conv.py", line 463, in forward
return self._conv_forward(input, self.weight, self.bias)
File "C:\Users\Paul\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\nn\modules\conv.py", line 459, in _conv_forward
return F.conv2d(input, weight, bias, self.stride,
RuntimeError: Given groups=1, weight of size [320, 4, 3, 3], expected input[1, 3, 512, 512] to have 4 channels, but got 3 channels instead

Reproduction

Run: (The example on the Github page for Dreambooth training)

accelerate launch train_dreambooth_lora.py --pretrained_model_name_or_path="runwayml/stable-diffusion-v1-5" --instance_data_dir="./dog/" --output_dir="./out/" --instance_prompt="a photo of sks dog" --resolution=512 --train_batch_size=1 --gradient_accumulation_steps=1 --checkpointing_steps=100 --learning_rate=1e-4 --lr_scheduler="constant" --lr_warmup_steps=0 --max_train_steps=500 --validation_prompt="A photo of sks dog in a bucket" --validation_epochs=50 --seed="0"

Logs

No response

System Info

  • diffusers version: 0.17.0.dev0
  • Platform: Windows-10-10.0.22621-SP0
  • Python version: 3.9.10
  • PyTorch version (GPU?): 2.0.0+cu117 (True)
  • Huggingface_hub version: 0.14.1
  • Transformers version: 4.29.0.dev0
  • Accelerate version: 0.18.0
  • xFormers version: 0.0.19
  • Using GPU in script?: YES
  • Using distributed or parallel set-up in script?: NO

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