Skip to content

Commit 47f2d2c

Browse files
DN6patrickvonplaten
authored andcommitted
Fix model offload bug when key isn't present (#5030)
* fix model offload bug when key isn't present * make style
1 parent af85591 commit 47f2d2c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/diffusers/pipelines/pipeline_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1255,7 +1255,7 @@ def enable_model_cpu_offload(self, gpu_id: int = 0, device: Union[torch.device,
12551255
self._all_hooks = []
12561256
hook = None
12571257
for model_str in self.model_cpu_offload_seq.split("->"):
1258-
model = all_model_components.pop(model_str)
1258+
model = all_model_components.pop(model_str, None)
12591259
if not isinstance(model, torch.nn.Module):
12601260
continue
12611261

0 commit comments

Comments
 (0)