Skip to content

Commit be1986a

Browse files
committed
Post-refactor fixes vol. 2
* Reload model before generation, if it is offloaded to CPU * Load model if boost got selected * Do not try to offload pix2pix * Net dimensions are multiple of 32 regardless of match size * Change the default net size to default net size of the default model
1 parent 447b7af commit be1986a

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

scripts/core.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,9 @@ def core_generation_funnel(outpath, inputimages, inputdepthmaps, inputnames, inp
165165
else:
166166
# override net size (size may be different for different images)
167167
if match_size:
168-
net_width, net_height = inputimages[count].width, inputimages[count].height
168+
# Round up to a multiple of 32 to avoid potential issues
169+
net_width = (inputimages[count].width + 31) // 32 * 32
170+
net_height = (inputimages[count].height + 31) // 32 * 32
169171
raw_prediction, raw_prediction_invert = \
170172
model_holder.get_raw_prediction(inputimages[count], net_width, net_height)
171173

scripts/interface_webui.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ def main_ui_panel(is_depth_tab):
4949
with gr.Group(visible=False) as options_depend_on_boost:
5050
inp += 'match_size', gr.Checkbox(label="Match net size to input size", value=False)
5151
with gr.Row(visible=False) as options_depend_on_match_size:
52-
inp += 'net_width', gr.Slider(minimum=64, maximum=2048, step=64, label='Net width', value=512)
53-
inp += 'net_height', gr.Slider(minimum=64, maximum=2048, step=64, label='Net height', value=512)
52+
inp += 'net_width', gr.Slider(minimum=64, maximum=2048, step=64, label='Net width', value=448)
53+
inp += 'net_height', gr.Slider(minimum=64, maximum=2048, step=64, label='Net height', value=448)
5454

5555
with gr.Group():
5656
with gr.Row():

0 commit comments

Comments
 (0)