diff --git a/docs/source/en/optimization/cache.md b/docs/source/en/optimization/cache.md index b1dc8f7bb9..20bbfc02c7 100644 --- a/docs/source/en/optimization/cache.md +++ b/docs/source/en/optimization/cache.md @@ -72,7 +72,7 @@ pipeline.transformer.enable_cache(config) [FirstBlock Cache](https://huggingface.co/docs/diffusers/main/en/api/cache#diffusers.FirstBlockCacheConfig) checks how much the early layers of the denoiser changes from one timestep to the next. If the change is small, the model skips the expensive later layers and reuses the previous output. -\```py +```py import torch from diffusers import DiffusionPipeline from diffusers.hooks import apply_first_block_cache, FirstBlockCacheConfig @@ -81,4 +81,4 @@ pipeline = DiffusionPipeline.from_pretrained( "Qwen/Qwen-Image", torch_dtype=torch.bfloat16 ) apply_first_block_cache(pipeline.transformer, FirstBlockCacheConfig(threshold=0.2)) -\``` \ No newline at end of file +```