### Verify FastVideo Setup Source: https://haoailab.com/FastVideo/contributing/developer_env/runpod?q= Run a simple Python import check and execute the test suite to verify that FastVideo is installed and configured correctly. ```bash cd /FastVideo python -c "import fastvideo; print('OK')" pytest tests/ -q --no-header ``` -------------------------------- ### Command-line Conversion (with torchrun) Source: https://haoailab.com/FastVideo/api/fastvideo/train/entrypoint/dcp_to_diffusers Alternatively, use torchrun for conversion, which is also supported. This example shows a basic setup with one process per node. ```bash torchrun --nproc_per_node=1 -m fastvideo.train.entrypoint.dcp_to_diffusers --checkpoint ... --output-dir ... ``` -------------------------------- ### Run Basic Inference Example Source: https://haoailab.com/FastVideo/inference/examples/basic?q= Execute the basic inference script to generate a video using default settings. This is the starting point for new users. ```bash python examples/inference/basic/basic.py ``` -------------------------------- ### YAML Configuration Example Source: https://haoailab.com/FastVideo/design/training_architecture Example YAML configuration file demonstrating how to define models, training methods, and training parameters for FastVideo. ```yaml models: student: _target_: fastvideo.train.models.wan.WanModel init_from: Wan-AI/Wan2.1-T2V-1.3B-Diffusers trainable: true teacher: _target_: fastvideo.train.models.wan.WanModel init_from: Wan-AI/Wan2.1-T2V-1.3B-Diffusers trainable: false critic: _target_: fastvideo.train.models.wan.WanModel init_from: Wan-AI/Wan2.1-T2V-1.3B-Diffusers trainable: true method: _target_: fastvideo.train.methods.distribution_matching.dmd2.DMD2Method rollout_mode: simulate dmd_denoising_steps: [1000, 850, 700, 550, 350, 275, 200, 125] generator_update_interval: 5 real_score_guidance_scale: 3.5 # ... training: distributed: { num_gpus: 8, sp_size: 1, tp_size: 1 } data: { data_path: ..., num_latent_t: 20, num_frames: 77 } optimizer: { learning_rate: 2.0e-6, betas: [0.0, 0.999] } loop: { max_train_steps: 4000 } checkpoint: { output_dir: outputs/my_run } callbacks: grad_clip: { max_grad_norm: 1.0 } validation: { pipeline_target: ..., every_steps: 100 } ``` -------------------------------- ### Install FastVideo from Source with uv Source: https://haoailab.com/FastVideo/getting_started/installation/gpu Install FastVideo in editable mode using uv after cloning the repository. ```bash uv pip install -e . ``` -------------------------------- ### Install and Run Pre-commit Hooks Locally Source: https://haoailab.com/FastVideo/contributing/pull_requests?q= Install pre-commit using uv and then install the hooks. Run all checks on all files to reproduce and auto-fix issues locally before pushing. ```bash # Install pre-commit if needed uv pip install pre-commit pre-commit install # Run all checks on all files pre-commit run --all-files ``` -------------------------------- ### Install Sage Attention from Source Source: https://haoailab.com/FastVideo/inference/optimizations Compile and install Sage Attention from its source repository. Use 'pip install -e .' as an alternative if preferred. ```bash git clone https://github.com/thu-ml/SageAttention.git cd sageattention python setup.py install # or pip install -e . ``` -------------------------------- ### FastVideo Gradio Interface Setup Source: https://haoailab.com/FastVideo/inference/examples/local?q= Configures and launches the FastVideo Gradio interface. It parses command-line arguments for model paths and server settings, loads models, and starts the web server. ```python import argparse import os def main(): parser = argparse.ArgumentParser(description="FastVideo Gradio Local Demo") parser.add_argument("--t2v_model_paths", type=str, default="FastVideo/FastWan2.1-T2V-1.3B-Diffusers", help="Comma separated list of paths to the T2V model(s)") parser.add_argument("--host", type=str, default="0.0.0.0", help="Host to bind to") parser.add_argument("--port", type=int, default=7860, help="Port to bind to") args = parser.parse_args() generators = {} default_params = {} model_paths = args.t2v_model_paths.split(",") for model_path in model_paths: print(f"Loading model: {model_path}") setup_model_environment(model_path) generators[model_path] = VideoGenerator.from_pretrained(model_path) default_params[model_path] = SamplingParam.from_pretrained(model_path) demo = create_gradio_interface(default_params, generators) print(f"Starting Gradio frontend at http://{args.host}:{args.port}") print(f"T2V Models: {args.t2v_model_paths}") from fastapi import FastAPI, Request, HTTPException from fastapi.responses import HTMLResponse, FileResponse import uvicorn app = FastAPI() @app.get("/logo.png") def get_logo(): return FileResponse( "assets/full.svg", media_type="image/svg+xml", headers={ "Cache-Control": "public, max-age=3600", "Access-Control-Allow-Origin": "*" } ) @app.get("/favicon.ico") def get_favicon(): favicon_path = "assets/icon-simple.svg" if os.path.exists(favicon_path): return FileResponse( favicon_path, media_type="image/svg+xml", headers={ "Cache-Control": "public, max-age=3600", "Access-Control-Allow-Origin": "*" } ) else: raise HTTPException(status_code=404, detail="Favicon not found") @app.get("/", response_class=HTMLResponse) def index(request: Request): base_url = str(request.base_url).rstrip('/') return f"""