diff --git a/api/onnx_web/chain/tile.py b/api/onnx_web/chain/tile.py index a6705e5c..01ea9f2b 100644 --- a/api/onnx_web/chain/tile.py +++ b/api/onnx_web/chain/tile.py @@ -266,6 +266,7 @@ def process_tile_stack( tiles: List[Tuple[int, int, Image.Image]] = [] tile_coords = tile_generator(width, height, tile, overlap) + single_tile = len(tile_coords) == 1 for counter, (left, top) in enumerate(tile_coords): logger.info( @@ -291,7 +292,12 @@ def process_tile_stack( needs_margin = True bottom_margin = height - bottom - if needs_margin: + if single_tile: + logger.debug("using single tile") + tile_stack = sources + if mask: + tile_mask = mask + elif needs_margin: logger.debug( "tiling with added margins: %s, %s, %s, %s", left_margin, diff --git a/api/onnx_web/diffusers/load.py b/api/onnx_web/diffusers/load.py index 7e78ab62..49c89f8a 100644 --- a/api/onnx_web/diffusers/load.py +++ b/api/onnx_web/diffusers/load.py @@ -229,9 +229,7 @@ def load_pipeline( tokenizer_2=components.get("tokenizer_2", None), ) else: - logger.debug( - "assembling SD pipeline for %s", pipeline_class.__name__ - ) + logger.debug("assembling SD pipeline for %s", pipeline_class.__name__) if pipeline_class == OnnxStableDiffusionUpscalePipeline: # upscale uses a single VAE diff --git a/api/onnx_web/diffusers/pipelines/upscale.py b/api/onnx_web/diffusers/pipelines/upscale.py index 2fb3a2e1..aa07cc99 100644 --- a/api/onnx_web/diffusers/pipelines/upscale.py +++ b/api/onnx_web/diffusers/pipelines/upscale.py @@ -2,7 +2,9 @@ from logging import getLogger from typing import Any, List from diffusers.pipelines.onnx_utils import OnnxRuntimeModel -from diffusers.pipelines.stable_diffusion import OnnxStableDiffusionUpscalePipeline as BasePipeline +from diffusers.pipelines.stable_diffusion import ( + OnnxStableDiffusionUpscalePipeline as BasePipeline, +) from diffusers.schedulers import DDPMScheduler logger = getLogger(__name__)