Move all examples/inference and scripts off the legacy
VideoGenerator.from_pretrained(model, **kwargs) +
generate_video(prompt, **kwargs) surface onto the typed
from_config(GeneratorConfig(...)) + generate(GenerationRequest(...))
convention, including the Kandinsky-5 and DreamX-World examples added
on main after the original migration. git-mv api/compat.py to
api/translation.py ('compat' implied a temporary shim; the forward
translation is its honest permanent role) and repoint all importers,
tests, and doc links.
57 lines
1.7 KiB
Python
57 lines
1.7 KiB
Python
from fastvideo import VideoGenerator
|
|
from fastvideo.api import (
|
|
EngineConfig,
|
|
GenerationRequest,
|
|
GeneratorConfig,
|
|
OutputConfig,
|
|
SamplingConfig,
|
|
)
|
|
|
|
|
|
PROMPT = (
|
|
"A warm sunny backyard. The camera starts in a tight cinematic close-up "
|
|
"of a woman and a man in their 30s, facing each other with serious "
|
|
"expressions. The woman, emotional and dramatic, says softly, \"That's "
|
|
"it... Dad's lost it. And we've lost Dad.\" The man exhales, slightly "
|
|
"annoyed: \"Stop being so dramatic, Jess.\" A beat. He glances aside, "
|
|
"then mutters defensively, \"He's just having fun.\" The camera slowly "
|
|
"pans right, revealing the grandfather in the garden wearing enormous "
|
|
"butterfly wings, waving his arms in the air like he's trying to take "
|
|
"off. He shouts, \"Wheeeew!\" as he flaps his wings with full commitment. "
|
|
"The woman covers her face, on the verge of tears. The tone is deadpan, "
|
|
"absurd, and quietly tragic."
|
|
)
|
|
|
|
|
|
def main() -> None:
|
|
# Uses FastVideo default sampling settings for LTX2 base.
|
|
generator = VideoGenerator.from_config(
|
|
GeneratorConfig(
|
|
model_path="Davids048/LTX2-Base-Diffusers",
|
|
engine=EngineConfig(
|
|
num_gpus=1,
|
|
),
|
|
)
|
|
)
|
|
|
|
output_path = "outputs_video/ltx2_basic/output_ltx2_base_t2v_1088_1920_1.1.mp4"
|
|
generator.generate(
|
|
GenerationRequest(
|
|
prompt=PROMPT,
|
|
output=OutputConfig(
|
|
output_path=output_path,
|
|
save_video=True,
|
|
),
|
|
sampling=SamplingConfig(
|
|
num_frames=121,
|
|
height=1088,
|
|
width=1920,
|
|
),
|
|
)
|
|
)
|
|
generator.shutdown()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|