Skip to content

Commit

Permalink
fixes pipe to cpu
Browse files Browse the repository at this point in the history
  • Loading branch information
w4ffl35 committed Jan 9, 2024
1 parent a9d4a21 commit dd9bb6a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/airunner/aihandler/mixins/memory_efficient_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,15 +232,17 @@ def move_pipe_to_cpu(self):
if not self.pipe:
return
try:
self.pipe.to("cpu", self.data_type).float32()
self.pipe.to("cpu", self.data_type)
except NotImplementedError:
logger.warning("Not implemented error when moving to cpu")

if hasattr(self.pipe, "controlnet"):
try:
self.pipe.controlnet.to("cpu", self.data_type).float32()
self.pipe.controlnet.to("cpu", self.data_type)
except NotImplementedError:
logger.warning("Not implemented error when moving to cpu")
except AttributeError:
pass

def apply_cpu_offload(self):
if self.cpu_offload_applied == self.enable_model_cpu_offload:
Expand Down

0 comments on commit dd9bb6a

Please sign in to comment.