Commit Graph
7 Commits
Author SHA1 Message Date
dc3a62e0f2 [fix] api: route LTX-2 audio kwargs through batch.extra; strict update
* Public `VideoGenerator.generate_video(**kwargs)` was silently dropping
  every LTX-2 audio-conditioning kwarg (`audio_num_frames`,
  `ltx2_audio_clean_latent`, `ltx2_audio_denoise_mask`,
  `video_position_offset_sec`, `ltx2_audio_latents`).
  `SamplingParam.update()` `logger.error`'d on unknown fields and
  continued, so `apply_audio()` for continuation segments was
  effectively a no-op: audio was generated for the default num_frames
  duration and `ltx2_audio_latents` was never carried forward across
  segments.

* The downstream symptom on Dreamverse was a confusing ffmpeg
  "frame writer failed: [Errno 32] Broken pipe" on segment 2: trimmed
  audio ended ~1.7s before trimmed video, ffmpeg `-shortest` closed
  stdin, the writer thread's next `proc.stdin.write(...)` hit EPIPE.

* Port the FastVideo-internal routing block into public:
  - `_BATCH_EXTRA_PASSTHROUGH_KEYS` enumerates the 5 LTX-2 audio kwargs.
  - `_generate_video_impl` extracts them from `**kwargs` BEFORE
    `sampling_param.update()` and stashes as `kwargs["_extra_overrides"]`.
  - `_generate_single_video` pops `_extra_overrides` and copies into
    `batch.extra` so `ltx2_denoising` / `ltx2_refine` see them.
  - Surface `output_batch.extra["ltx2_audio_latents"]` in the result
    dict so `Dreamverse._derive_next_audio_latents` can carry latents
    across segments.

* Convert `SamplingParam.update()` to raise `ValueError` on unknown
  keys instead of `logger.error`-and-continue. Future contributors who
  add a pipeline-specific kwarg without registering it will hit a loud
  failure pointing at `_BATCH_EXTRA_PASSTHROUGH_KEYS` rather than
  debug a broken-pipe-shaped symptom hours later.

* Add `fastvideo/tests/api/test_extra_overrides_routing.py` (7 tests)
  pinning the passthrough-key set, the strict-update contract, and the
  error-message hint at the right routing mechanism.

Verified end-to-end on GPU 4 with the dreamverse-deploy skill: segment 2
streams 22 av chunks / 3.8MB clean, no BrokenPipeError, `Cached audio
latents shape=(1, 8, 126, 16)` log line confirms latents now carry.
185/185 fastvideo/tests/api/ tests pass.

Co-authored-by: Junda (David) Su <90978028+Davids048@users.noreply.github.com>
Co-authored-by: Matthew Noto <99706358+RandNMR73@users.noreply.github.com>
Co-authored-by: XOR-op <17672363+XOR-op@users.noreply.github.com>
Co-authored-by: Zhang Peiyuan <42993249+jzhang38@users.noreply.github.com>
2026-05-07 13:37:26 -07:00
a62b8e1e8e feat(ltx2): full i2v conditioning + continuation latent port
Replaces the T2V-only stub with the full internal port:

* resolve_ltx2_images / _resize_and_center_crop / CRF re-encode
* load_ltx2_conditioning_image + load_ltx2_conditioning_video_clip
* _extract_video_latent / _insert_conditioning_latent
* build_ltx2_image_conditioning composes (clean_latent, denoise_mask)
  from images + video clips + continuation latents (stage1 vs stage2)
  — returns None for plain T2V

ForwardBatch + SamplingParam gain the missing fields the builder
reads (ltx2_images, ltx2_image_crf, ltx2_conditioning_latent_stage1/2,
ltx2_video_conditions). generate_video kwargs flow through
sampling_param.update -> ForwardBatch(**shallow_asdict(...)) so
Dreamverse's ltx2_image_crf=0.0 and continuation latents land on the
batch correctly.

68/68 LTX-2 tests still green.

Co-authored-by: Junda (David) Su <90978028+Davids048@users.noreply.github.com>
Co-authored-by: Matthew Noto <99706358+RandNMR73@users.noreply.github.com>
Co-authored-by: XOR-op <17672363+XOR-op@users.noreply.github.com>
Co-authored-by: Zhang Peiyuan <42993249+jzhang38@users.noreply.github.com>
2026-05-07 13:37:25 -07:00
f7103015a1 fix(api): align public SamplingParam ltx2 defaults with distilled
Internal FastVideo declares two LTX-2 SamplingParam variants:
LTX2SamplingParam (mod=3.0/rescale=0.7/stg=1.0 — full LTX-2) and
LTX2DistilledSamplingParam (mod=1.0/rescale=0.0/stg=0.0). Dreamverse
production runs against LTX2-Distilled-Diffusers, so the distilled
defaults are what the runtime should land on.

The public package only has the single SamplingParam class, and its
class-level defaults for these knobs were the *full* LTX-2 values.
Result: when Dreamverse (or any other consumer) called
``SamplingParam.from_pretrained("FastVideo/LTX2-Distilled-Diffusers")``,
the LTX2_DISTILLED preset's defaults dict didn't override these
fields (it didn't list them) so they fell through to the class
defaults — silently picking up *full*-model CFG / modality / rescale /
STG instead of the distilled ones. Streamed video output diverged
from the internal-ui reference.

Switch the class defaults to the distilled values (1.0 / 0.0 / 0.0).
The LTX2_BASE preset already overrides them explicitly to 3.0/0.7/1.0
in its ``defaults`` dict, so users selecting the full-LTX-2 preset
keep the full-model behavior.

The numerical alignment harness still reproduces the same 42.72 dB
PSNR / 52.87% exact pixel match because that test pinned the values
explicitly via legacy kwargs; this fix moves the *default* path on
the public side onto the same numerical track.

Co-authored-by: Junda (David) Su <90978028+Davids048@users.noreply.github.com>
Co-authored-by: Matthew Noto <99706358+RandNMR73@users.noreply.github.com>
Co-authored-by: XOR-op <17672363+XOR-op@users.noreply.github.com>
Co-authored-by: Zhang Peiyuan <42993249+jzhang38@users.noreply.github.com>
2026-05-07 13:37:25 -07:00
William Lin c77a76c6af [feat] Stable Audio Open 1.0: T2A + A2A + RePaint inpainting (native) (#1260) 2026-05-01 00:07:11 -07:00
William Lin e0dc5f2b0c [feat] Add typed LTX-2 continuation state and streaming session store (#1250) 2026-04-24 01:28:07 -07:00
William Lin 70ee5d230c [feat] [6/n] Improve API: LTX-2 public preset + asset wiring + gpu_pool translation (#1239) 2026-04-23 11:36:45 -07:00
William Lin 145a3f166b [feat] [4/n] Improve API: refactor sampling param and merge with presets (#1234) 2026-04-16 14:10:02 -07:00