Promote the refine-override field accessors to module-level frozenset
constants (``REFINE_PRESET_OVERRIDE_FIELDS``,
``REFINE_STAGE_OVERRIDE_FIELDS``, ``REFINE_FLAT_KEYS``) so callers
reference a single source of truth instead of recomputing on each
call. Drop the redundant ``dict(deepcopy(value))`` double-copy on the
``torch_compile_kwargs`` legacy path, compress the
``_compile_config_to_torch_kwargs`` docstring, and remove a handful of
comments that just restated the code or named a future PR. Narrow the
schema-parity ``walk_packages`` traversal to
``configs/pipelines/*`` and ``basic/<family>/pipeline_configs`` so the
test no longer imports every heavy model module under ``basic/``.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Post-review cleanup (no behavior change):
Correctness:
* compat.py refine reverse-flatten now iterates
_LTX2_REFINE_FLAT_KEYS, which unions the typed
LTX2RefinePresetOverride and LTX2RefineStageOverride field sets.
The previous hardcoded 4-tuple missed image_crf and
video_position_offset_sec, so any init-time
preset_overrides.refine.image_crf would silently drop on reverse.
New regression test TestRefineFlattenCoversAllTypedFields pins the
invariant.
Simplification:
* refine_preset_override_to_dict and refine_stage_override_to_dict
were byte-identical; collapse to a single refine_override_to_dict.
* Trim narrative / PR-migration prose from docstrings and re-export
shims: stage_overrides.py module + field docstrings, schema.py
CompileConfig + PipelineSelection.vae_tiling, presets.py
LTX2_TWO_STAGE header, configs/pipelines/__init__.py and
pipelines/stages/__init__.py and ltx2/stages/__init__.py.
Close out PR 6 with the compat mappings for every flat LTX-2 kwarg
the FastVideo-internal ui/ltx2-streaming/server/gpu_pool.py passes to
VideoGenerator.from_pretrained, plus an integration test that freezes
the gpu_pool load_kwargs dict as a parity guard.
Compat additions (fastvideo/api/compat.py):
legacy_from_pretrained_to_config forward routing for:
- config_model_path -> components.config_root
- ltx2_refine_enabled -> preset_overrides.refine.enabled
- ltx2_refine_upsampler_path -> components.upsampler_weights
(empty string collapses to None)
- ltx2_refine_lora_path -> components.lora_path
(empty string collapses to None)
- ltx2_refine_add_noise -> preset_overrides.refine.add_noise
- ltx2_refine_num_inference_steps -> preset_overrides.refine.num_inference_steps
- ltx2_refine_guidance_scale -> preset_overrides.refine.guidance_scale
generator_config_to_fastvideo_args reverse routing:
- components.config_root -> config_model_path
- components.upsampler_weights -> ltx2_refine_upsampler_path
(no longer raises NotImplementedError)
- preset_overrides.refine.{...} now flattens back to
ltx2_refine_{enabled, add_noise, num_inference_steps, guidance_scale}
instead of leaking as a nested "refine" kwarg.
PR 7.6 (gpu_pool upstream) and the Dynamo adapter can now build a typed
GeneratorConfig from their CLI without knowing any legacy LTX-2 kwarg
name — the hard gate called out in PR plan.md § "Why the gpu_pool.py
typed-replacement scope matters".
Tests (fastvideo/tests/api/test_ltx2_gpu_pool_translation.py):
- GPU_POOL_LOAD_KWARGS fixture mirrors gpu_pool.py lines 233-260
(minus opaque objects: PipelineConfig instance, the text-encoder
torch.compile flag not yet in the public FastVideoArgs).
- TestGpuPoolForwardTranslation asserts each flat kwarg lands on the
correct typed field and that pipeline.experimental stays empty
(no silent fallthrough).
- TestGpuPoolReverseTranslation asserts the same dict reproduces on
the FastVideoArgs.from_kwargs call — including the four ltx2_refine_*
fields, ltx2_vae_tiling, torch_compile_kwargs, and config_model_path.
- TestCompileExtrasPreserved checks non-typed torch.compile kwargs
(options, disable) ride through CompileConfig.extras in both
directions.
All 148 API tests pass locally (227 including entrypoints).
Promote the four torch.compile kwargs the FastVideo-internal
ltx2-streaming gpu_pool hard-codes in its torch_compile_kwargs dict
into first-class typed fields on CompileConfig, and add a typed home
for ltx2_vae_tiling on PipelineSelection so PR 7.6's public gpu_pool
upstream has a typed boundary to hit.
Schema changes (fastvideo/api/schema.py):
CompileConfig:
- rename kwargs -> extras (breaking; pre-stable API)
- add backend: str | None (e.g. "inductor")
- add fullgraph: bool | None
- add mode: str | None (e.g. "max-autotune-no-cudagraphs")
- add dynamic: bool | None
extras still holds uncommon kwargs (e.g. options, disable).
PipelineSelection:
- add vae_tiling: bool | None. Shared across model families that
expose VAE tiling (LTX-2, Wan configs, etc.); None leaves the
model default in place.
Compat (fastvideo/api/compat.py):
- legacy_from_pretrained_to_config splits incoming
torch_compile_kwargs={backend, fullgraph, mode, dynamic, ...}
across the four typed fields and drops the remainder into extras.
- generator_config_to_fastvideo_args reconstructs the flat
torch_compile_kwargs dict via _compile_config_to_torch_kwargs,
emitting only user-set typed fields plus extras.
- legacy ltx2_vae_tiling routes to pipeline.vae_tiling on the way in
and back to ltx2_vae_tiling on the way out.
Parity inventory (docs/design/inference_schema_parity_inventory.yaml):
- torch_compile_kwargs now maps to the comma-separated leaf
generator.engine.compile.backend,fullgraph,mode,dynamic,extras
- ltx2_vae_tiling reclassified from preset_owned nested dict
(.preset_overrides.ltx2.vae_tiling) to moved (.pipeline.vae_tiling)
11 new tests in fastvideo/tests/api/test_compat_translation.py cover
typed-key promotion, extras merge, None suppression, round-trip back
to FastVideoArgs, and the vae_tiling forward/reverse path. Parser
round-trip fixture updated for the new schema fields.