-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Unable to load FLUX.1-Canny-dev-lora into FluxControlPipeline #11464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @laolongboy I'm unable to reproduce this on my end. Could you try running in the example is a fresh virtual environment? |
Thanks for reply. I tried on another env and run successfully in diffusers==0.32.2. But same error occured in diffusers==0.33.1. |
@laolongboy Could you try updating PEFT to the latest version? |
Hello @laolongboy. Sorry about this. It was a conscious decision as it was getting increasingly difficult to support non-diffusers formats where there are non-ordinary state dict patterns. #10985 (comment) provides more context. So, the easiest thing would be to update your |
It works but I still feel confused. I load this lora into Flux.1-dev and run The only difference is x_embedder: ![]() As I analyzed in the beginning, FLUX.1-Canny-dev-lora concats canny input and noised input in channel dimension, so the base model and the lora model have different size in the first layer. In my understanding, the sizes of the base model(W) and the LoRA model(BA) should be completely aligned (out = Wx + BAx). Is there any problem with my understanding? Or some conversions completed internally in Diffusers or PEFT? |
I think we're now digressing from the original issue then. The issue, IIUC, was about not being able to load LoRAs. What you're telling now is a different problem and should come through a new issue thread. So, I would suggest closing this thread if you think that's okay and opening a new issue/discussion to clarify further doubts. |
I just want to know what's the reason behind this. I finally found where the magic happens and it has solved my doubt. Thanks🍺 |
Describe the bug
I tryied to run the example code of FLUX.1-Canny-dev-lora from https://huggingface.co/docs/diffusers/v0.33.1/en/api/pipelines/flux#canny-control, but get error:
RuntimeError: Error(s) in loading state_dict for FluxTransformer2DModel:
size mismatch for proj_out.lora_A.default_0.weight: copying a param with shape torch.Size([64, 3072]) from checkpoint, the shape in current model is torch.Size([128, 3072]).
size mismatch for proj_out.lora_B.default_0.weight: copying a param with shape torch.Size([64, 64]) from checkpoint, the shape in current model is torch.Size([64, 128]).
I checked the code inside the pipeline. It concats noisy tokens and condition tokens in the channel dimension, which change input shape from [batch, token_length, 64] to [batch, token_length, 128].
(https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/flux/pipeline_flux_control.py#L830-L831)
Therefore, the LoRA parameters of the first layer are inconsistent with the basic Flux model.
Reproduction
Logs
System Info
Who can help?
No response
The text was updated successfully, but these errors were encountered: