From 13eca6ef2ddda49ff3af93655b1c7a248bfeeec9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 24 Jun 2025 08:20:04 +0000 Subject: [PATCH] Apply style fixes --- src/diffusers/models/modeling_utils.py | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/diffusers/models/modeling_utils.py b/src/diffusers/models/modeling_utils.py index cffa907f82..8e1ec5f558 100644 --- a/src/diffusers/models/modeling_utils.py +++ b/src/diffusers/models/modeling_utils.py @@ -1407,22 +1407,18 @@ class ModelMixin(torch.nn.Module, PushToHubMixin): def compile_repeated_blocks(self, *args, **kwargs): """ - Compiles *only* the frequently repeated sub-modules of a model (e.g. the - Transformer layers) instead of compiling the entire model. This - technique—often called **regional compilation** (see the PyTorch recipe - https://docs.pytorch.org/tutorials/recipes/regional_compilation.html) - can reduce end-to-end compile time substantially, while preserving the - runtime speed-ups you would expect from a full `torch.compile`. + Compiles *only* the frequently repeated sub-modules of a model (e.g. the Transformer layers) instead of + compiling the entire model. This technique—often called **regional compilation** (see the PyTorch recipe + https://docs.pytorch.org/tutorials/recipes/regional_compilation.html) can reduce end-to-end compile time + substantially, while preserving the runtime speed-ups you would expect from a full `torch.compile`. - The set of sub-modules to compile is discovered by the presence of - **`_repeated_blocks`** attribute in the model definition. Define this - attribute on your model subclass as a list/tuple of class names - (strings). Every module whose class name matches will be compiled. + The set of sub-modules to compile is discovered by the presence of **`_repeated_blocks`** attribute in the + model definition. Define this attribute on your model subclass as a list/tuple of class names (strings). Every + module whose class name matches will be compiled. - Once discovered, each matching sub-module is compiled by calling - `submodule.compile(*args, **kwargs)`. Any positional or keyword - arguments you supply to `compile_repeated_blocks` are forwarded - verbatim to `torch.compile`. + Once discovered, each matching sub-module is compiled by calling `submodule.compile(*args, **kwargs)`. Any + positional or keyword arguments you supply to `compile_repeated_blocks` are forwarded verbatim to + `torch.compile`. """ repeated_blocks = getattr(self, "_repeated_blocks", None)