Skip to content

Commit

Permalink
fix(api): avoid setting device on schedulers that do not support it
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Feb 4, 2023
1 parent 39a422f commit d636ce3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/onnx_web/diffusion/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit d636ce3

Please sign in to comment.