Skip to content

Commit

Permalink
fix(api): defer txt2img tiling to panorama pipeline when selected
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Sep 5, 2023
1 parent d94a8d6 commit 440e47f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 2 additions & 0 deletions api/onnx_web/chain/source_txt2img.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ def run(
)

tile_size = params.tiles

# this works for panorama as well, because tile_size is already max(tile_size, *size)
latent_size = size.min(tile_size, tile_size)

# generate new latents or slice existing
Expand Down
15 changes: 11 additions & 4 deletions api/onnx_web/diffusers/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,26 @@ def run_txt2img_pipeline(
upscale: UpscaleParams,
highres: HighresParams,
) -> None:
# if using panorama, the pipeline will tile itself (views)
pipe_type = params.get_valid_pipeline("txt2img")
if pipe_type == "panorama":
tile_size = max(params.tiles, size.width, size.height)
else:
tile_size = params.tiles

# prepare the chain pipeline and first stage
chain = ChainPipeline()
stage = StageParams(
tile_size=params.tiles,
)
chain.stage(
SourceTxt2ImgStage(),
stage,
StageParams(
tile_size=tile_size,
),
size=size,
overlap=params.overlap,
)

# apply upscaling and correction, before highres
stage = StageParams(tile_size=params.tiles)
first_upscale, after_upscale = split_upscale(upscale)
if first_upscale:
stage_upscale_correction(
Expand Down

0 comments on commit 440e47f

Please sign in to comment.