Skip to content

Commit

Permalink
fix(api): apply FP16 patches to SD upscaling pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Apr 10, 2023
1 parent b4095cc commit 464bfd0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion api/onnx_web/chain/upscale_stable_diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from diffusers import StableDiffusionUpscalePipeline
from PIL import Image

from ..diffusers.load import optimize_pipeline
from ..diffusers.load import optimize_pipeline, patch_pipeline
from ..diffusers.pipeline_onnx_stable_diffusion_upscale import (
OnnxStableDiffusionUpscalePipeline,
)
Expand Down Expand Up @@ -36,6 +36,7 @@ def load_stable_diffusion(
model_path,
device.provider,
)
pipeline = OnnxStableDiffusionUpscalePipeline
pipe = OnnxStableDiffusionUpscalePipeline.from_pretrained(
model_path,
provider=device.ort_provider(),
Expand All @@ -47,6 +48,7 @@ def load_stable_diffusion(
model_path,
device.provider,
)
pipeline = StableDiffusionUpscalePipeline
pipe = StableDiffusionUpscalePipeline.from_pretrained(
model_path,
provider=device.provider,
Expand All @@ -56,6 +58,7 @@ def load_stable_diffusion(
pipe.set_progress_bar_config(disable=True)

optimize_pipeline(server, pipe)
patch_pipeline(server, pipe, pipeline)

server.cache.set("diffusion", cache_key, pipe)
run_gc([device])
Expand Down

0 comments on commit 464bfd0

Please sign in to comment.