Skip to content

Commit

Permalink
chore:enable model cpu offloading in all tasks pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
RUFFY-369 committed Dec 29, 2024
1 parent 7cd8af6 commit 441e48c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions runner/app/pipelines/image_to_image_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,11 @@ def __init__(self, model_id: str, task: str):
safety_checker=None,
**kwargs,
).to(torch_device)
self.pipeline_stage1.enable_model_cpu_offload()
self.pipeline_stage2 = StableDiffusionXLInpaintPipeline.from_pretrained(
"OzzyGT/RealVisXL_V4.0_inpainting", vae=self.vae, **kwargs
).to(torch_device)
self.pipeline_stage1.enable_model_cpu_offload()

elif self.task == TaskType.SKETCH_TO_IMAGE.value:
self.controlnet = ControlNetModel.from_pretrained(model_id, **kwargs).to(
Expand All @@ -115,6 +117,7 @@ def __init__(self, model_id: str, task: str):
scheduler=eulera_scheduler,
**kwargs,
).to(torch_device)
self.pipeline.enable_model_cpu_offload()

self._lora_loader = LoraLoader(self.pipeline)

Expand Down

0 comments on commit 441e48c

Please sign in to comment.