1
0
Fork 0

fix: limit UNet stride to tile size

This commit is contained in:
Sean Sube 2023-05-03 19:21:32 -05:00
parent 3b02fc5768
commit e68e405633
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
3 changed files with 10 additions and 2 deletions

View File

@ -140,7 +140,7 @@ def pipeline_from_request(
get_config_value("overlap", "max"),
get_config_value("overlap", "min"),
)
stride = get_and_clamp_float(
stride = get_and_clamp_int(
request.args,
"stride",
get_config_value("stride"),
@ -148,6 +148,10 @@ def pipeline_from_request(
get_config_value("stride", "min"),
)
if stride > tiles:
logger.info("limiting stride to tile size, %s > %s", stride, tiles)
stride = tiles
seed = int(request.args.get("seed", -1))
if seed == -1:
# this one can safely use np.random because it produces a single value

View File

@ -34,6 +34,9 @@ export function ImageControl(props: ImageControlProps) {
staleTime: STALE_TIME,
});
// max stride is the lesser of tile size and server's max stride
const maxStride = Math.max(controlState.tiles, params.stride.max);
return <Stack spacing={2}>
<Stack direction='row' spacing={4}>
<QueryList
@ -181,7 +184,7 @@ export function ImageControl(props: ImageControlProps) {
<NumericField
label={t('parameter.stride')}
min={params.stride.min}
max={params.stride.max}
max={maxStride}
step={params.stride.step}
value={controlState.stride}
onChange={(stride) => {

View File

@ -220,6 +220,7 @@ export function baseParamsFromServer(defaults: ServerParams): Required<BaseImgPa
tiledVAE: defaults.tiledVAE.default,
tiles: defaults.tiles.default,
overlap: defaults.overlap.default,
stride: defaults.stride.default,
};
}