Skip to content

Refactor: Flexible model architecture for dit models (Flux & SD3) #490

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

Merged
merged 12 commits into from
Nov 30, 2024

Conversation

stduhpf
Copy link
Contributor

@stduhpf stduhpf commented Nov 29, 2024

(Built on top of #455)

Motivations:

I stumbled upon this: https://huggingface.co/TencentARC/flux-mini, and thought it would be nice to run it on sdcpp.

The number of variants Flux and MMDiT (SD3.x) models supported is starting to get a bit overwhelming (3 each so far), and if people keep making these kinds of distillations or self merges, it would be impossible to support them all individually.

With this PR, the number of layers for each kind of block and the presence of some optional features is inferred from the tensor names in the model file when initializing the model runner, making it a lot more flexible.

New models supported with these chages (examples):

@leejet leejet merged commit 7ce63e7 into leejet:master Nov 30, 2024
7 of 9 checks passed
@leejet
Copy link
Owner

leejet commented Nov 30, 2024

Thank you for your contribution.

stduhpf added a commit to stduhpf/stable-diffusion.cpp that referenced this pull request Dec 8, 2024
…#490)

* Refactor: wtype per tensor

* Fix default args

* refactor: fix flux

* Refactor photmaker v2 support

* unet: refactor the refactoring

* Refactor: fix controlnet and tae

* refactor: upscaler

* Refactor: fix runtime type override

* upscaler: use fp16 again

* Refactor: Flexible sd3 arch

* Refactor: Flexible Flux arch

* format code

---------

Co-authored-by: leejet <[email protected]>
@stduhpf stduhpf deleted the refactor-dit-setup branch January 1, 2025 15: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.

2 participants