fix(api): avoid setting device on schedulers that do not support it
This commit is contained in:
parent
39a422f2e5
commit
d636ce3eef
|
@ -68,7 +68,7 @@ def load_pipeline(pipeline: DiffusionPipeline, model: str, provider: str, schedu
|
|||
scheduler=scheduler.from_pretrained(model, subfolder='scheduler')
|
||||
)
|
||||
|
||||
if device is not None:
|
||||
if device is not None and hasattr(pipe, 'to'):
|
||||
pipe = pipe.to(device)
|
||||
|
||||
last_pipeline_instance = pipe
|
||||
|
@ -80,7 +80,7 @@ def load_pipeline(pipeline: DiffusionPipeline, model: str, provider: str, schedu
|
|||
scheduler = scheduler.from_pretrained(
|
||||
model, subfolder='scheduler')
|
||||
|
||||
if device is not None:
|
||||
if device is not None and hasattr(scheduler, 'to'):
|
||||
scheduler = scheduler.to(device)
|
||||
|
||||
pipe.scheduler = scheduler
|
||||
|
|
Loading…
Reference in New Issue