huggingface / diffusers

🤗 Diffusers: State-of-the-art diffusion models for image and audio generation in PyTorch and FLAX.
https://huggingface.co/docs/diffusers
Apache License 2.0
25.66k stars 5.3k forks source link

FlowMatch schedulers - closing the gap #9607

Open vladmandic opened 2 weeks ago

vladmandic commented 2 weeks ago

As stated here, lets close the scheduler gap!

Problem statement:

(just for completeness, there is also an older implementation of FlowMatchHeunDiscreteScheduler, but its not updated to support required set_timesteps or mu inputs, so it cannot be used with newer DiT models like Flux.1)

on the other hand, ComfyUI allows use of any regular scheduler with DiT and does not require separate duplicate -FlowMatch variant of the same scheduler (e.g. EulerDiscrete vs FlowMatchEulerDiscrete) with Flux.1.

reference: matrix of different schedulers used with Flux.1.Dev via ComfyUI:
https://civitai.com/articles/6582/flux1-dev-sampler-scheduler-comparison

cc: @yiyixuxu @sayakpaul @DN6 @asomoza

yiyixuxu commented 1 week ago

cc @hlky here too if interested!

hlky commented 1 week ago

I'd have to dig into FlowMatch a bit more in the community implementations, but it looks like there's little difference between EulerDiscrete and FlowMatchEulerDiscrete so FlowMatchEulerDiscrete could be integrated into EulerDiscrete controlled by some configuration option, this would avoid the need for separate duplicate variants and reduce maintenance burden - as there's already some divergence between schedulers, in set_timesteps for example, where some support sigmas/timesteps as input and others don't, support for final_sigmas_type, etc. Schedulers as a whole could probably do with an overhaul.