Skip to content

Commit

Permalink
Changed default tile size to 256 for ONNX (#2007)
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment authored Jul 28, 2023
1 parent 2983619 commit c62c498
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions backend/src/nodes/impl/upscale/auto_split_tiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def estimate_tile_size(
ESTIMATE = TileSize(0)
NO_TILING = TileSize(-1)
MAX_TILE_SIZE = TileSize(-2)
TILE_SIZE_256 = TileSize(256)


def parse_tile_size_input(tile_size: TileSize, estimate: Callable[[], Tiler]) -> Tiler:
Expand Down
5 changes: 4 additions & 1 deletion backend/src/nodes/properties/inputs/generic_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,9 @@ def FillColor::getOutputChannels(fill: FillColor, channels: uint) {
)


def TileSizeDropdown(label="Tile Size", estimate=True) -> DropDownInput:
def TileSizeDropdown(
label="Tile Size", estimate=True, default: TileSize | None = None
) -> DropDownInput:
options = []
if estimate:
options.append({"option": "Auto (estimate)", "value": 0})
Expand All @@ -490,6 +492,7 @@ def TileSizeDropdown(label="Tile Size", estimate=True) -> DropDownInput:
label=label,
options=options,
associated_type=TileSize,
default_value=default,
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
from nodes.impl.onnx.model import OnnxModel
from nodes.impl.onnx.session import get_onnx_session
from nodes.impl.onnx.utils import get_input_shape, get_output_shape
from nodes.impl.upscale.auto_split_tiles import TileSize, parse_tile_size_input
from nodes.impl.upscale.auto_split_tiles import (
TILE_SIZE_256,
TileSize,
parse_tile_size_input,
)
from nodes.impl.upscale.convenient_upscale import convenient_upscale
from nodes.impl.upscale.tiler import ExactTileSize
from nodes.properties.inputs import ImageInput, OnnxGenericModelInput, TileSizeDropdown
Expand Down Expand Up @@ -50,7 +54,7 @@ def estimate():
inputs=[
ImageInput().with_id(1),
OnnxGenericModelInput().with_id(0),
TileSizeDropdown(estimate=False)
TileSizeDropdown(estimate=False, default=TILE_SIZE_256)
.with_id(2)
.with_docs(
"Tiled upscaling is used to allow large images to be upscaled without hitting memory limits.",
Expand Down

0 comments on commit c62c498

Please sign in to comment.