Iceyy4400's picture
Document the real ZeroGPU duration ceiling
c6cc224 verified
|
Raw History Blame Contribute Delete
3.69 kB

A newer version of the Gradio SDK is available: 6.30.0

Upgrade
metadata
title: Wan 2.2 Animate Character Replace
emoji: 🎬
colorFrom: purple
colorTo: pink
sdk: gradio
sdk_version: 5.43.1
app_file: app.py
pinned: false
license: apache-2.0
short_description: Replace a video's character with Wan 2.2 Animate

Wan 2.2 Animate — Character Replace

Upload a reference image (the character to insert) and a source video. The pipeline detects pose, face and body mask in the video with ViTPose/YOLO/SAM2, then re-renders it with the reference character using Wan 2.2 Animate on a free ZeroGPU GPU.

This Space is a vendored ComfyUI checkout (core + 4 custom node packs) driven headlessly by app.py, which wraps a workflow exported with ComfyUI-to-Python-Extension in a Gradio UI, following Run ComfyUI workflows on Spaces.

How it's put together

  • app.py — Gradio UI + the exported workflow, adapted to:
    • download every model from the Hub at first launch (download_models()) instead of committing weights to the repo,
    • load the fixed models (UNET + LoRAs, CLIP, CLIP Vision, VAE, SAM2, detector) once at startup and keep them resident, and
    • run only the per-request part of the graph inside a @spaces.GPU(duration=300) function.
  • custom_nodes/ — the 4 node packs this workflow depends on:
  • everything else (comfy/, nodes.py, execution.py, ...) is an unmodified checkout of ComfyUI.

Models (downloaded automatically on first launch)

File Source
umt5_xxl_fp8_e4m3fn_scaled.safetensors Comfy-Org/Wan_2.1_ComfyUI_repackaged
clip_vision_h.safetensors Comfy-Org/Wan_2.1_ComfyUI_repackaged
wan_2.1_vae.safetensors Comfy-Org/Wan_2.2_ComfyUI_Repackaged
Wan2_2-Animate-14B_fp8_e4m3fn_scaled_KJ.safetensors Kijai/WanVideo_comfy_fp8_scaled
lightx2v_I2V_14B_480p_cfg_step_distill_rank64_bf16.safetensors Kijai/WanVideo_comfy
WanAnimate_relight_lora_fp16.safetensors Kijai/WanVideo_comfy
sam2.1_hiera_base_plus.safetensors Kijai/sam2-safetensors
yolov10m.onnx Wan-AI/Wan2.2-Animate-14B
vitpose-l-wholebody.onnx JunkyByte/easy_ViTPose

Known limitations

  • ZeroGPU duration. A full Wan 2.2 Animate render (14B UNET + SAM2 + ViTPose + YOLO, chained) can run long for a video model, but free-tier ZeroGPU rejects any @spaces.GPU(duration=...) above roughly 120s regardless of what the docs imply is possible (a 300s request was rejected outright as "illegal duration", partly because the large GPU size multiplies the requested duration for quota accounting). app.py is set to duration=120. A free account's daily ZeroGPU quota is also only 5 minutes total, so even a couple of runs near that ceiling can exhaust the whole day. Keep Frame Load Cap low while testing, and consider a PRO account (higher duration ceiling and 40 min/day quota) or a GPU quota grant for real use.
  • VRAM. ZeroGPU's default large size gives 48GB; if you see OOM errors, request size="xlarge" (96GB, 2x quota cost) on the @spaces.GPU decorator in app.py.
  • First launch is slow: it downloads ~20-30GB of models before the UI becomes usable.