Skip to content

Commit 44df014

Browse files
committed
fix controlnet offload
1 parent da913d6 commit 44df014

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

diffsynth_engine/pipelines/flux_image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -921,8 +921,8 @@ def predict_multicontrolnet(
921921
text_ids,
922922
)
923923
if self.offload_mode is not None:
924-
empty_cache()
925924
param.model.to("cpu")
925+
empty_cache()
926926
double_block_output_results = accumulate(double_block_output_results, double_block_output)
927927
single_block_output_results = accumulate(single_block_output_results, single_block_output)
928928
return double_block_output_results, single_block_output_results

diffsynth_engine/pipelines/sd_image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,8 @@ def predict_multicontrolnet(
310310
)
311311
controlnet_res = [res * current_scale for res in controlnet_res]
312312
if self.offload_mode is not None:
313+
param.model.to("cpu")
313314
empty_cache()
314-
param.model.to("cpu")
315315
controlnet_res_stack = accumulate(controlnet_res_stack, controlnet_res)
316316
return controlnet_res_stack
317317

diffsynth_engine/pipelines/sdxl_image.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,8 @@ def predict_multicontrolnet(
335335
)
336336
controlnet_res = [res * current_scale for res in controlnet_res]
337337
if self.offload_mode is not None:
338-
empty_cache()
339-
param.model.to("cpu")
338+
param.model.to("cpu")
339+
empty_cache()
340340
controlnet_res_stack = accumulate(controlnet_res_stack, controlnet_res)
341341
return controlnet_res_stack
342342

0 commit comments

Comments
 (0)