Skip to content

Commit

Permalink
Fix model offload bug when key isn't present (#5030)
Browse files Browse the repository at this point in the history
* fix model offload bug when key isn't present

* make style
  • Loading branch information
DN6 authored and patrickvonplaten committed Sep 14, 2023
1 parent af85591 commit 47f2d2c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/diffusers/pipelines/pipeline_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,7 @@ def enable_model_cpu_offload(self, gpu_id: int = 0, device: Union[torch.device,
self._all_hooks = []
hook = None
for model_str in self.model_cpu_offload_seq.split("->"):
model = all_model_components.pop(model_str)
model = all_model_components.pop(model_str, None)
if not isinstance(model, torch.nn.Module):
continue

Expand Down

0 comments on commit 47f2d2c

Please sign in to comment.