Skip to content

Commit

Permalink
Hotfix mc boaty v3 (#71)
Browse files Browse the repository at this point in the history
* hotfix to match UltimateSDUpscale field distribution and to fix bug if feather at 0

* update registry
  • Loading branch information
MaraScott committed Jun 13, 2024
1 parent 0182f92 commit 5ba7866
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 23 deletions.
17 changes: 10 additions & 7 deletions py/inc/lib/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ class MS_Image_v2(MS_Image):

@classmethod
def get_dynamic_grid_specs(self, width, height, rows_qty = 3, cols_qty = 3, size_unit = 64):
# size_unit AKA feather_mask
feather_size = size_unit
if size_unit == 0:
size_unit = 1
# size_unit AKA feather_size
tile_width = width / cols_qty
tile_height = height / rows_qty
tile_width_units_qty = math.ceil(tile_width / size_unit)
Expand All @@ -92,19 +95,19 @@ def get_dynamic_grid_specs(self, width, height, rows_qty = 3, cols_qty = 3, size

# if first or last width tile
if col_index == 0:
x = x_tile_coordinate
x = x_tile_coordinate - (0 * feather_size)
elif col_index == (cols_qty - 1):
x = x_tile_coordinate - (2 * size_unit) - last_tile_width_diff
x = x_tile_coordinate - (2 * feather_size) - last_tile_width_diff
else:
x = x_tile_coordinate - (1 * size_unit)
x = x_tile_coordinate - (1 * feather_size)

# if first or last height tile
if row_index == 0:
y = y_tile_coordinate - (0 * size_unit)
y = y_tile_coordinate - (0 * feather_size)
elif row_index == (rows_qty - 1):
y = y_tile_coordinate - (2 * size_unit) - last_tile_height_diff
y = y_tile_coordinate - (2 * feather_size) - last_tile_height_diff
else:
y = y_tile_coordinate - (1 * size_unit)
y = y_tile_coordinate - (1 * feather_size)

tiles.append([
row_index,
Expand Down
28 changes: 14 additions & 14 deletions py/nodes/UpscalerRefiner/McBoaty_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

from ...utils.log import *

import time
class UpscalerRefiner_McBoaty_v3():

SIGMAS_TYPES = [
Expand All @@ -31,8 +32,9 @@ class UpscalerRefiner_McBoaty_v3():
, "AlignYourStepsScheduler"
]
MODEL_TYPE_SIZES = {
"SD1": 512,
"SD1.5": 512,
"SDXL": 1024,
"SD3": 1024,
"SVD": 1024,
}

Expand All @@ -51,30 +53,25 @@ def INPUT_TYPES(self):
},
"required":{
"image": ("IMAGE", {"label": "Image" }),
"output_size": ("BOOLEAN", { "label": "Output Size", "default": True, "label_on": "Upscale size", "label_off": "Input size"}),

"upscale_model": (folder_paths.get_filename_list("upscale_models"), { "label": "Upscale Model" }),

"feather_mask": ("INT", { "label": "Feather Mask", "default": 64, "min": 0, "max": nodes.MAX_RESOLUTION, "step": 1}),

"model": ("MODEL", { "label": "Model" }),
"vae": ("VAE", { "label": "VAE" }),
"vae_encode": ("BOOLEAN", { "label": "VAE Encode type", "default": True, "label_on": "tiled", "label_off": "standard"}),
"positive": ("CONDITIONING", { "label": "Positive" }),
"negative": ("CONDITIONING", { "label": "Negative" }),

"tile_size": ("INT", { "label": "Tile Size", "default": 512, "min": 320, "max": 4096, "step": 64}),

"seed": ("INT", { "label": "Seed", "default": 4, "min": 0, "max": 0xffffffffffffffff}),

"sigmas_type": (self.SIGMAS_TYPES, { "label": "Sigms Type" }),
"sampler_name": (comfy.samplers.KSampler.SAMPLERS, { "label": "Sampler Name" }),
"basic_scheduler": (comfy.samplers.KSampler.SCHEDULERS, { "label": "Basic Scheduler" }),
"ays_model_type": (self.AYS_MODEL_TYPES, { "label": "Model Type" }),

"output_size": ("BOOLEAN", { "label": "Output Size", "default": True, "label_on": "Upscale size", "label_off": "Input size"}),
"upscale_model": (folder_paths.get_filename_list("upscale_models"), { "label": "Upscale Model" }),
"steps": ("INT", { "label": "Steps", "default": 10, "min": 1, "max": 10000}),
"cfg": ("FLOAT", { "label": "CFG", "default": 2.5, "min": 0.0, "max": 100.0, "step":0.1, "round": 0.01}),
"sigmas_type": (self.SIGMAS_TYPES, { "label": "Sigmas Type" }),
"sampler_name": (comfy.samplers.KSampler.SAMPLERS, { "label": "Sampler Name" }),
"basic_scheduler": (comfy.samplers.KSampler.SCHEDULERS, { "label": "Basic Scheduler" }),
"denoise": ("FLOAT", { "label": "Denoise", "default": 0.35, "min": 0.0, "max": 1.0, "step": 0.01}),
"ays_model_type": (self.AYS_MODEL_TYPES, { "label": "Model Type" }),
"tile_size": ("INT", { "label": "Tile Size", "default": 512, "min": 320, "max": 4096, "step": 64}),
"feather_mask": ("INT", { "label": "Feather Mask", "default": 64, "min": 32, "max": nodes.MAX_RESOLUTION, "step": 32}),

},
"optional": {
Expand Down Expand Up @@ -178,6 +175,9 @@ def init(self, **kwargs):
self.KSAMPLER.sigmas = self._get_sigmas(self.KSAMPLER.sigmas_type, self.KSAMPLER.model, self.KSAMPLER.steps, self.KSAMPLER.denoise, self.KSAMPLER.scheduler, self.KSAMPLER.model_type)
self.KSAMPLER.outpaint_sigmas = self._get_sigmas(self.KSAMPLER.sigmas_type, self.KSAMPLER.model, self.KSAMPLER.steps, 1, self.KSAMPLER.scheduler, self.KSAMPLER.model_type)

# TODO : make the feather_mask proportional to tile size ?
# self.PARAMS.feather_mask = self.KSAMPLER.tile_size // 16

self.OUTPUTS = SimpleNamespace(
output_info = [f"No info"],
)
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 = "4.2.3"
VERSION = "4.2.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 = "4.2.3"
version = "4.2.4"
license = "LICENSE"

[project.urls]
Expand Down

0 comments on commit 5ba7866

Please sign in to comment.