huggingface / huggingface/diffusers

Flux Inference memory optimisation by pre-computing modulation parameters ahead of time

Open
#9,197 3 comments 2 reactions 0 assignees View on GitHub
stale
Dominant language
Python
Stars
34.5k
Forks
7.3k
Avg merge
3d 3h
Merged PRs (30d)
91

Description

DiffusionKit has an excellent memory optimisation for Flux where it calculates modulation parameters ahead of time
then offloads the adaLN_modulation parameters which for fp16 saves ~ 6.5 GB peak memory usage during inference.

https://github.com/argmaxinc/DiffusionKit/pull/15/

It would be nice if a similar change could be made to Diffusers.

It's especially useful for MPS users who are getting left behind with the current trend using quantisation to reduce memory usage rather than optimisation and for whom CPU offloading is not a thing.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.