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
89 lines
2.9 KiB
Python
89 lines
2.9 KiB
Python
import os
|
|
import time
|
|
|
|
from fastvideo import VideoGenerator
|
|
from fastvideo.api import (
|
|
AttentionConfig,
|
|
EngineConfig,
|
|
GenerationRequest,
|
|
GeneratorConfig,
|
|
OffloadConfig,
|
|
OutputConfig,
|
|
)
|
|
|
|
OUTPUT_PATH = "video_samples_dmd2_typed"
|
|
|
|
|
|
def main():
|
|
os.environ["FASTVIDEO_ATTENTION_BACKEND"] = "VIDEO_SPARSE_ATTN"
|
|
|
|
model_name = "FastVideo/FastWan2.1-T2V-1.3B-Diffusers"
|
|
generator_config = GeneratorConfig(
|
|
model_path=model_name,
|
|
engine=EngineConfig(
|
|
num_gpus=1,
|
|
use_fsdp_inference=False,
|
|
offload=OffloadConfig(
|
|
text_encoder=True,
|
|
pin_cpu_memory=True,
|
|
dit=False,
|
|
vae=False,
|
|
),
|
|
attention=AttentionConfig(vsa_sparsity=0.8),
|
|
),
|
|
)
|
|
|
|
load_start_time = time.perf_counter()
|
|
generator = VideoGenerator.from_config(generator_config)
|
|
load_end_time = time.perf_counter()
|
|
load_time = load_end_time - load_start_time
|
|
|
|
prompt = ("A neon-lit alley in futuristic Tokyo during a heavy rainstorm at night. "
|
|
"The puddles reflect glowing signs in kanji, advertising ramen, karaoke, "
|
|
"and VR arcades. A woman in a translucent raincoat walks briskly with an "
|
|
"LED umbrella. Steam rises from a street food cart, and a cat darts "
|
|
"across the screen. Raindrops are visible on the camera lens, creating "
|
|
"a cinematic bokeh effect.")
|
|
request = GenerationRequest(
|
|
prompt=prompt,
|
|
output=OutputConfig(
|
|
output_path=OUTPUT_PATH,
|
|
save_video=True,
|
|
return_frames=False,
|
|
),
|
|
)
|
|
|
|
start_time = time.perf_counter()
|
|
result = generator.generate(request)
|
|
end_time = time.perf_counter()
|
|
gen_time = end_time - start_time
|
|
|
|
prompt2 = ("A majestic lion strides across the golden savanna, its powerful frame "
|
|
"glistening under the warm afternoon sun. The tall grass ripples gently "
|
|
"in the breeze, enhancing the lion's commanding presence. The tone is "
|
|
"vibrant, embodying the raw energy of the wild. Low angle, steady "
|
|
"tracking shot, cinematic.")
|
|
request2 = GenerationRequest(
|
|
prompt=prompt2,
|
|
output=OutputConfig(
|
|
output_path=OUTPUT_PATH,
|
|
save_video=True,
|
|
return_frames=False,
|
|
),
|
|
)
|
|
|
|
start_time = time.perf_counter()
|
|
result2 = generator.generate(request2)
|
|
end_time = time.perf_counter()
|
|
gen_time2 = end_time - start_time
|
|
|
|
print(f"Time taken to load model: {load_time} seconds")
|
|
print(f"Time taken to generate video: {gen_time} seconds")
|
|
print(f"First output written to: {result.video_path}")
|
|
print(f"Time taken to generate video2: {gen_time2} seconds")
|
|
print(f"Second output written to: {result2.video_path}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|