Skip to content

WanVideoToVideoPipeline: "No cache context is set" when caching is enabled #15006

Open

Description

@fusheng-ji

Describe the bug

Enabling FirstBlockCache, TaylorSeer, or MagCache on WanVideoToVideoPipeline fails on the first denoising step with ValueError: No cache context is set. The conditional and unconditional transformer calls in the pipeline don't run inside a cond / uncond cache context.

This is the Wan video-to-video case of #12760.

Reproduction

import torch
from diffusers import WanVideoToVideoPipeline, FirstBlockCacheConfig
from diffusers.utils import load_video

pipe = WanVideoToVideoPipeline.from_pretrained(
    "Wan-AI/Wan2.1-T2V-1.3B-Diffusers", torch_dtype=torch.bfloat16
)
pipe.to("cuda")
pipe.transformer.enable_cache(FirstBlockCacheConfig(threshold=0.2))

video = load_video("<any input video>")
out = pipe(video=video, prompt="a cat walking", strength=0.5, guidance_scale=5.0,
           num_inference_steps=16, height=480, width=832).frames[0]

Logs

ValueError: No cache context is set

System Info

diffusers main (@ cff9daf), torch 2.7.1+cu128, B200

Who can help?

@sayakpaul

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions