Skip to content
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

Loading Flux Dev transformers from_single_file fails since support for Flux Fill was added #10540

Closed
dxqbYD opened this issue Jan 12, 2025 · 5 comments
Labels
bug Something isn't working

Comments

@dxqbYD
Copy link

dxqbYD commented Jan 12, 2025

Describe the bug

Flux models are sometimes distributed as transformer only, because all the other pipeline components are usually not changed.

Examples include:

Since support for Flux Fill was added here 862a7d5, diffusers.FluxTransformer2DModel.from_single_file fails to load these files:

File "/.../src/diffusers/src/diffusers/loaders/single_file_utils.py", line 598, in infer_diffusers_model_type
    if checkpoint["img_in.weight"].shape[1] == 384:
       ~~~~~~~~~~^^^^^^^^^^^^^^^^^
KeyError: 'img_in.weight'

Reproduction

Download one of the example mentioned above, and run

from diffusers import FluxTransformer2DModel

transformer = FluxTransformer2DModel.from_single_file(your_file)

Logs

No response

System Info

HEAD

Who can help?

@DN6

@dxqbYD
Copy link
Author

dxqbYD commented Jan 12, 2025

the bnb-nf4 checkpoint linked above is apparently not only the transformer - but it has the same problem anyway. Other affected transformer-only files can be found on CivitAI, or generated using this Comfy workflow: https://civitai.com/models/982277/flux-lora-merge

@DN6
Copy link
Collaborator

DN6 commented Jan 13, 2025

@dxqbYD I'm not sure the bnb checkpoint will load. We don't support bnb single checkpoints at the moment. But for the others, can you try loading with this branch?
#10545

@DN6
Copy link
Collaborator

DN6 commented Jan 13, 2025

@dxqbYD Do you have a link to a specific checkpoint that is failing to load that isn't a bnb NF4 checkpoint?

@dxqbYD
Copy link
Author

dxqbYD commented Jan 13, 2025

@dxqbYD I'm not sure the bnb checkpoint will load. We don't support bnb single checkpoints at the moment. But for the others, can you try loading with this branch? #10545

Can confirm that this PR works on all my test cases, which are:

Thanks for your quick reaction!

@yiyixuxu
Copy link
Collaborator

closing as fixed in #10545

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants