Per review: dispatch should be a directly-mapped HF-string -> card registry (like fastvideo), shared by every entrypoint (VideoGenerator + a future CLI / server), not buried in the generator. - New v2/registry.py mirrors fastvideo's fastvideo/registry.py hybrid resolution: (1) exact HF repo id in an explicit ModelEntry registry [PRIMARY — correct per-model card/capabilities, and the only way to split same-architecture capability variants like Wan2.1 T2V vs the i2v 'InP' 1.3B], (2) short repo-name match, (3) architecture inference [FALLBACK — local paths / unregistered repos]. resolve(model_path[, root]) is the single shared entry point. - video_generator.py: moved _read_arch_signature/_select_builders into the registry; from_config now calls resolve() — registered ids resolve with no config read, else arch inference on a cheap *.json snapshot. Reconciles the earlier 'no brittle table' refactor with the 'map hf string -> card' ask: one clean registry + a fallback, not three coupled structures. - Verified: registry resolves exact-id / short-name / arch-fallback / unregistered correctly; CPU suite green (202+2); wan21 GPU smoke generates via the new resolve path.
Basic Video Generation Tutorial
The VideoGenerator class provides the primary Python interface for doing offline video generation, which is interacting with a diffusion pipeline without using a separate inference api server.
Requirements
- At least a single NVIDIA GPU with CUDA 12.4.
- Python 3.10-3.12
Installation
If you have not installed FastVideo, please following these instructions first.
Usage
The first script in this example shows the most basic usage of FastVideo. If you are new to Python and FastVideo, you should start here.
# if you have not cloned the directory:
git clone https://github.com/hao-ai-lab/FastVideo.git && cd FastVideo
python examples/inference/basic/basic.py
For an example on Apple silicon:
python examples/inference/basic/basic_mps.py
For an example running DMD+VSA inference:
python examples/inference/basic/basic_dmd.py
For the typed config/request path added during the inference API refactor:
python examples/inference/basic/basic_dmd_new_api.py
Basic Walkthrough
All you need to generate videos using multi-gpus from state-of-the-art diffusion pipelines is the following few lines!
from fastvideo import VideoGenerator
def main():
generator = VideoGenerator.from_pretrained(
"Wan-AI/Wan2.1-T2V-1.3B-Diffusers",
num_gpus=1,
)
prompt = ("A curious raccoon peers through a vibrant field of yellow sunflowers, its eyes "
"wide with interest. The playful yet serene atmosphere is complemented by soft "
"natural light filtering through the petals. Mid-shot, warm and cheerful tones.")
video = generator.generate_video(prompt)
if __name__ == "__main__":
main()