Skip to content

Commit cdee023

Browse files
Apply style fixes
1 parent 4ccde32 commit cdee023

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/diffusers/pipelines/pipeline_utils.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
numpy_to_pil,
6666
)
6767
from ..utils.hub_utils import _check_legacy_sharding_variant_format, load_or_create_model_card, populate_model_card
68-
from ..utils.torch_utils import is_compiled_module, get_device
68+
from ..utils.torch_utils import get_device, is_compiled_module
6969

7070

7171
if is_torch_npu_available():
@@ -1087,9 +1087,10 @@ def remove_all_hooks(self):
10871087
def enable_model_cpu_offload(self, gpu_id: Optional[int] = None, device: Union[torch.device, str] = None):
10881088
r"""
10891089
Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
1090-
to `enable_sequential_cpu_offload`, this method moves one whole model at a time to the accelerator when its `forward`
1091-
method is called, and the model remains in accelerator until the next model runs. Memory savings are lower than with
1092-
`enable_sequential_cpu_offload`, but performance is much better due to the iterative execution of the `unet`.
1090+
to `enable_sequential_cpu_offload`, this method moves one whole model at a time to the accelerator when its
1091+
`forward` method is called, and the model remains in accelerator until the next model runs. Memory savings are
1092+
lower than with `enable_sequential_cpu_offload`, but performance is much better due to the iterative execution
1093+
of the `unet`.
10931094
10941095
Arguments:
10951096
gpu_id (`int`, *optional*):
@@ -1205,8 +1206,8 @@ def enable_sequential_cpu_offload(self, gpu_id: Optional[int] = None, device: Un
12051206
r"""
12061207
Offloads all models to CPU using 🤗 Accelerate, significantly reducing memory usage. When called, the state
12071208
dicts of all `torch.nn.Module` components (except those in `self._exclude_from_cpu_offload`) are saved to CPU
1208-
and then moved to `torch.device('meta')` and loaded to accelerator only when their specific submodule has its `forward`
1209-
method called. Offloading happens on a submodule basis. Memory savings are higher than with
1209+
and then moved to `torch.device('meta')` and loaded to accelerator only when their specific submodule has its
1210+
`forward` method called. Offloading happens on a submodule basis. Memory savings are higher than with
12101211
`enable_model_cpu_offload`, but performance is lower.
12111212
12121213
Arguments:

0 commit comments

Comments
 (0)