Cache hooks: add `cache_context` to all official pipelines + TaylorSeer fallback when no context is set
I maintainer di solito rispondono entro 1 giorno
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
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
- Lingua principale
- Python
- Stelle
- 34.9k
- Fork
- 7.5k
- Merge medio
- 3g 16h
- PR unite (30g)
- 65
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di huggingface/diffusers
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
huggingface/diffusers#15363 ·
I maintainer di solito rispondono entro 1 giorno
-
`ZImageImg2ImgPipeline` / `ZImageInpaintPipeline`: explicit height/width different from the input image raises RuntimeErrorForse già presa @chessing234 l’ha presa 1 giorno fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
huggingface/diffusers#15337 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Multi-vector textual inversion uses only the first vector when the token has uppercase letters (transformers v5)Forse già presa @sunhouy l’ha presa 2 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
huggingface/diffusers#15313 ·
I maintainer di solito rispondono entro 1 giorno
-
TCDScheduler advances the generator on the final step of a strength-truncated custom scheduleForse già presa @SIDDARTHAREDDY8 l’ha presa 5 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
huggingface/diffusers#15288 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
unload_textual_inversion(token) leaves the extra tokens of a multi-vector embedding behind, so it can't be loaded againForse già presa @sohailshk l’ha presa 11 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
huggingface/diffusers#15211 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di huggingface/diffusers
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
I maintainer di solito rispondono entro 1 giorno
-
Unused loot bag group names left in dreamcraft en_US.langForse già presa Una pull request collegata a questa issue è aperta o già unita. ApertaStatus: Triage Suggestion
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
GTNewHorizons/GT-New-Horizons-Modpack#27789 ·
I maintainer di solito rispondono entro 1 giorno
-
bug frontend sev-5
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
-
core good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
b4b code health next
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
ESCOMP/CTSM#4330 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno