From d96dee46af2aaefd622a67a35061ee9d3f37bbf4 Mon Sep 17 00:00:00 2001 From: Kyle Date: Tue, 25 Aug 2026 15:17:00 -0700 Subject: [PATCH] [perf]: expose lazy module loading in the MiniMax H3 example The example builds its OffloadConfig directly rather than going through FastVideoArgs.add_cli_args, so the new flag needs its own switch to be reachable from the motivating command line. Co-Authored-By: Claude Opus 5 (1M context) --- examples/inference/basic/basic_minimax_h3_t2v.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/examples/inference/basic/basic_minimax_h3_t2v.py b/examples/inference/basic/basic_minimax_h3_t2v.py index 3e4344ae9..ea15bacde 100644 --- a/examples/inference/basic/basic_minimax_h3_t2v.py +++ b/examples/inference/basic/basic_minimax_h3_t2v.py @@ -48,6 +48,12 @@ def parse_args() -> argparse.Namespace: "training-port semantics: no kwargs; fullgraph + emulate_precision_casts injected). " "First generation pays the inductor JIT (~1-2 min); use --repeats >= 2 and time " "the last repeat. FASTVIDEO_INFERENCE_TORCH_COMPILE=1 is equivalent") + parser.add_argument("--lazy-module-load", + action="store_true", + help="load each heavy component on first use and free it after the last stage that " + "needs it, so peak memory is the largest overlapping set instead of the sum of every " + "component. Enable when the model does not fit at load time; costs a reload per " + "generation, so leave it off when it does fit") parser.add_argument("--repeats", type=int, default=1, @@ -81,6 +87,7 @@ def main() -> None: text_encoder=True, vae=True, pin_cpu_memory=False, + lazy_module_load=args.lazy_module_load, ), compile=CompileConfig( enabled=args.torch_compile,