Skip to content

Commit f5320f2

Browse files
authored
Disable HPU migration (future add-on to HF diffusers) for OH diffusers (#1866)
Signed-off-by: Daniel Socek <daniel.socek@intel.com>
1 parent f76f572 commit f5320f2

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

optimum/habana/diffusers/pipelines/pipeline_utils.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,16 @@ def is_saveable_module(name, value):
344344
create_pr=create_pr,
345345
)
346346

347+
def to(self, *args, **kwargs):
348+
"""
349+
Intercept to() method and disable gpu-hpu migration before sending to diffusers
350+
"""
351+
kwargs["hpu_migration"] = False
352+
return super().to(
353+
*args,
354+
**kwargs,
355+
)
356+
347357
@classmethod
348358
def from_pretrained(cls, pretrained_model_name_or_path: Optional[Union[str, os.PathLike]], **kwargs):
349359
"""

optimum/habana/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_mlperf.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,16 @@ def run_unet(
260260

261261
return latents
262262

263+
def to(self, *args, **kwargs):
264+
"""
265+
Intercept to() method and disable gpu-hpu migration before sending to diffusers
266+
"""
267+
kwargs["hpu_migration"] = False
268+
return super().to(
269+
*args,
270+
**kwargs,
271+
)
272+
263273
@classmethod
264274
def _split_inputs_into_batches(
265275
cls,

0 commit comments

Comments
 (0)