- It features a clean, consistent API that works across popular video models, making it easier for developers to author new models and incorporate system- or kernel-level optimizations. With FastVideo's optimizations, you can achieve more than 3x inference improvement compared to other systems.
+ FastVideo is an inference and post-training framework for diffusion models. It features an end-to-end unified pipeline for accelerating diffusion models, starting from data preprocessing to model training, finetuning, distillation, and inference. FastVideo is designed to be modular and extensible, allowing users to easily add new optimizations and techniques. Whether it is training-free optimizations or post-training optimizations, FastVideo has you covered.
The compute for this demo is generously provided by GMI Cloud. Note that this demo is meant to showcase FastWan2.1's quality and that under a large number of requests, generation speed may be affected.
+
The compute for this demo is generously provided by GMI Cloud. Note that this demo is meant to showcase FastWan's quality and that under a large number of requests, generation speed may be affected.
""")
@@ -874,7 +877,7 @@ def main():
# print(f"I2V Model: {args.i2v_model_path}") # I2V functionality commented out
# Use FastAPI to serve custom HTML with proper Open Graph metadata
- from fastapi import FastAPI
+ from fastapi import FastAPI, Request
from fastapi.responses import HTMLResponse, FileResponse
import uvicorn
import os
@@ -883,39 +886,62 @@ def main():
@app.get("/logo.png")
async def get_logo():
- return FileResponse("fastvideo-logos/main/png/full.png", media_type="image/png")
+ from fastapi import Response
+ return FileResponse(
+ "fastvideo-logos/main/png/full.png",
+ media_type="image/png",
+ headers={
+ "Cache-Control": "public, max-age=3600",
+ "Access-Control-Allow-Origin": "*"
+ }
+ )
@app.get("/", response_class=HTMLResponse)
- def index():
- return """
+ def index(request: Request):
+ # Get the current host for dynamic URLs
+ base_url = str(request.base_url).rstrip('/')
+ return f"""
-
-
-
-
-
-
-
-
-
+
+
FastWan
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/inference/gradio/ray_serve_backend.py b/examples/inference/gradio/ray_serve_backend.py
index 60c38d697..21f4a1e30 100644
--- a/examples/inference/gradio/ray_serve_backend.py
+++ b/examples/inference/gradio/ray_serve_backend.py
@@ -18,14 +18,10 @@ from slowapi.errors import RateLimitExceeded
import imageio
from ray.serve.handle import DeploymentHandle
-NUM_GPUS = 8
+NUM_GPUS = 16
SUPPORTED_MODELS = [
"FastVideo/FastWan2.1-T2V-1.3B-Diffusers",
- "FastVideo/FastWan2.1-T2V-14B-Diffusers",
"FastVideo/FastWan2.2-TI2V-5B-Diffusers",
- "Wan-AI/Wan2.1-T2V-1.3B-Diffusers",
- "Wan-AI/Wan2.1-T2V-14B-Diffusers",
- "Wan-AI/Wan2.2-TI2V-5B-Diffusers",
]
@@ -109,10 +105,10 @@ class T2VModelDeployment:
# time.sleep(5)
# Ensure correct attention backend for FastVideo
- if "FastVideo" in self.model_path:
- os.environ["FASTVIDEO_ATTENTION_BACKEND"] = "VIDEO_SPARSE_ATTN"
- else:
+ if "5b" in self.model_path.lower():
os.environ["FASTVIDEO_ATTENTION_BACKEND"] = "FLASH_ATTN"
+ else:
+ os.environ["FASTVIDEO_ATTENTION_BACKEND"] = "VIDEO_SPARSE_ATTN"
os.environ["FASTVIDEO_STAGE_LOGGING"] = "1"
# Lazy import to keep the deployment import-safe on head node
diff --git a/examples/inference/gradio/start.sh b/examples/inference/gradio/start.sh
index 7d026acf6..1f5ae540f 100644
--- a/examples/inference/gradio/start.sh
+++ b/examples/inference/gradio/start.sh
@@ -1,3 +1,3 @@
python examples/inference/gradio/start_ray_serve_app.py \
---t2v_model_paths "FastVideo/FastWan2.1-T2V-1.3B-Diffusers,FastVideo/FastWan2.2-TI2V-5B-Diffusers,Wan-AI/Wan2.1-T2V-1.3B-Diffusers,Wan-AI/Wan2.2-TI2V-5B-Diffusers" \
---t2v_model_replicas "2,2,2,2"
\ No newline at end of file
+--t2v_model_paths "FastVideo/FastWan2.1-T2V-1.3B-Diffusers,FastVideo/FastWan2.2-TI2V-5B-Diffusers" \
+--t2v_model_replicas "8,8"
\ No newline at end of file