|
|
|
|
|
import sys, os |
|
import numpy as np |
|
|
|
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "comfy")) |
|
sys.path.append('../ComfyUI') |
|
|
|
import comfy.samplers |
|
import comfy.sd |
|
import comfy.utils |
|
|
|
import comfy_extras.clip_vision |
|
|
|
import model_management |
|
import importlib |
|
|
|
import nodes |
|
|
|
class WAS_KSampler: |
|
@classmethod |
|
def INPUT_TYPES(s): |
|
return {"required": |
|
{"model": ("MODEL",), |
|
"seed": ("SEED",), |
|
"steps": ("INT", {"default": 20, "min": 1, "max": 10000}), |
|
"cfg": ("FLOAT", {"default": 8.0, "min": 0.0, "max": 100.0}), |
|
"sampler_name": (comfy.samplers.KSampler.SAMPLERS, ), |
|
"scheduler": (comfy.samplers.KSampler.SCHEDULERS, ), |
|
"positive": ("CONDITIONING", ), |
|
"negative": ("CONDITIONING", ), |
|
"latent_image": ("LATENT", ), |
|
"denoise": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01}), |
|
} |
|
} |
|
|
|
RETURN_TYPES = ("LATENT",) |
|
FUNCTION = "sample" |
|
|
|
CATEGORY = "sampling" |
|
|
|
def sample(self, model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise=1.0): |
|
return nodes.common_ksampler(model, seed['seed'], steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise=denoise) |
|
|
|
class WAS_Seed: |
|
@classmethod |
|
def INPUT_TYPES(s): |
|
return {"required": |
|
{"seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff})} |
|
} |
|
|
|
|
|
RETURN_TYPES = ("SEED",) |
|
FUNCTION = "seed" |
|
|
|
CATEGORY = "constant" |
|
|
|
def seed(self, seed): |
|
return ( {"seed": seed,}, ) |
|
|
|
NODE_CLASS_MAPPINGS = { |
|
"KSampler (WAS)": WAS_KSampler, |
|
"Seed": WAS_Seed |
|
} |
|
|