Skip to content

Commit 722fa26

Browse files
authored
Update pipeline_utils.py
1 parent 1fddee2 commit 722fa26

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

src/diffusers/pipelines/pipeline_utils.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,9 +1126,6 @@ def enable_model_cpu_offload(self, gpu_id: Optional[int] = None, device: Union[t
11261126
self._offload_device = device
11271127

11281128
self.to("cpu", silence_dtype_warnings=True)
1129-
device_mod = getattr(torch, device.type, None)
1130-
if hasattr(device_mod, "empty_cache") and device_mod.is_available():
1131-
device_mod.empty_cache() # otherwise we don't see the memory savings (but they probably exist)
11321129

11331130
all_model_components = {k: v for k, v in self.components.items() if isinstance(v, torch.nn.Module)}
11341131

@@ -1234,9 +1231,6 @@ def enable_sequential_cpu_offload(self, gpu_id: Optional[int] = None, device: Un
12341231

12351232
if self.device.type != "cpu":
12361233
self.to("cpu", silence_dtype_warnings=True)
1237-
device_mod = getattr(torch, self.device.type, None)
1238-
if hasattr(device_mod, "empty_cache") and device_mod.is_available():
1239-
device_mod.empty_cache() # otherwise we don't see the memory savings (but they probably exist)
12401234

12411235
for name, model in self.components.items():
12421236
if not isinstance(model, torch.nn.Module):

0 commit comments

Comments
 (0)