From c6cfc5ce1df3c6080c955c389b58767600154c37 Mon Sep 17 00:00:00 2001 From: sayakpaul Date: Wed, 19 Nov 2025 08:40:28 +0530 Subject: [PATCH 1/2] polish caching docs. --- docs/source/en/api/cache.md | 2 +- docs/source/en/optimization/cache.md | 6 +++++- src/diffusers/models/cache_utils.py | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/source/en/api/cache.md b/docs/source/en/api/cache.md index 9ba474208551..cb7fa9b3af0c 100644 --- a/docs/source/en/api/cache.md +++ b/docs/source/en/api/cache.md @@ -29,7 +29,7 @@ Cache methods speedup diffusion transformers by storing and reusing intermediate [[autodoc]] apply_faster_cache -### FirstBlockCacheConfig +## FirstBlockCacheConfig [[autodoc]] FirstBlockCacheConfig diff --git a/docs/source/en/optimization/cache.md b/docs/source/en/optimization/cache.md index 881529b27ff1..d42c5d709324 100644 --- a/docs/source/en/optimization/cache.md +++ b/docs/source/en/optimization/cache.md @@ -66,4 +66,8 @@ config = FasterCacheConfig( tensor_format="BFCHW", ) pipeline.transformer.enable_cache(config) -``` \ No newline at end of file +``` + +## FirstBlockCache + +[First Block Cache](https://huggingface.co/docs/diffusers/main/en/api/cache#diffusers.FirstBlockCacheConfig) builds on the ideas of [TeaCache](https://huggingface.co/papers/2411.19108). It is much simpler to implement generically for a wide range of models and has been integrated first for experimental purposes. \ No newline at end of file diff --git a/src/diffusers/models/cache_utils.py b/src/diffusers/models/cache_utils.py index 605c0d588c8c..13ce01d8352e 100644 --- a/src/diffusers/models/cache_utils.py +++ b/src/diffusers/models/cache_utils.py @@ -41,9 +41,11 @@ def enable_cache(self, config) -> None: Enable caching techniques on the model. Args: - config (`Union[PyramidAttentionBroadcastConfig]`): + config (`Union[PyramidAttentionBroadcastConfig, FasterCacheConfig, FirstBlockCacheConfig]`): The configuration for applying the caching technique. Currently supported caching techniques are: - [`~hooks.PyramidAttentionBroadcastConfig`] + - [`~hooks.FasterCacheConfig`] + - [`~hooks.FirstBlockCacheConfig`] Example: From e3f441648c14e4f92fb2e179f2d08877d8d01957 Mon Sep 17 00:00:00 2001 From: Sayak Paul Date: Thu, 20 Nov 2025 10:00:46 +0530 Subject: [PATCH 2/2] Update docs/source/en/optimization/cache.md Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com> --- docs/source/en/optimization/cache.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/en/optimization/cache.md b/docs/source/en/optimization/cache.md index d42c5d709324..24a4761e9572 100644 --- a/docs/source/en/optimization/cache.md +++ b/docs/source/en/optimization/cache.md @@ -70,4 +70,4 @@ pipeline.transformer.enable_cache(config) ## FirstBlockCache -[First Block Cache](https://huggingface.co/docs/diffusers/main/en/api/cache#diffusers.FirstBlockCacheConfig) builds on the ideas of [TeaCache](https://huggingface.co/papers/2411.19108). It is much simpler to implement generically for a wide range of models and has been integrated first for experimental purposes. \ No newline at end of file +[FirstBlock Cache](https://huggingface.co/docs/diffusers/main/en/api/cache#diffusers.FirstBlockCacheConfig) builds on the ideas of [TeaCache](https://huggingface.co/papers/2411.19108). It is much simpler to implement generically for a wide range of models and has been integrated first for experimental purposes. \ No newline at end of file