[refactor]: fill unset typed fields from the model's PipelineConfig during resolution

The resolution step fill_pipeline_config_defaults[<PipelineConfig class>]
fills each typed field that is still None with the value that the model's
PipelineConfig holds for the field's flat name. That PipelineConfig is the
one flattening starts from: the registry class for model_path, plus a
pipeline config file or object when one is given. The covered fields are the
engine.precision fields, pipeline.vae_sp, flow_shift, embedded_cfg_scale,
dmd_denoising_steps, and the pipeline.longcat BSA settings.

The resolved config therefore holds the effective value of these fields,
and provenance tells a model default apart from user input. The step runs
after the environment steps and before the derived values, so the precedence
is user input, then environment variables, then model defaults.
inference_resolution_steps(config) builds the ordered step list.

The values that the step fills are the values that PipelineConfig already
had, so FastVideoArgs and PipelineConfig are unchanged; the golden snapshots
add the decisions. Tests that flatten unregistered model paths skip this
step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012M91wnVFmPEvJ9h39r5BH7
This commit is contained in:
Davids048
2026-10-02 19:21:25 +00:00
co-authored by Claude Opus 5.5
parent b9c397dd1a
commit d26aa6b2d7
56 changed files with 803 additions and 9 deletions
+48 -7
View File
@@ -1,14 +1,16 @@
# SPDX-License-Identifier: Apache-2.0
"""Resolution of an inference ``GeneratorConfig`` into the frozen values that the run starts with.
``resolve_inference_config`` runs ``INFERENCE_RESOLUTION_STEPS`` in order through
``resolve_inference_config`` runs the steps from ``inference_resolution_steps`` in order through
:func:`fastvideo.api.resolution.resolve_generator_config`, so every value that a step decides is recorded with the
step's name. ``generator_config_to_fastvideo_args`` flattens the resolved values into ``FastVideoArgs``.
The steps run in this order, so an earlier step takes precedence over a later one that fills the same field:
The steps run in this order. A fill step sets a field only while it is ``None``, so an earlier step takes
precedence over a later one: user input, then environment variables, then model defaults.
1. Environment variables fill typed fields.
2. Derived values replace placeholders.
2. Model defaults from the model's ``PipelineConfig`` fill the typed fields that are still unset.
3. Derived values replace placeholders.
``FastVideoArgs.__post_init__`` and ``check_fastvideo_args`` still apply the same rules to a ``FastVideoArgs`` that
is built directly; for a resolved config they find the values already decided and change nothing.
@@ -16,10 +18,12 @@ is built directly; for a resolved config they find the values already decided an
from __future__ import annotations
from collections.abc import Mapping
from copy import deepcopy
from dataclasses import fields, is_dataclass
from typing import Any
import fastvideo.envs as envs
from fastvideo.api.parser import parse_config
from fastvideo.api.resolution import ResolutionStep, ResolutionView, ResolvedGeneratorConfig, resolve_generator_config
from fastvideo.api.schema import GeneratorConfig
@@ -61,6 +65,36 @@ def fill_vae_parallel_from_env(view: ResolutionView) -> dict[str, Any]:
return values
def pipeline_config_defaults_step(config: GeneratorConfig) -> ResolutionStep:
"""Build the step that fills unset typed fields with the values of the model's ``PipelineConfig``.
The ``PipelineConfig`` is the one that flattening starts from: the registry class for ``model_path``, updated
by a ``pipeline_config`` entry in ``pipeline.experimental`` or else by ``pipeline.components.pipeline_config_path``.
A typed field is filled when its flat name is an attribute of that ``PipelineConfig``, its value is ``None``,
and the attribute is not ``None``. The step's source name carries the ``PipelineConfig`` class name.
"""
from fastvideo.api.compat import _FLAT_NAME_FIELDS
from fastvideo.configs.pipelines.base import PipelineConfig
pipeline_config_source = config.pipeline.experimental.get("pipeline_config",
config.pipeline.components.pipeline_config_path)
kwargs: dict[str, Any] = {"model_path": config.model_path}
if pipeline_config_source is not None:
kwargs["pipeline_config"] = deepcopy(pipeline_config_source)
defaults = PipelineConfig.from_kwargs(kwargs)
def fill_pipeline_config_defaults(view: ResolutionView) -> dict[str, Any]:
values: dict[str, Any] = {}
for flat_name, (dotted_path, _) in _FLAT_NAME_FIELDS.items():
default = getattr(defaults, flat_name, None)
if default is not None and view.get(dotted_path) is None:
values[dotted_path] = deepcopy(default)
return values
fill_pipeline_config_defaults.__qualname__ = f"fill_pipeline_config_defaults[{type(defaults).__name__}]"
return fill_pipeline_config_defaults
def derive_parallel_sizes(view: ResolutionView) -> dict[str, Any]:
"""Replace the -1 placeholders: ``tp_size`` becomes 1, and ``sp_size`` and ``hsdp_shard_dim`` become ``num_gpus``."""
num_gpus = view.get("engine.num_gpus")
@@ -72,14 +106,18 @@ def derive_parallel_sizes(view: ResolutionView) -> dict[str, Any]:
return {path: value for path, value in placeholders.items() if view.get(path) == -1}
INFERENCE_RESOLUTION_STEPS: tuple[ResolutionStep, ...] = (
ENVIRONMENT_STEPS: tuple[ResolutionStep, ...] = (
fill_attention_backend_from_env,
fill_regional_compile_from_env,
fill_vae_parallel_from_env,
derive_parallel_sizes,
)
def inference_resolution_steps(config: GeneratorConfig) -> tuple[ResolutionStep, ...]:
"""The resolution steps for ``config``, in the order that they run."""
return (*ENVIRONMENT_STEPS, pipeline_config_defaults_step(config), derive_parallel_sizes)
def resolve_inference_config(config: GeneratorConfig | Mapping[str, Any]) -> ResolvedGeneratorConfig:
"""Resolve an inference config and freeze the result.
@@ -88,7 +126,8 @@ def resolve_inference_config(config: GeneratorConfig | Mapping[str, Any]) -> Res
schema defaults count as written.
"""
raw = config if isinstance(config, Mapping) else written_fields(config)
return resolve_generator_config(raw, INFERENCE_RESOLUTION_STEPS)
typed_config = config if isinstance(config, GeneratorConfig) else parse_config(GeneratorConfig, config)
return resolve_generator_config(raw, inference_resolution_steps(typed_config))
def written_fields(config: GeneratorConfig) -> dict[str, Any]:
@@ -125,11 +164,13 @@ def _non_default_fields(value: Any, default: Any) -> dict[str, Any]:
__all__ = [
"INFERENCE_RESOLUTION_STEPS",
"ENVIRONMENT_STEPS",
"derive_parallel_sizes",
"fill_attention_backend_from_env",
"fill_regional_compile_from_env",
"fill_vae_parallel_from_env",
"inference_resolution_steps",
"pipeline_config_defaults_step",
"resolve_inference_config",
"written_fields",
]
@@ -379,6 +379,19 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[WanT2V480PConfig]",
{
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"fp32"
],
"engine.precision.vae": "fp32",
"engine.precision.vae_decode": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -384,6 +384,27 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[Wan2_2_T2V_A14B_Config]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"fp32"
],
"engine.precision.vae": "fp32",
"engine.precision.vae_decode": "bf16",
"pipeline.dmd_denoising_steps": [
1000,
750,
500,
250
],
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.flow_shift": 12.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -379,6 +379,21 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[WanT2V480PConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"fp32"
],
"engine.precision.vae": "fp32",
"engine.precision.vae_decode": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.flow_shift": 3.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -379,6 +379,21 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[WanT2V480PConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"fp32"
],
"engine.precision.vae": "fp32",
"engine.precision.vae_decode": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.flow_shift": 3.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -360,6 +360,19 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[LTX2T2VConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"bf16"
],
"engine.precision.vae": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -360,6 +360,19 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[LTX2T2VConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"bf16"
],
"engine.precision.vae": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -407,6 +407,21 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[FastHunyuanConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"fp16",
"fp16"
],
"engine.precision.vae": "fp32",
"pipeline.embedded_cfg_scale": 6,
"pipeline.flow_shift": 17,
"pipeline.vae_sp": true
}
],
[
"derive_parallel_sizes",
{
@@ -386,6 +386,21 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[WanT2V480PConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"fp32"
],
"engine.precision.vae": "fp32",
"engine.precision.vae_decode": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.flow_shift": 3.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -379,6 +379,21 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[WanT2V480PConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"fp32"
],
"engine.precision.vae": "fp32",
"engine.precision.vae_decode": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.flow_shift": 3.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -360,6 +360,19 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[LTX2T2VConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"bf16"
],
"engine.precision.vae": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -377,6 +377,19 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[LTX2T2VConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"bf16"
],
"engine.precision.vae": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -362,6 +362,19 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[LTX2T2VConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"bf16"
],
"engine.precision.vae": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -362,6 +362,19 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[LTX2T2VConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"bf16"
],
"engine.precision.vae": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -362,6 +362,19 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[LTX2T2VConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"bf16"
],
"engine.precision.vae": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -362,6 +362,19 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[LTX2T2VConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"bf16"
],
"engine.precision.vae": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -362,6 +362,19 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[LTX2T2VConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"bf16"
],
"engine.precision.vae": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -362,6 +362,19 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[LTX2T2VConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"bf16"
],
"engine.precision.vae": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -362,6 +362,19 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[LTX2T2VConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"bf16"
],
"engine.precision.vae": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -362,6 +362,19 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[LTX2T2VConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"bf16"
],
"engine.precision.vae": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -362,6 +362,19 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[LTX2T2VConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"bf16"
],
"engine.precision.vae": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -362,6 +362,19 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[LTX2T2VConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"bf16"
],
"engine.precision.vae": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -362,6 +362,19 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[LTX2T2VConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"bf16"
],
"engine.precision.vae": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -362,6 +362,19 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[LTX2T2VConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"bf16"
],
"engine.precision.vae": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -362,6 +362,19 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[LTX2T2VConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"bf16"
],
"engine.precision.vae": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -362,6 +362,19 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[LTX2T2VConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"bf16"
],
"engine.precision.vae": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -362,6 +362,19 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[LTX2T2VConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"bf16"
],
"engine.precision.vae": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -362,6 +362,19 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[LTX2T2VConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"bf16"
],
"engine.precision.vae": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -486,6 +486,18 @@
"request_batch_extra": {},
"request_pipeline_overrides": {},
"resolution_decisions": [
[
"fill_pipeline_config_defaults[MiniMaxH3PipelineConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"bf16"
],
"engine.precision.vae": "fp32",
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -486,6 +486,18 @@
"request_batch_extra": {},
"request_pipeline_overrides": {},
"resolution_decisions": [
[
"fill_pipeline_config_defaults[MiniMaxH3PipelineConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"bf16"
],
"engine.precision.vae": "fp32",
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -486,6 +486,18 @@
"request_batch_extra": {},
"request_pipeline_overrides": {},
"resolution_decisions": [
[
"fill_pipeline_config_defaults[MiniMaxH3PipelineConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"bf16"
],
"engine.precision.vae": "fp32",
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -385,6 +385,21 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[FastWan2_1_T2V_480P_Config]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"fp32"
],
"engine.precision.vae": "fp32",
"engine.precision.vae_decode": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.flow_shift": 8.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -415,6 +415,20 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[WanI2V480PConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"fp32"
],
"engine.precision.vae": "fp32",
"engine.precision.vae_decode": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -386,6 +386,27 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[Wan2_2_T2V_A14B_Config]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"fp32"
],
"engine.precision.vae": "fp32",
"engine.precision.vae_decode": "bf16",
"pipeline.dmd_denoising_steps": [
1000,
750,
500,
250
],
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.flow_shift": 12.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -382,6 +382,21 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[Wan2_2_TI2V_5B_Config]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"fp32"
],
"engine.precision.vae": "fp32",
"engine.precision.vae_decode": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.flow_shift": 5.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -377,6 +377,19 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[LTX2T2VConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"bf16"
],
"engine.precision.vae": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -409,6 +409,19 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[FastHunyuanConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"fp16",
"fp16"
],
"engine.precision.vae": "fp16",
"pipeline.vae_sp": true
}
],
[
"derive_parallel_sizes",
{
@@ -349,6 +349,18 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[Flux2KleinPipelineConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"bf16"
],
"engine.precision.vae": "fp32",
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -409,6 +409,19 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[HunyuanConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"fp16",
"fp16"
],
"engine.precision.vae": "fp16",
"pipeline.vae_sp": true
}
],
[
"derive_parallel_sizes",
{
@@ -381,6 +381,19 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[LongCatT2V480PConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"bf16"
],
"engine.precision.vae": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -381,6 +381,19 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[LongCatT2V480PConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"bf16"
],
"engine.precision.vae": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -381,6 +381,19 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[LongCatT2V480PConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"bf16"
],
"engine.precision.vae": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -389,6 +389,19 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[LongCatT2V480PConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"bf16"
],
"engine.precision.vae": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -381,6 +381,19 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[LongCatT2V480PConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"bf16"
],
"engine.precision.vae": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -381,6 +381,20 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[WanT2V480PConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"fp32"
],
"engine.precision.vae": "fp32",
"engine.precision.vae_decode": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -403,6 +403,20 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[WanT2V480PConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"fp32"
],
"engine.precision.vae": "fp32",
"engine.precision.vae_decode": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -381,6 +381,20 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[WanT2V720PConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"fp32"
],
"engine.precision.vae": "fp32",
"engine.precision.vae_decode": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -385,6 +385,21 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[FastWan2_1_T2V_480P_Config]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"fp32"
],
"engine.precision.vae": "fp32",
"engine.precision.vae_decode": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.flow_shift": 8.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -385,6 +385,21 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[FastWan2_1_T2V_480P_Config]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"fp32"
],
"engine.precision.vae": "fp32",
"engine.precision.vae_decode": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.flow_shift": 8.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -385,6 +385,21 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[FastWan2_1_T2V_480P_Config]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"fp32"
],
"engine.precision.vae": "fp32",
"engine.precision.vae_decode": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.flow_shift": 8.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -386,6 +386,21 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[FastWan2_2_TI2V_5B_Config]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"fp32"
],
"engine.precision.vae": "fp32",
"engine.precision.vae_decode": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.flow_shift": 5.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -415,6 +415,20 @@
"pipeline.minimax_h3.vae_parallel_decode_strategy": "gather"
}
],
[
"fill_pipeline_config_defaults[WanI2V480PConfig]",
{
"engine.precision.dit": "bf16",
"engine.precision.image_encoder": "fp32",
"engine.precision.text_encoders": [
"fp32"
],
"engine.precision.vae": "fp32",
"engine.precision.vae_decode": "bf16",
"pipeline.embedded_cfg_scale": 6.0,
"pipeline.vae_sp": false
}
],
[
"derive_parallel_sizes",
{
@@ -192,9 +192,13 @@ def _engine_with_compile(compile_config):
def _stub_fastvideo_args_from_kwargs(monkeypatch):
"""Swap ``FastVideoArgs.from_kwargs`` for a capture-only stub so
translation tests don't need to construct a valid FastVideoArgs."""
"""Swap ``FastVideoArgs.from_kwargs`` for a capture-only stub, and skip the
model-default resolution step, so translation tests need neither a valid
FastVideoArgs nor a resolvable model path."""
from fastvideo import fastvideo_args as fva
from fastvideo.api import inference_resolution
monkeypatch.setattr(inference_resolution, "pipeline_config_defaults_step", lambda config: lambda view: {})
class _Captured:
@@ -84,3 +84,44 @@ def test_object_fields_that_differ_from_defaults_are_explicit():
assert resolved.is_explicit("engine.attention.backend")
assert not resolved.is_explicit("engine.parallelism.tp_size")
assert resolved.engine.attention.backend == "FLASH_ATTN"
def test_model_defaults_fill_unset_fields_and_keep_explicit_ones():
raw = {"model_path": WAN_T2V, "engine": {"precision": {"dit": "fp32"}}}
resolved = _resolve(raw)
dit = resolved.provenance("engine.precision.dit")
assert (dit.value, dit.source) == ("fp32", "input")
vae = resolved.provenance("engine.precision.vae")
assert vae.value == "fp32"
assert vae.source == "fill_pipeline_config_defaults[WanT2V480PConfig]"
flow_shift = resolved.provenance("pipeline.flow_shift")
assert (flow_shift.raw_value, flow_shift.value) == (None, 3.0)
def test_environment_takes_precedence_over_model_defaults():
from fastvideo.api.inference_resolution import inference_resolution_steps
names = [step.__qualname__ for step in inference_resolution_steps(GeneratorConfig(model_path=WAN_T2V))]
assert names == [
"fill_attention_backend_from_env",
"fill_regional_compile_from_env",
"fill_vae_parallel_from_env",
"fill_pipeline_config_defaults[WanT2V480PConfig]",
"derive_parallel_sizes",
]
def test_video_generator_keeps_the_resolved_config(monkeypatch):
from types import SimpleNamespace
from fastvideo.entrypoints.video_generator import VideoGenerator
monkeypatch.setattr(VideoGenerator, "from_fastvideo_args",
classmethod(lambda cls, fastvideo_args, log_queue=None: SimpleNamespace(args=fastvideo_args)))
with isolated_environment():
generator = VideoGenerator.from_config({"model_path": WAN_T2V, "engine": {"num_gpus": 2}})
assert generator.args.sp_size == 2
provenance = generator.resolved_config.provenance("engine.parallelism.sp_size")
assert (provenance.value, provenance.source) == (2, "derive_parallel_sizes")
@@ -226,6 +226,9 @@ class TestRefineFlattenCoversAllTypedFields:
return _Captured(**kw)
monkeypatch.setattr(fva.FastVideoArgs, "from_kwargs", _capture)
# The model path is not a registered model, so skip the model-default resolution step.
from fastvideo.api import inference_resolution
monkeypatch.setattr(inference_resolution, "pipeline_config_defaults_step", lambda config: lambda view: {})
refine_payload = {
# Preset-override fields.
@@ -85,6 +85,9 @@ def _patch_fastvideo_args_from_kwargs(monkeypatch):
"fastvideo.api.compat.FastVideoArgs.from_kwargs",
classmethod(fake_from_kwargs),
)
# "test-model" is not a registered model, so skip the model-default resolution step.
monkeypatch.setattr("fastvideo.api.inference_resolution.pipeline_config_defaults_step",
lambda config: lambda view: {})
return captured