1
0
Fork 0

fix(api): avoid setting device on schedulers that do not support it

This commit is contained in:
Sean Sube 2023-02-04 17:21:12 -06:00
parent 39a422f2e5
commit d636ce3eef
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
1 changed files with 2 additions and 2 deletions

View File

@ -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