From 9a91821bd2f1cb7ae92d8a50a26213bb84f38b96 Mon Sep 17 00:00:00 2001 From: sayakpaul Date: Fri, 5 Dec 2025 20:34:09 +0700 Subject: [PATCH] fix example usage. --- src/diffusers/hooks/taylorseer_cache.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/diffusers/hooks/taylorseer_cache.py b/src/diffusers/hooks/taylorseer_cache.py index 3c5a606bd2..7cad9f4fa1 100644 --- a/src/diffusers/hooks/taylorseer_cache.py +++ b/src/diffusers/hooks/taylorseer_cache.py @@ -69,13 +69,15 @@ class TaylorSeerCacheConfig: - Patterns are matched using `re.fullmatch` on the module name. - If `skip_predict_identifiers` or `cache_identifiers` are provided, only matching modules are hooked. - If neither is provided, all attention-like modules are hooked by default. - - Example of inactive and active usage: - ``` - def forward(x): - x = self.module1(x) # inactive module: returns zeros tensor based on shape recorded during full compute - x = self.module2(x) # active module: caches output here, avoiding recomputation of prior steps - return x - ``` + + Example of inactive and active usage: + + ```py + def forward(x): + x = self.module1(x) # inactive module: returns zeros tensor based on shape recorded during full compute + x = self.module2(x) # active module: caches output here, avoiding recomputation of prior steps + return x + ``` """ cache_interval: int = 5