Skip to content

Commit

Permalink
fix(api): restore single-tile code path
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Nov 28, 2023
1 parent a9b4303 commit 828c951
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
8 changes: 7 additions & 1 deletion api/onnx_web/chain/tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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,
Expand Down
4 changes: 1 addition & 3 deletions api/onnx_web/diffusers/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion api/onnx_web/diffusers/pipelines/upscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
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__)
Expand Down

0 comments on commit 828c951

Please sign in to comment.