Skip to content

Commit

Permalink
Hotfix multiratio upscale (#117)
Browse files Browse the repository at this point in the history
* hotfix the tiles to process when input is incorrect

* hotfix the multitiles feature and allow upscale to refiner without a full refine first
  • Loading branch information
MaraScott authored Jul 15, 2024
1 parent d1b785e commit c98a7e3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
13 changes: 11 additions & 2 deletions py/nodes/UpscalerRefiner/McBoaty_v5.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,10 +510,10 @@ def is_valid_index(index, max = 64):
def to_computer_index(human_index):
return human_index - 1

_tiles_to_process = None
_tiles_to_process = []

if tiles_to_process == '':
return []
return _tiles_to_process

indexes = tiles_to_process.split(',')

Expand All @@ -525,6 +525,7 @@ def to_computer_index(human_index):
if is_valid_index(start, max) and is_valid_index(end, max):
_tiles_to_process.extend(range(to_computer_index(start), to_computer_index(end) + 1))
else:
_tiles_to_process.append(-1)
log(f"tiles_to_process is not in valid format '{tiles_to_process}' - Allowed formats : indexes from 1 to {max} or any range like 1-{max}", None, COLORS['YELLOW'], f"Node {self.INFO.id}")
else:
# Single index
Expand All @@ -533,13 +534,17 @@ def to_computer_index(human_index):
if is_valid_index(index, max):
_tiles_to_process.append(to_computer_index(index))
else:
_tiles_to_process.append(-1)
log(f"tiles_to_process is not in valid format '{tiles_to_process}' - Allowed formats : indexes from 1 to {max} or any range like 1-{max}", None, COLORS['YELLOW'], f"Node {self.INFO.id}")
except ValueError:
_tiles_to_process.append(-1)
# Ignore non-integer values
pass

# Remove duplicates and sort
_tiles_to_process = sorted(set(_tiles_to_process))
if -1 in _tiles_to_process:
_tiles_to_process = [-1]

return _tiles_to_process

Expand Down Expand Up @@ -622,6 +627,10 @@ def refine(self, image, iteration):
output = (nodes.VAEDecode().decode(self.KSAMPLER.vae, latent_output)[0].unsqueeze(0))[0]
output_images.append(output)

if len(self.PARAMS.tiles_to_process) > 0 and len(self.OUTPUTS.grid_tiles_to_process) == 0:
log("!!! WARNING !!! you are processing specific tiles without a fully refined image, we suggest to pass through a full refiner first", None, COLORS['YELLOW'], f"Node {self.INFO.id} {iteration}")
self.OUTPUTS.grid_tiles_to_process = self.OUTPUTS.grid_images

if len(self.PARAMS.tiles_to_process) > 0:
_grid_tiles_to_process = list(self.OUTPUTS.grid_tiles_to_process)
for index, output_image in enumerate(output_images):
Expand Down
2 changes: 1 addition & 1 deletion py/utils/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
#
###

VERSION = "5.0.3"
VERSION = "5.0.4"
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "comfyui_marascott_nodes"
description = "A set of nodes including a universal bus, an Inpainting By Mask and a large Upscaler/Refiner"
version = "5.0.3"
version = "5.0.4"
license = "LICENSE"
dependencies = ["blend_modes", "numba", "color-matcher", "groq", "opencv-python"]

Expand Down

0 comments on commit c98a7e3

Please sign in to comment.