[refactor]: migrate examples/scripts to typed VideoGenerator API; rename api/compat.py to api/translation.py

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.
This commit is contained in:
SolitaryThinker
2026-07-11 03:26:24 -07:00
parent 19a51a1fe6
commit bbbb7ab021
87 changed files with 2493 additions and 1461 deletions
+15 -10
View File
@@ -22,6 +22,10 @@ sharing, or run on a smaller-resolution generation.
import torch
from fastvideo import VideoGenerator
from fastvideo.api import (
EngineConfig, GenerationRequest, GeneratorConfig, OutputConfig,
SamplingConfig,
)
from fastvideo.eval import Evaluator
from fastvideo.eval.io import build_eval_kwargs
@@ -58,19 +62,20 @@ METRICS = [
def main() -> None:
# ----- generation (matches examples/inference/basic/basic_ltx2.py) -----
generator = VideoGenerator.from_pretrained(
"Davids048/LTX2-Base-Diffusers",
num_gpus=1,
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_video(
prompt=PROMPT,
output_path=output_path,
save_video=True,
num_frames=121,
height=1088,
width=1920,
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()
# Free residual CUDA memory the generator left behind so the