You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cache hooks: add cache_context to all official pipelines + TaylorSeer fallback when no context is set #15321
Stateful cache hooks get their per-call state from StateManager.context (src/diffusers/hooks/hooks.py). If the denoiser runs outside model.cache_context(...), it raises:
ValueError: No cache context is set. Wrap the denoiser call in `model.cache_context(name, ...)` before calling it.
Right now only some pipelines wrap their transformer calls (for example, pipeline_flux.py uses "cond" / "uncond"). The other Flux pipelines don't, so pipe.transformer.enable_cache(TaylorSeerCacheConfig(...)) fails on them (#14922).
Proposal
There are two parts, and they can be done separately:
Add cache_context to all officially supported pipelines.CacheContext now carries more than the name (step_index, num_inference_steps, timestep, sigma), so pipelines should pass that loop information through the context manager in a consistent way.
Use accurate names. For example, distilled pipelines with a single model call per step shouldn't label it "cond". They should either leave the name out or use a name that matches what the call actually is.
TaylorSeer should work without a context manager. TaylorSeer doesn't actually need any context, so TaylorSeerCacheConfig should fall back to a default/single state when no cache_context is set, instead of raising. Then it works on any pipeline or a bare model call, whether or not part 1 is done.
Activity
sayakpaul commentedon Nov 17, 2026
Somewhat related #14900