Spaces:
Running on Zero
Running on Zero
Switch long clips to the adaptive schedule, which is what was breaking them
Browse files- scripts/ltx_av_generate.py +18 -0
scripts/ltx_av_generate.py
CHANGED
|
@@ -28,6 +28,14 @@ sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
| 28 |
|
| 29 |
import ltx_av_guide as guide
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
class LTXEngine:
|
| 33 |
"""Loaded LTX-2.5 models plus the three generation modes.
|
|
@@ -143,6 +151,16 @@ class LTXEngine:
|
|
| 143 |
elif mode != "t2v":
|
| 144 |
raise SystemExit(f"unknown mode {mode!r}")
|
| 145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
sigmas = render.build_sigmas(
|
| 147 |
self.model, sigmas_text or render.DISTILLED_SIGMAS, steps, scheduler,
|
| 148 |
latent=latent)
|
|
|
|
| 28 |
|
| 29 |
import ltx_av_guide as guide
|
| 30 |
|
| 31 |
+
#: Past this many seconds the fixed distilled schedule stops converging on the
|
| 32 |
+
#: larger latent: ghosting, and roughly half the saturation of a short clip.
|
| 33 |
+
ADAPTIVE_SCHEDULE_SECONDS = 15.0
|
| 34 |
+
|
| 35 |
+
#: Steps for the adaptive schedule once it takes over. Eight leaves hands and
|
| 36 |
+
#: fabric soft; twenty does not. More was not tried.
|
| 37 |
+
ADAPTIVE_STEPS = 20
|
| 38 |
+
|
| 39 |
|
| 40 |
class LTXEngine:
|
| 41 |
"""Loaded LTX-2.5 models plus the three generation modes.
|
|
|
|
| 151 |
elif mode != "t2v":
|
| 152 |
raise SystemExit(f"unknown mode {mode!r}")
|
| 153 |
|
| 154 |
+
# The nine distilled sigmas are fixed numbers solved at the lengths the
|
| 155 |
+
# distillation used. `LTXVScheduler` derives its shift from the latent's
|
| 156 |
+
# own token count instead, and past roughly fifteen seconds the fixed
|
| 157 |
+
# ones leave the sample unconverged - ghosting, and half the saturation.
|
| 158 |
+
# Measured at 25 s: saturation 0.094 fixed against 0.108 adaptive, and
|
| 159 |
+
# the ghosting is gone. So switch by default rather than make the caller
|
| 160 |
+
# know, and let an explicit `steps` override it either way.
|
| 161 |
+
if steps <= 0 and length / float(fps) > ADAPTIVE_SCHEDULE_SECONDS:
|
| 162 |
+
steps, scheduler = ADAPTIVE_STEPS, "ltxv"
|
| 163 |
+
print(f"long clip: {steps}-step adaptive schedule", flush=True)
|
| 164 |
sigmas = render.build_sigmas(
|
| 165 |
self.model, sigmas_text or render.DISTILLED_SIGMAS, steps, scheduler,
|
| 166 |
latent=latent)
|