Skip to content

Commit 1f94810

Browse files
authored
[docs] Fix DiffusionPipeline.enable_sequential_cpu_offload docstring (huggingface#4952)
* Fix an unmatched backtick and make description more general for DiffusionPipeline.enable_sequential_cpu_offload. * make style * _exclude_from_cpu_offload -> self._exclude_from_cpu_offload * make style * apply suggestions from review * make style
1 parent 37cb819 commit 1f94810

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/diffusers/pipelines/pipeline_utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,10 +1293,10 @@ def maybe_free_model_hooks(self):
12931293

12941294
def enable_sequential_cpu_offload(self, gpu_id: int = 0, device: Union[torch.device, str] = "cuda"):
12951295
r"""
1296-
Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, unet,
1297-
text_encoder, vae and safety checker have their state dicts saved to CPU and then are moved to a
1298-
`torch.device('meta') and loaded to GPU only when their specific submodule has its `forward` method called.
1299-
Note that offloading happens on a submodule basis. Memory savings are higher than with
1296+
Offloads all models to CPU using 🤗 Accelerate, significantly reducing memory usage. When called, the state
1297+
dicts of all `torch.nn.Module` components (except those in `self._exclude_from_cpu_offload`) are saved to CPU
1298+
and then moved to `torch.device('meta')` and loaded to GPU only when their specific submodule has its `forward`
1299+
method called. Offloading happens on a submodule basis. Memory savings are higher than with
13001300
`enable_model_cpu_offload`, but performance is lower.
13011301
"""
13021302
if is_accelerate_available() and is_accelerate_version(">=", "0.14.0"):

0 commit comments

Comments
 (0)