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

Script to merge Flux diffuser into 1 safetensor file #10137

Closed
pivtienduc opened this issue Dec 6, 2024 · 7 comments · May be fixed by #10193
Closed

Script to merge Flux diffuser into 1 safetensor file #10137

pivtienduc opened this issue Dec 6, 2024 · 7 comments · May be fixed by #10193

Comments

@pivtienduc
Copy link

pivtienduc commented Dec 6, 2024

Hi everyone

I found Flux model which is split into 3 parts. So far I can't find any script to merge splitted parts of Flux model into one

Can anyone help me to do it

image

Thank in advance

@a-r-r-o-w
Copy link
Member

You can load the model using from_pretrained and save it again, but by specifying max_shard_size="30GB" to get a single large file. The docs for loading/saving pipelines contains more info about from_pretrained and save_pretrained.

@punitvara
Copy link

@hlky Should we close this issue as PR is already raised for this ?

@pivtienduc
Copy link
Author

@hlky Should we close this issue as PR is already raised for this ?

Yes I will close it

@hlky
Copy link
Member

hlky commented Feb 24, 2025

Typically issues are not closed until they are resolved i.e. by a PR merging.

@pivtienduc
Copy link
Author

Typically issues are not closed until they are resolved i.e. by a PR merging.

Actually I found another way to solve it so don't need this one anymore

@clort81
Copy link

clort81 commented Mar 10, 2025

Typically issues are not closed until they are resolved i.e. by a PR merging.

Actually I found another way to solve it so don't need this one anymore

It would have been helpful to others if you had shared the solution you found here.

Please take note that yours was uncooperative behavior, then reflect upon it before making future requests for help from the community.

@hlky
Copy link
Member

hlky commented Mar 10, 2025

Hi @clort81, here's an example of max_shard_size.

from diffusers import DiffusionPipeline, FluxTransformer2DModel

pipeline = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell")
pipeline.save_pretrained("FLUX.1-schnell/", max_shard_size="30GB")

transformer = FluxTransformer2DModel.from_pretrained("black-forest-labs/FLUX.1-schnell", subfolder="transformer")
transformer.save_pretrained("FLUX.1-schnell/transformer/", max_shard_size="30GB")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants