kohya-ss / sd-scripts

Apache License 2.0
4.98k stars 835 forks source link

Merge Flux all in one #1565

Open oovm opened 2 weeks ago

oovm commented 2 weeks ago

I'm glad to see that merging clip weights is now supported today.

I wonder if it's possible to merge all weights (clip, t5, unet, vae) into one file for ComfyUI to use.

Each part of the input (clip, t5, unet, vae, lora) is a separate .safetensors

kohya-ss commented 2 weeks ago

I'm not sure if this is possible, but I would like to have a sample of the merged .safetensors, so if possible, could you tell me where I can download one of them?

oovm commented 2 weeks ago

The complete flux model should be 17.2GB:

https://huggingface.co/Comfy-Org/flux1-dev/tree/main?show_file_info=flux1-dev-fp8.safetensors

And the difference from the original folder structure is as follows:

scheduler/                # not mapping
text_encoder/             # -> text_encoders.clip_l.transformer.{KEY}
?                         # -> text_encoders.clip_l.logit_scale
text_encoder_2/           # -> text_encoders.t5xxl.transformer.{KEY}
?                         # -> text_encoders.t5xxl.logit_scale
tokenizer/                # no weights
tokenizer_2/              # no weights
transformer/              # not mapping?
vae/                      # not mapping?
ae.safetensors            # -> vae.{KEY}
flux1-dev.safetensors     # -> model.diffusion_model.{KEY}