Uh oh!
There was an error while loading. Please reload this page.
Add stochastic sampling to FlowMatchEulerDiscreteScheduler - #11369
Conversation
This PR adds stochastic sampling to FlowMatchEulerDiscreteScheduler based on Lightricks/LTX-Video@b1aeddd ltx_video/schedulers/rf.py
HuggingFaceDocBuilderDev
commented
Apr 19, 2025
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
apolinario
commented
Apr 19, 2025
@bot /style |
Style fixes have been applied. View the workflow run here. |
| prev_sample = sample + dt * model_output | ||
| # Determine whether to use stochastic sampling for this step | ||
| use_stochastic = stochastic_sampling if stochastic_sampling is not None else self.config.stochastic_sampling |
There was a problem hiding this comment.
I think just have this in config is enough no?
apolinario
commented
Apr 21, 2025
@bot /style |
Style fixes have been applied. View the workflow run here. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| current_sigma = per_token_sigmas[..., None] | ||
| next_sigma = lower_sigmas[..., None] | ||
| dt = next_sigma - current_sigma # Equivalent to sigma_next - sigma |
There was a problem hiding this comment.
@apolinario
here it seems to reversed, no?
before:dt = (per_token_sigmas - lower_sigmas)[..., None]
now:dt = ower_sigmas - per_token_sigmas
nitinmukesh
commented
Apr 21, 2025
Quick question, Should it be LTXPipeline or LTXConditionPipeline? |
Co-authored-by: YiYi Xu <yixu310@gmail.com>
Co-authored-by: YiYi Xu <yixu310@gmail.com>
yiyixuxu
commented
Apr 22, 2025
thanks @apolinario ! |
yiyixuxu
commented
Apr 22, 2025
@nitinmukesh I think it's probably better in |
nitinmukesh
commented
Apr 22, 2025
Thank you for adding the sampling. Please could you share few sample outputs which you created. I am not getting good results so want to compare if something wrong in code. |
LTXPipeline. The model here is 0.9.6-distilled (the only one that uses the stochastic sampling as of now). "0.9.5" is included because the transformer and scheduler from 0.9.6 are inserted, which is fine because nothing else in the pipeline is different from 0.9.5 and there's currently nothing the lightricks 0.9.6 repos. 0.9.6-distilled is guidance distilled so it does not work in the condition pipeline, while 0.9.6 does |
Also, I find increasing the schedulers shift while using distilled helps to boost coherence. This is inline with FastVideo (PCM distillation) which says to set the shift to 17. The 1.0 in https://huggingface.co/multimodalart/ltxv-2b-0.9.6-distilled/blob/main/scheduler/scheduler_config.json doesn't seem like a good default. I'm unsure what it is in the original LTX repo Some different shifts0.25 0.25.mp40.5 0.5.mp41.0 1.mp42.0 2.mp44.0 4.mp48.0 8.mp416.0 16.mp432 32.mp464 64.mp416 seems like a good default (tested by adding |
nitinmukesh
commented
May 9, 2025
Thank you @Ednaordinary The information you provided is very helpful. Getting better results than before. distilled_scheduler1.mp4 |
nitinmukesh
commented
May 9, 2025
249 frames distilled_scheduler2.mp4 |
Ednaordinary
commented
May 9, 2025
Looks great! What I've noticed so far is that the background is often very repetitive in a weird way like shown in your 249 frame example. Sometimes this can be solved by increasing the shift to an insanely large amount (think in the 200s) but that also incurs everything else that comes from running shift that high (eventually, everything just turns into blobs) |
nitinmukesh
commented
May 9, 2025
Sure will try that, thank you. Next gonna try if distilled support image to video (LTXImageToVideoPipeline). |
I2V is working good. distilled_scheduler6.mp4Result from 0.9.1 using same image |
nitinmukesh
commented
May 10, 2025
What do you suggest for 0.9.6 dev, LTXPipeline or Conditioning pipeline, in case you tried. |
Ednaordinary
commented
May 10, 2025
0.9.6 should be the condition pipeline I'm pretty sure |
What does this PR do?
This PR adds stochastic sampling to FlowMatchEulerDiscreteScheduler based on Lightricks/LTX-Video@b1aeddd
ltx_video/schedulers/rf.py, which was added with th release of 0.9.6-distilled. I decoupled the next and current sigma to try to get closer to therf.pyimplementation of the stochastic sampling, but a second pair of eyes on this would be great.To try it:
Who can review?
@yiyixuxu