Skip to content

Commit

Permalink
fix(api): abandon pretrained loader entirely to fix SD upscaling
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Nov 26, 2023
1 parent 75f1a2c commit fa38b47
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions api/onnx_web/diffusers/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,17 +230,32 @@ def load_pipeline(
)
else:
logger.debug(
"loading pretrained SD pipeline for %s", pipeline_class.__name__
)
pipe = pipeline_class.from_pretrained(
model,
provider=device.ort_provider(),
sess_options=device.sess_options(),
safety_checker=None,
torch_dtype=torch_dtype,
**components,
"assembling SD pipeline for %s", pipeline_class.__name__
)

if pipeline_class == OnnxStableDiffusionUpscalePipeline:
# upscale uses a single VAE
pipe = pipeline_class(
components["vae"],
components["text_encoder"],
components["tokenizer"],
components["unet"],
scheduler,
scheduler,
)
else:
pipe = pipeline_class(
components["vae_encoder"],
components["vae_decoder"],
components["text_encoder"],
components["tokenizer"],
components["unet"],
scheduler,
None,
None,
requires_safety_checker=False,
)

if not server.show_progress:
pipe.set_progress_bar_config(disable=True)

Expand Down

0 comments on commit fa38b47

Please sign in to comment.