Added legacy support for old v1.x workflows
This commit is contained in:
+1
-1
@@ -1,2 +1,2 @@
|
||||
/__pycache__/
|
||||
/**/__pycache__/
|
||||
/temp/
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
"""
|
||||
|
||||
Custom nodes for SDXL in ComfyUI
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 SeargeDP
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
"""
|
||||
|
||||
Version = "Legacy 1.0.x"
|
||||
@@ -0,0 +1,75 @@
|
||||
"""
|
||||
|
||||
Custom nodes for SDXL in ComfyUI
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 SeargeDP
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
"""
|
||||
|
||||
import comfy.samplers
|
||||
import nodes
|
||||
|
||||
from nodes import MAX_RESOLUTION
|
||||
|
||||
|
||||
# SDXL Sampler with base and refiner support
|
||||
|
||||
class SeargeSDXLSampler:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {
|
||||
"base_model": ("MODEL",),
|
||||
"base_positive": ("CONDITIONING", ),
|
||||
"base_negative": ("CONDITIONING", ),
|
||||
"refiner_model": ("MODEL",),
|
||||
"refiner_positive": ("CONDITIONING", ),
|
||||
"refiner_negative": ("CONDITIONING", ),
|
||||
"latent_image": ("LATENT", ),
|
||||
"noise_seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}),
|
||||
"steps": ("INT", {"default": 30, "min": 1, "max": 1000}),
|
||||
"cfg": ("FLOAT", {"default": 7.0, "min": 0.0, "max": 100.0, "step": 0.5}),
|
||||
"sampler_name": (comfy.samplers.KSampler.SAMPLERS, {"default": "dpmpp_2m"}),
|
||||
"scheduler": (comfy.samplers.KSampler.SCHEDULERS, {"default": "karras"}),
|
||||
"base_ratio": ("FLOAT", {"default": 0.8, "min": 0.0, "max": 1.0, "step": 0.01}),
|
||||
"denoise": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01}),
|
||||
},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("LATENT", )
|
||||
RETURN_NAMES = ("", )
|
||||
FUNCTION = "sample"
|
||||
|
||||
CATEGORY = "Searge/Legacy"
|
||||
|
||||
def sample(self, base_model, base_positive, base_negative, refiner_model, refiner_positive, refiner_negative, latent_image, noise_seed, steps, cfg, sampler_name, scheduler, base_ratio, denoise):
|
||||
base_steps = int(steps * base_ratio)
|
||||
|
||||
if denoise < 0.01:
|
||||
return (latent_image, )
|
||||
|
||||
if base_steps >= steps:
|
||||
return nodes.common_ksampler(base_model, noise_seed, steps, cfg, sampler_name, scheduler, base_positive, base_negative, latent_image, denoise=denoise, disable_noise=False, start_step=0, last_step=steps, force_full_denoise=True)
|
||||
|
||||
base_result = nodes.common_ksampler(base_model, noise_seed, steps, cfg, sampler_name, scheduler, base_positive, base_negative, latent_image, denoise=denoise, disable_noise=False, start_step=0, last_step=base_steps, force_full_denoise=False)
|
||||
|
||||
return nodes.common_ksampler(refiner_model, noise_seed, steps, cfg, sampler_name, scheduler, refiner_positive, refiner_negative, base_result[0], denoise=1.0, disable_noise=True, start_step=base_steps, last_step=steps, force_full_denoise=True)
|
||||
@@ -41,10 +41,12 @@ from datetime import datetime
|
||||
from PIL import Image
|
||||
from PIL.PngImagePlugin import PngInfo
|
||||
|
||||
from .modules.legacy import SeargeSDXLSampler
|
||||
|
||||
|
||||
# SDXL Sampler with base and refiner support
|
||||
|
||||
class SeargeSDXLSampler:
|
||||
class SeargeSDXLSampler2:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {
|
||||
@@ -1608,7 +1610,7 @@ class SeargeGenerated1:
|
||||
# Register nodes in ComfyUI
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"SeargeSDXLSampler": SeargeSDXLSampler,
|
||||
"SeargeSDXLSampler2": SeargeSDXLSampler2,
|
||||
"SeargeSDXLImage2ImageSampler": SeargeSDXLImage2ImageSampler,
|
||||
|
||||
"SeargeSamplerInputs": SeargeSamplerInputs,
|
||||
@@ -1659,13 +1661,15 @@ NODE_CLASS_MAPPINGS = {
|
||||
"SeargeInput7": SeargeInput7,
|
||||
"SeargeOutput7": SeargeOutput7,
|
||||
"SeargeGenerated1": SeargeGenerated1,
|
||||
|
||||
"SeargeSDXLSampler": SeargeSDXLSampler,
|
||||
}
|
||||
|
||||
|
||||
# Human readable names for the nodes
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"SeargeSDXLSampler": "SDXL Sampler (SeargeSDXL)",
|
||||
"SeargeSDXLSampler2": "SDXL Sampler (SeargeSDXL)",
|
||||
"SeargeSDXLImage2ImageSampler": "Image2Image Sampler (SeargeSDXL)",
|
||||
|
||||
"SeargeSamplerInputs": "Sampler Settings",
|
||||
@@ -1688,11 +1692,11 @@ NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"SeargeFloatPair": "Float Pair",
|
||||
"SeargeFloatMath": "Float Math",
|
||||
|
||||
"SeargeImageSave": "Save Image",
|
||||
"SeargeCheckpointLoader": "Checkpoint Loader",
|
||||
"SeargeVAELoader": "VAE Loader",
|
||||
"SeargeUpscaleModelLoader": "Upscale Model Loader",
|
||||
"SeargeLoraLoader": "Lora Loader",
|
||||
"SeargeImageSave": "Save Image (SeargeSDXL)",
|
||||
"SeargeCheckpointLoader": "Checkpoint Loader (SeargeSDXL)",
|
||||
"SeargeVAELoader": "VAE Loader (SeargeSDXL)",
|
||||
"SeargeUpscaleModelLoader": "Upscale Model Loader (SeargeSDXL)",
|
||||
"SeargeLoraLoader": "Lora Loader (SeargeSDXL)",
|
||||
|
||||
"SeargeLatentMuxer3": "3-Way Muxer for Latents",
|
||||
"SeargeConditioningMuxer2": "2-Way Muxer for Conditioning",
|
||||
@@ -1716,4 +1720,6 @@ NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"SeargeInput7": "Misc Parameters",
|
||||
"SeargeOutput7": "Misc Parameters",
|
||||
"SeargeGenerated1": "Flow Control Parameters",
|
||||
|
||||
"SeargeSDXLSampler": "Legacy SDXL Sampler (SeargeSDXL)",
|
||||
}
|
||||
|
||||
@@ -9383,7 +9383,7 @@
|
||||
},
|
||||
{
|
||||
"id": 358,
|
||||
"type": "SeargeSDXLSampler",
|
||||
"type": "SeargeSDXLSampler2",
|
||||
"pos": [
|
||||
4600,
|
||||
4730
|
||||
@@ -9593,7 +9593,7 @@
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "SeargeSDXLSampler"
|
||||
"Node name for S&R": "SeargeSDXLSampler2"
|
||||
},
|
||||
"widgets_values": [
|
||||
213103709520708,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user