[refactor]: move repository configs and examples off pipeline.experimental
Every key that repository YAML configs, Python examples, the Dreamverse backend, and tests passed through pipeline.experimental has a typed GeneratorConfig field, so they use those fields instead: engine.attention, engine.compile.regional, pipeline.flow_shift, pipeline.embedded_cfg_scale, pipeline.dmd_denoising_steps, pipeline.components.lora_nickname, pipeline.minimax_h3, and pipeline.longcat. No repository config outside the tests uses pipeline.experimental any more. The flat FastVideoArgs keywords that each migrated YAML file and each basic_fasth3.py option set produces match the previous ones. The golden snapshots of the two Hunyuan scripts now record embedded_cfg_scale and flow_shift as floats (6.0 instead of 6), because the typed fields are floats. The guidance tensor is built as float32 either way. The golden case untyped_experimental_keys is renamed attention_precision_and_flow_shift with identical content, and keys_without_typed_fields covers keywords that still go to pipeline.experimental. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012M91wnVFmPEvJ9h39r5BH7
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
b24396561a
commit
ecb15bf9e0
@@ -3,12 +3,12 @@ import time
|
||||
|
||||
from fastvideo import VideoGenerator
|
||||
from fastvideo.api import (
|
||||
AttentionConfig,
|
||||
EngineConfig,
|
||||
GenerationRequest,
|
||||
GeneratorConfig,
|
||||
OffloadConfig,
|
||||
OutputConfig,
|
||||
PipelineSelection,
|
||||
)
|
||||
|
||||
OUTPUT_PATH = "video_samples_dmd2_typed"
|
||||
@@ -29,12 +29,8 @@ def main():
|
||||
dit=False,
|
||||
vae=False,
|
||||
),
|
||||
attention=AttentionConfig(vsa_sparsity=0.8),
|
||||
),
|
||||
# PR 2 still routes a few advanced inference knobs through the
|
||||
# compatibility bridge until they get first-class typed fields.
|
||||
pipeline=PipelineSelection(experimental={
|
||||
"VSA_sparsity": 0.8,
|
||||
}, ),
|
||||
)
|
||||
|
||||
load_start_time = time.perf_counter()
|
||||
|
||||
@@ -25,11 +25,13 @@ from pathlib import Path
|
||||
|
||||
from fastvideo import VideoGenerator
|
||||
from fastvideo.api import (
|
||||
AttentionConfig,
|
||||
CompileConfig,
|
||||
ComponentConfig,
|
||||
EngineConfig,
|
||||
GenerationRequest,
|
||||
GeneratorConfig,
|
||||
MiniMaxH3Config,
|
||||
OffloadConfig,
|
||||
OutputConfig,
|
||||
ParallelismConfig,
|
||||
@@ -254,23 +256,6 @@ def _execution_backend(args: argparse.Namespace) -> str:
|
||||
|
||||
def build_generator_config(args: argparse.Namespace) -> GeneratorConfig:
|
||||
use_vsa = _uses_vsa(args)
|
||||
experimental: dict[str, object] = {
|
||||
"attention_backend": "VIDEO_SPARSE_ATTN_H3" if use_vsa else "FLASH_ATTN",
|
||||
"inference_torch_compile": args.inference_torch_compile,
|
||||
"vae_parallel_decode": args.parallel_vae,
|
||||
"vae_parallel_decode_strategy": "gather",
|
||||
}
|
||||
if args.h3_sequential_load is not None:
|
||||
experimental["h3_sequential_load"] = args.h3_sequential_load
|
||||
if args.video_decode_backend != "h3-vae":
|
||||
experimental["video_decode_backend"] = args.video_decode_backend
|
||||
if args.taeh3_checkpoint is not None:
|
||||
experimental["taeh3_checkpoint"] = args.taeh3_checkpoint
|
||||
if use_vsa:
|
||||
experimental.update({
|
||||
"VSA_sparsity": args.vsa_sparsity,
|
||||
"VSA_tile_size": args.vsa_tile_size,
|
||||
})
|
||||
return GeneratorConfig(
|
||||
model_path=args.model_path,
|
||||
pipeline=PipelineSelection(
|
||||
@@ -278,7 +263,13 @@ def build_generator_config(args: argparse.Namespace) -> GeneratorConfig:
|
||||
lora_path=getattr(args, "lora_path", None),
|
||||
lora_strength=float(getattr(args, "lora_strength", 1.0)),
|
||||
),
|
||||
experimental=experimental,
|
||||
minimax_h3=MiniMaxH3Config(
|
||||
sequential_load=args.h3_sequential_load,
|
||||
video_decode_backend=None if args.video_decode_backend == "h3-vae" else args.video_decode_backend,
|
||||
taeh3_checkpoint=args.taeh3_checkpoint,
|
||||
vae_parallel_decode=args.parallel_vae,
|
||||
vae_parallel_decode_strategy="gather",
|
||||
),
|
||||
),
|
||||
engine=EngineConfig(
|
||||
num_gpus=args.num_gpus,
|
||||
@@ -297,6 +288,12 @@ def build_generator_config(args: argparse.Namespace) -> GeneratorConfig:
|
||||
enabled=args.torch_compile,
|
||||
mode=args.compile_mode,
|
||||
vae_enabled=args.compile_vae,
|
||||
regional=args.inference_torch_compile,
|
||||
),
|
||||
attention=AttentionConfig(
|
||||
backend="VIDEO_SPARSE_ATTN_H3" if use_vsa else "FLASH_ATTN",
|
||||
vsa_sparsity=args.vsa_sparsity if use_vsa else None,
|
||||
vsa_tile_size=args.vsa_tile_size if use_vsa else None,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -17,11 +17,13 @@ sys.path.insert(0, str(FASTVIDEO_ROOT))
|
||||
|
||||
from fastvideo import VideoGenerator # noqa: E402
|
||||
from fastvideo.api import ( # noqa: E402
|
||||
AttentionConfig,
|
||||
CompileConfig,
|
||||
ComponentConfig,
|
||||
EngineConfig,
|
||||
GenerationRequest,
|
||||
GeneratorConfig,
|
||||
MiniMaxH3Config,
|
||||
OffloadConfig,
|
||||
OutputConfig,
|
||||
ParallelismConfig,
|
||||
@@ -57,17 +59,7 @@ def main() -> None:
|
||||
args = parse_args()
|
||||
|
||||
attention_backend = VARIANT_BACKENDS[args.variant]
|
||||
experimental = {
|
||||
"attention_backend": attention_backend,
|
||||
"inference_torch_compile": attention_backend == "FLASH_ATTN",
|
||||
"vae_parallel_decode": True,
|
||||
"vae_parallel_decode_strategy": "gather",
|
||||
}
|
||||
if attention_backend == "VIDEO_SPARSE_ATTN_H3":
|
||||
experimental.update({
|
||||
"VSA_sparsity": 0.9,
|
||||
"VSA_tile_size": 64,
|
||||
})
|
||||
use_vsa = attention_backend == "VIDEO_SPARSE_ATTN_H3"
|
||||
|
||||
adapter_path = hf_hub_download(
|
||||
repo_id="FastVideo/FastVideo-FastH3-4-step-Preview-v1-LoRA",
|
||||
@@ -81,13 +73,18 @@ def main() -> None:
|
||||
model_path="MiniMaxAI/MiniMax-H3",
|
||||
pipeline=PipelineSelection(
|
||||
components=ComponentConfig(lora_path=adapter_path, lora_strength=1.0),
|
||||
experimental=experimental,
|
||||
minimax_h3=MiniMaxH3Config(vae_parallel_decode=True, vae_parallel_decode_strategy="gather"),
|
||||
),
|
||||
engine=EngineConfig(
|
||||
num_gpus=4,
|
||||
parallelism=ParallelismConfig(tp_size=1, sp_size=4),
|
||||
offload=OffloadConfig(dit=False, dit_layerwise=False),
|
||||
compile=CompileConfig(vae_enabled=True),
|
||||
compile=CompileConfig(vae_enabled=True, regional=attention_backend == "FLASH_ATTN"),
|
||||
attention=AttentionConfig(
|
||||
backend=attention_backend,
|
||||
vsa_sparsity=0.9 if use_vsa else None,
|
||||
vsa_tile_size=64 if use_vsa else None,
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
@@ -11,11 +11,13 @@ from huggingface_hub import hf_hub_download
|
||||
|
||||
from fastvideo import VideoGenerator
|
||||
from fastvideo.api import (
|
||||
AttentionConfig,
|
||||
CompileConfig,
|
||||
ComponentConfig,
|
||||
EngineConfig,
|
||||
GenerationRequest,
|
||||
GeneratorConfig,
|
||||
MiniMaxH3Config,
|
||||
OffloadConfig,
|
||||
OutputConfig,
|
||||
ParallelismConfig,
|
||||
@@ -50,17 +52,7 @@ def main() -> None:
|
||||
output_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
attention_backend = VARIANT_BACKENDS[args.variant]
|
||||
experimental = {
|
||||
"attention_backend": attention_backend,
|
||||
"inference_torch_compile": attention_backend == "FLASH_ATTN",
|
||||
"vae_parallel_decode": True,
|
||||
"vae_parallel_decode_strategy": "gather",
|
||||
}
|
||||
if attention_backend == "VIDEO_SPARSE_ATTN_H3":
|
||||
experimental.update({
|
||||
"VSA_sparsity": 0.9,
|
||||
"VSA_tile_size": 64,
|
||||
})
|
||||
use_vsa = attention_backend == "VIDEO_SPARSE_ATTN_H3"
|
||||
|
||||
adapter_path = hf_hub_download(
|
||||
repo_id="FastVideo/FastVideo-FastH3-4-step-Preview-v1-LoRA",
|
||||
@@ -71,13 +63,18 @@ def main() -> None:
|
||||
model_path="MiniMaxAI/MiniMax-H3",
|
||||
pipeline=PipelineSelection(
|
||||
components=ComponentConfig(lora_path=adapter_path, lora_strength=1.0),
|
||||
experimental=experimental,
|
||||
minimax_h3=MiniMaxH3Config(vae_parallel_decode=True, vae_parallel_decode_strategy="gather"),
|
||||
),
|
||||
engine=EngineConfig(
|
||||
num_gpus=4,
|
||||
parallelism=ParallelismConfig(tp_size=1, sp_size=4),
|
||||
offload=OffloadConfig(dit=False, dit_layerwise=False),
|
||||
compile=CompileConfig(vae_enabled=True),
|
||||
compile=CompileConfig(vae_enabled=True, regional=attention_backend == "FLASH_ATTN"),
|
||||
attention=AttentionConfig(
|
||||
backend=attention_backend,
|
||||
vsa_sparsity=0.9 if use_vsa else None,
|
||||
vsa_tile_size=64 if use_vsa else None,
|
||||
),
|
||||
quantization=QuantizationConfig(transformer_quant="MXFP8"),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -30,12 +30,13 @@ generator:
|
||||
compile:
|
||||
enabled: false
|
||||
vae_enabled: true
|
||||
regional: true
|
||||
attention:
|
||||
backend: VIDEO_SPARSE_ATTN_H3
|
||||
vsa_sparsity: 0.9
|
||||
vsa_tile_size: 64
|
||||
pipeline:
|
||||
experimental:
|
||||
attention_backend: VIDEO_SPARSE_ATTN_H3
|
||||
VSA_sparsity: 0.9
|
||||
VSA_tile_size: 64
|
||||
inference_torch_compile: true
|
||||
minimax_h3:
|
||||
vae_parallel_decode: true
|
||||
vae_parallel_decode_strategy: gather
|
||||
request:
|
||||
|
||||
@@ -30,12 +30,13 @@ generator:
|
||||
compile:
|
||||
enabled: false
|
||||
vae_enabled: true
|
||||
regional: true
|
||||
attention:
|
||||
backend: VIDEO_SPARSE_ATTN_H3
|
||||
vsa_sparsity: 0.9
|
||||
vsa_tile_size: 64
|
||||
pipeline:
|
||||
experimental:
|
||||
attention_backend: VIDEO_SPARSE_ATTN_H3
|
||||
VSA_sparsity: 0.9
|
||||
VSA_tile_size: 64
|
||||
inference_torch_compile: true
|
||||
minimax_h3:
|
||||
vae_parallel_decode: true
|
||||
vae_parallel_decode_strategy: gather
|
||||
request:
|
||||
|
||||
@@ -16,7 +16,6 @@ from fastvideo.api import (
|
||||
OffloadConfig,
|
||||
OutputConfig,
|
||||
ParallelismConfig,
|
||||
PipelineSelection,
|
||||
SamplingConfig,
|
||||
)
|
||||
|
||||
@@ -82,17 +81,10 @@ def main() -> None:
|
||||
output_dir = Path(args.output)
|
||||
output_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# Boot-time run configuration folded into FastVideoArgs (the same
|
||||
# experimental-dict route basic_fasth3.py uses for the VSA knobs).
|
||||
experimental: dict[str, object] = {}
|
||||
if args.inference_torch_compile:
|
||||
experimental["inference_torch_compile"] = True
|
||||
|
||||
execution_backend = args.execution_backend or ("ray" if os.environ.get("RAY_ADDRESS") else "mp")
|
||||
generator = VideoGenerator.from_config(
|
||||
GeneratorConfig(
|
||||
model_path=args.model_path,
|
||||
pipeline=PipelineSelection(experimental=experimental),
|
||||
engine=EngineConfig(
|
||||
num_gpus=args.num_gpus,
|
||||
execution_backend=execution_backend,
|
||||
@@ -110,6 +102,7 @@ def main() -> None:
|
||||
enabled=args.torch_compile,
|
||||
mode=args.compile_mode,
|
||||
vae_enabled=args.compile_vae,
|
||||
regional=True if args.inference_torch_compile else None,
|
||||
),
|
||||
),
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user