fix(api): embed LPW pipeline (fixes #96)
This commit is contained in:
parent
49b3aa68bb
commit
7c5f9baeb7
|
@ -72,10 +72,10 @@ def load_pipeline(
|
||||||
)
|
)
|
||||||
pipe = pipeline.from_pretrained(
|
pipe = pipeline.from_pretrained(
|
||||||
model,
|
model,
|
||||||
|
custom_pipeline="./onnx_web/diffusion/lpw_stable_diffusion_onnx.py",
|
||||||
provider=device.provider,
|
provider=device.provider,
|
||||||
provider_options=device.options,
|
provider_options=device.options,
|
||||||
custom_pipeline='lpw_stable_diffusion_onnx',
|
revision="onnx",
|
||||||
revision='onnx',
|
|
||||||
safety_checker=None,
|
safety_checker=None,
|
||||||
scheduler=scheduler,
|
scheduler=scheduler,
|
||||||
)
|
)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,3 +1,10 @@
|
||||||
|
###
|
||||||
|
# This is based on a combination of the ONNX img2img pipeline and the PyTorch upscale pipeline:
|
||||||
|
# https://github.com/huggingface/diffusers/blob/v0.11.1/src/diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion_img2img.py
|
||||||
|
# https://github.com/huggingface/diffusers/blob/v0.11.1/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_upscale.py
|
||||||
|
# See also: https://github.com/huggingface/diffusers/pull/2158
|
||||||
|
###
|
||||||
|
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
from typing import Any, Callable, List, Optional, Union
|
from typing import Any, Callable, List, Optional, Union
|
||||||
|
|
||||||
|
@ -18,12 +25,6 @@ num_channels_latents = 4
|
||||||
# TODO: make this dynamic, from self.unet.config.in_channels
|
# TODO: make this dynamic, from self.unet.config.in_channels
|
||||||
unet_in_channels = 7
|
unet_in_channels = 7
|
||||||
|
|
||||||
###
|
|
||||||
# This is based on a combination of the ONNX img2img pipeline and the PyTorch upscale pipeline:
|
|
||||||
# https://github.com/huggingface/diffusers/blob/v0.11.1/src/diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion_img2img.py
|
|
||||||
# https://github.com/huggingface/diffusers/blob/v0.11.1/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_upscale.py
|
|
||||||
###
|
|
||||||
|
|
||||||
|
|
||||||
def preprocess(image):
|
def preprocess(image):
|
||||||
if isinstance(image, torch.Tensor):
|
if isinstance(image, torch.Tensor):
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
[tool.isort]
|
[tool.isort]
|
||||||
profile = "black"
|
profile = "black"
|
||||||
|
force_to_top = ".logging"
|
||||||
|
|
Loading…
Reference in New Issue