• Stefy Lanza (nextime / spora )'s avatar
    Graceful Wan t2v/i2v fallback on mode-vs-model mismatch · 9494d1bd
    Stefy Lanza (nextime / spora ) authored
    The pipeline class is selected from the request mode, which can disagree with
    the model's real capability (transformer input channels), causing a hard
    channel-mismatch crash. Detect and degrade gracefully for Wan:
    
    - ti2v/i2v request on a t2v model (transformer in_channels=16): rebuild as a
      plain WanPipeline and run t2v with the keyframe dropped.
    - t2v request on an i2v model (in_channels=36): rebuild as
      WanImageToVideoPipeline (image_encoder/processor are optional) and seed a
      neutral gray frame so the prompt still drives the clip.
    
    Both rebuild a sibling pipeline reusing the SAME components, so fused
    acceleration and per-request LoRAs on the shared transformer carry over with no
    reload; the view is cached on the pipe so repeated clips reuse it and
    _sync_video_loras' adapter dedup stays intact. Helpers: _wan_in_channels(),
    _maybe_t2v_fallback(), _maybe_i2v_fallback().
    Co-Authored-By: 's avatarClaude Opus 4.8 <noreply@anthropic.com>
    9494d1bd
video.py 102 KB