Add custom nodes, Civitai loras (LFS), and vast.ai setup script
Some checks failed
Python Linting / Run Ruff (push) Has been cancelled
Python Linting / Run Pylint (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.10, [self-hosted Linux], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.11, [self-hosted Linux], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.12, [self-hosted Linux], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-unix-nightly (12.1, , linux, 3.11, [self-hosted Linux], nightly) (push) Has been cancelled
Execution Tests / test (macos-latest) (push) Has been cancelled
Execution Tests / test (ubuntu-latest) (push) Has been cancelled
Execution Tests / test (windows-latest) (push) Has been cancelled
Test server launches without errors / test (push) Has been cancelled
Unit Tests / test (macos-latest) (push) Has been cancelled
Unit Tests / test (ubuntu-latest) (push) Has been cancelled
Unit Tests / test (windows-2022) (push) Has been cancelled
Some checks failed
Python Linting / Run Ruff (push) Has been cancelled
Python Linting / Run Pylint (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.10, [self-hosted Linux], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.11, [self-hosted Linux], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.12, [self-hosted Linux], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-unix-nightly (12.1, , linux, 3.11, [self-hosted Linux], nightly) (push) Has been cancelled
Execution Tests / test (macos-latest) (push) Has been cancelled
Execution Tests / test (ubuntu-latest) (push) Has been cancelled
Execution Tests / test (windows-latest) (push) Has been cancelled
Test server launches without errors / test (push) Has been cancelled
Unit Tests / test (macos-latest) (push) Has been cancelled
Unit Tests / test (ubuntu-latest) (push) Has been cancelled
Unit Tests / test (windows-2022) (push) Has been cancelled
Includes 30 custom nodes committed directly, 7 Civitai-exclusive loras stored via Git LFS, and a setup script that installs all dependencies and downloads HuggingFace-hosted models on vast.ai. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
71
custom_nodes/comfyui_ultimatesdupscale/usdu_patch.py
Normal file
71
custom_nodes/comfyui_ultimatesdupscale/usdu_patch.py
Normal file
@@ -0,0 +1,71 @@
|
||||
# Make some patches to the script
|
||||
from repositories import ultimate_upscale as usdu
|
||||
import modules.shared as shared
|
||||
import math
|
||||
from PIL import Image
|
||||
|
||||
|
||||
if (not hasattr(Image, 'Resampling')): # For older versions of Pillow
|
||||
Image.Resampling = Image
|
||||
|
||||
#
|
||||
# Instead of using multiples of 64, use multiples of 8
|
||||
#
|
||||
|
||||
|
||||
def round_length(length, multiple=8):
|
||||
return round(length / multiple) * multiple
|
||||
|
||||
|
||||
# Upscaler
|
||||
old_init = usdu.USDUpscaler.__init__
|
||||
|
||||
|
||||
def new_init(self, p, image, upscaler_index, save_redraw, save_seams_fix, tile_width, tile_height):
|
||||
p.width = round_length(image.width * p.upscale_by)
|
||||
p.height = round_length(image.height * p.upscale_by)
|
||||
old_init(self, p, image, upscaler_index, save_redraw, save_seams_fix, tile_width, tile_height)
|
||||
|
||||
|
||||
usdu.USDUpscaler.__init__ = new_init
|
||||
|
||||
# Redraw
|
||||
old_setup_redraw = usdu.USDURedraw.init_draw
|
||||
|
||||
|
||||
def new_setup_redraw(self, p, width, height):
|
||||
mask, draw = old_setup_redraw(self, p, width, height)
|
||||
p.width = round_length(self.tile_width + self.padding)
|
||||
p.height = round_length(self.tile_height + self.padding)
|
||||
return mask, draw
|
||||
|
||||
|
||||
usdu.USDURedraw.init_draw = new_setup_redraw
|
||||
|
||||
# Seams fix
|
||||
old_setup_seams_fix = usdu.USDUSeamsFix.init_draw
|
||||
|
||||
|
||||
def new_setup_seams_fix(self, p):
|
||||
old_setup_seams_fix(self, p)
|
||||
p.width = round_length(self.tile_width + self.padding)
|
||||
p.height = round_length(self.tile_height + self.padding)
|
||||
|
||||
|
||||
usdu.USDUSeamsFix.init_draw = new_setup_seams_fix
|
||||
|
||||
|
||||
#
|
||||
# Make the script upscale on a batch of images instead of one image
|
||||
#
|
||||
|
||||
old_upscale = usdu.USDUpscaler.upscale
|
||||
|
||||
|
||||
def new_upscale(self):
|
||||
old_upscale(self)
|
||||
shared.batch = [self.image] + \
|
||||
[img.resize((self.p.width, self.p.height), resample=Image.LANCZOS) for img in shared.batch[1:]]
|
||||
|
||||
|
||||
usdu.USDUpscaler.upscale = new_upscale
|
||||
Reference in New Issue
Block a user