Cache hooks: add `cache_context` to all official pipelines + TaylorSeer fallback when no context is set
維護者通常 1 天內回覆
評估
這個 Issue 還沒有評估資料。
描述
Follow-up from the review discussion on #14923 (comment) by @yiyixuxu, related to #14922.
Context
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_contextto all officially supported pipelines.CacheContextnow 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.
- Use accurate names. For example, distilled pipelines with a single model call per step shouldn't label it
-
TaylorSeer should work without a context manager. TaylorSeer doesn't actually need any context, so
TaylorSeerCacheConfigshould fall back to a default/single state when nocache_contextis set, instead of raising. Then it works on any pipeline or a bare model call, whether or not part 1 is done.
Related
- #14922 (Enable TaylorSeer for all Flux pipelines)
- #14923 (wraps Flux pipeline transformer calls in
cache_context)
cc @sayakpaul
Requested by Sayak Paul - Slack thread - Agent trace
- 主要語言
- Python
- 星號
- 34.9k
- 分支
- 7.5k
- 平均合併
- 3 天 16 小時
- 30 天內合併 PR
- 65
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
huggingface/diffusers 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 84/100
huggingface/diffusers#15363 ·
維護者通常 1 天內回覆
-
`ZImageImg2ImgPipeline` / `ZImageInpaintPipeline`: explicit height/width different from the input image raises RuntimeError可能已有人在做 @chessing234 於 1 天前認領。 未關閉bug
難度 2/5 1-3 小時 新手友好度 70/100
huggingface/diffusers#15337 · 2 則留言 ·
維護者通常 1 天內回覆
-
Multi-vector textual inversion uses only the first vector when the token has uppercase letters (transformers v5)可能已有人在做 @sunhouy 於 2 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 75/100
huggingface/diffusers#15313 ·
維護者通常 1 天內回覆
-
TCDScheduler advances the generator on the final step of a strength-truncated custom schedule可能已有人在做 @SIDDARTHAREDDY8 於 5 天前認領。 未關閉bug
難度 2/5 1-3 小時 新手友好度 74/100
huggingface/diffusers#15288 · 2 則留言 ·
維護者通常 1 天內回覆
-
unload_textual_inversion(token) leaves the extra tokens of a multi-vector embedding behind, so it can't be loaded again可能已有人在做 @sohailshk 於 11 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 72/100
huggingface/diffusers#15211 · 3 則留言 ·
維護者通常 1 天內回覆
查看 huggingface/diffusers 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 73/100
維護者通常 1 天內回覆
-
Unused loot bag group names left in dreamcraft en_US.lang可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉Status: Triage Suggestion
難度 1/5 1 小時以內 新手友好度 90/100
GTNewHorizons/GT-New-Horizons-Modpack#27789 ·
維護者通常 1 天內回覆
-
bug frontend sev-5
難度 2/5 1-3 小時 新手友好度 83/100
-
core good first issue
難度 2/5 1-3 小時 新手友好度 65/100
-
b4b code health next
難度 2/5 1-3 小時 新手友好度 68/100
維護者通常 1 天內回覆