Skip to content

Commit c833b6e

Browse files
fix offload mode (#82)
1 parent e6b8f1f commit c833b6e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

diffsynth_engine/pipelines/base.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def enable_cpu_offload(self, offload_mode: str):
258258
valid_offload_mode = ("cpu_offload", "sequential_cpu_offload")
259259
if offload_mode not in valid_offload_mode:
260260
raise ValueError(f"offload_mode must be one of {valid_offload_mode}, but got {offload_mode}")
261-
if self.device == "cpu":
261+
if self.device == "cpu" or self.device == "mps":
262262
logger.warning("must set an non cpu device for pipeline before calling enable_cpu_offload")
263263
return
264264
if offload_mode == "cpu_offload":
@@ -274,6 +274,9 @@ def enable_model_cpu_offload(self):
274274
self.offload_mode = "cpu_offload"
275275

276276
def enable_sequential_cpu_offload(self):
277+
if self.device == "cpu" or self.device == "mps":
278+
logger.warning("must set an non cpu device for pipeline before calling enable_sequential_cpu_offload")
279+
return
277280
for model_name in self.model_names:
278281
model = getattr(self, model_name)
279282
if model is not None:

0 commit comments

Comments
 (0)