mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-12-19 02:53:05 +08:00
Merge branch 'master' into dr-support-pip-cm
This commit is contained in:
commit
7fd87423b3
@ -171,6 +171,16 @@ def offset_first_sigma_for_snr(sigmas, model_sampling, percent_offset=1e-4):
|
|||||||
return sigmas
|
return sigmas
|
||||||
|
|
||||||
|
|
||||||
|
def ei_h_phi_1(h: torch.Tensor) -> torch.Tensor:
|
||||||
|
"""Compute the result of h*phi_1(h) in exponential integrator methods."""
|
||||||
|
return torch.expm1(h)
|
||||||
|
|
||||||
|
|
||||||
|
def ei_h_phi_2(h: torch.Tensor) -> torch.Tensor:
|
||||||
|
"""Compute the result of h*phi_2(h) in exponential integrator methods."""
|
||||||
|
return (torch.expm1(h) - h) / h
|
||||||
|
|
||||||
|
|
||||||
@torch.no_grad()
|
@torch.no_grad()
|
||||||
def sample_euler(model, x, sigmas, extra_args=None, callback=None, disable=None, s_churn=0., s_tmin=0., s_tmax=float('inf'), s_noise=1.):
|
def sample_euler(model, x, sigmas, extra_args=None, callback=None, disable=None, s_churn=0., s_tmin=0., s_tmax=float('inf'), s_noise=1.):
|
||||||
"""Implements Algorithm 2 (Euler steps) from Karras et al. (2022)."""
|
"""Implements Algorithm 2 (Euler steps) from Karras et al. (2022)."""
|
||||||
@ -1550,13 +1560,12 @@ def sample_er_sde(model, x, sigmas, extra_args=None, callback=None, disable=None
|
|||||||
@torch.no_grad()
|
@torch.no_grad()
|
||||||
def sample_seeds_2(model, x, sigmas, extra_args=None, callback=None, disable=None, eta=1., s_noise=1., noise_sampler=None, r=0.5):
|
def sample_seeds_2(model, x, sigmas, extra_args=None, callback=None, disable=None, eta=1., s_noise=1., noise_sampler=None, r=0.5):
|
||||||
"""SEEDS-2 - Stochastic Explicit Exponential Derivative-free Solvers (VP Data Prediction) stage 2.
|
"""SEEDS-2 - Stochastic Explicit Exponential Derivative-free Solvers (VP Data Prediction) stage 2.
|
||||||
arXiv: https://arxiv.org/abs/2305.14267
|
arXiv: https://arxiv.org/abs/2305.14267 (NeurIPS 2023)
|
||||||
"""
|
"""
|
||||||
extra_args = {} if extra_args is None else extra_args
|
extra_args = {} if extra_args is None else extra_args
|
||||||
seed = extra_args.get("seed", None)
|
seed = extra_args.get("seed", None)
|
||||||
noise_sampler = default_noise_sampler(x, seed=seed) if noise_sampler is None else noise_sampler
|
noise_sampler = default_noise_sampler(x, seed=seed) if noise_sampler is None else noise_sampler
|
||||||
s_in = x.new_ones([x.shape[0]])
|
s_in = x.new_ones([x.shape[0]])
|
||||||
|
|
||||||
inject_noise = eta > 0 and s_noise > 0
|
inject_noise = eta > 0 and s_noise > 0
|
||||||
|
|
||||||
model_sampling = model.inner_model.model_patcher.get_model_object('model_sampling')
|
model_sampling = model.inner_model.model_patcher.get_model_object('model_sampling')
|
||||||
@ -1564,55 +1573,53 @@ def sample_seeds_2(model, x, sigmas, extra_args=None, callback=None, disable=Non
|
|||||||
lambda_fn = partial(sigma_to_half_log_snr, model_sampling=model_sampling)
|
lambda_fn = partial(sigma_to_half_log_snr, model_sampling=model_sampling)
|
||||||
sigmas = offset_first_sigma_for_snr(sigmas, model_sampling)
|
sigmas = offset_first_sigma_for_snr(sigmas, model_sampling)
|
||||||
|
|
||||||
|
fac = 1 / (2 * r)
|
||||||
|
|
||||||
for i in trange(len(sigmas) - 1, disable=disable):
|
for i in trange(len(sigmas) - 1, disable=disable):
|
||||||
denoised = model(x, sigmas[i] * s_in, **extra_args)
|
denoised = model(x, sigmas[i] * s_in, **extra_args)
|
||||||
if callback is not None:
|
if callback is not None:
|
||||||
callback({'x': x, 'i': i, 'sigma': sigmas[i], 'sigma_hat': sigmas[i], 'denoised': denoised})
|
callback({'x': x, 'i': i, 'sigma': sigmas[i], 'sigma_hat': sigmas[i], 'denoised': denoised})
|
||||||
|
|
||||||
if sigmas[i + 1] == 0:
|
if sigmas[i + 1] == 0:
|
||||||
x = denoised
|
x = denoised
|
||||||
else:
|
continue
|
||||||
lambda_s, lambda_t = lambda_fn(sigmas[i]), lambda_fn(sigmas[i + 1])
|
|
||||||
h = lambda_t - lambda_s
|
|
||||||
h_eta = h * (eta + 1)
|
|
||||||
lambda_s_1 = lambda_s + r * h
|
|
||||||
fac = 1 / (2 * r)
|
|
||||||
sigma_s_1 = sigma_fn(lambda_s_1)
|
|
||||||
|
|
||||||
# alpha_t = sigma_t * exp(log(alpha_t / sigma_t)) = sigma_t * exp(lambda_t)
|
lambda_s, lambda_t = lambda_fn(sigmas[i]), lambda_fn(sigmas[i + 1])
|
||||||
alpha_s_1 = sigma_s_1 * lambda_s_1.exp()
|
h = lambda_t - lambda_s
|
||||||
alpha_t = sigmas[i + 1] * lambda_t.exp()
|
h_eta = h * (eta + 1)
|
||||||
|
lambda_s_1 = torch.lerp(lambda_s, lambda_t, r)
|
||||||
|
sigma_s_1 = sigma_fn(lambda_s_1)
|
||||||
|
|
||||||
coeff_1, coeff_2 = (-r * h_eta).expm1(), (-h_eta).expm1()
|
alpha_s_1 = sigma_s_1 * lambda_s_1.exp()
|
||||||
if inject_noise:
|
alpha_t = sigmas[i + 1] * lambda_t.exp()
|
||||||
# 0 < r < 1
|
|
||||||
noise_coeff_1 = (-2 * r * h * eta).expm1().neg().sqrt()
|
|
||||||
noise_coeff_2 = (-r * h * eta).exp() * (-2 * (1 - r) * h * eta).expm1().neg().sqrt()
|
|
||||||
noise_1, noise_2 = noise_sampler(sigmas[i], sigma_s_1), noise_sampler(sigma_s_1, sigmas[i + 1])
|
|
||||||
|
|
||||||
# Step 1
|
# Step 1
|
||||||
x_2 = sigma_s_1 / sigmas[i] * (-r * h * eta).exp() * x - alpha_s_1 * coeff_1 * denoised
|
x_2 = sigma_s_1 / sigmas[i] * (-r * h * eta).exp() * x - alpha_s_1 * ei_h_phi_1(-r * h_eta) * denoised
|
||||||
if inject_noise:
|
if inject_noise:
|
||||||
x_2 = x_2 + sigma_s_1 * (noise_coeff_1 * noise_1) * s_noise
|
sde_noise = (-2 * r * h * eta).expm1().neg().sqrt() * noise_sampler(sigmas[i], sigma_s_1)
|
||||||
denoised_2 = model(x_2, sigma_s_1 * s_in, **extra_args)
|
x_2 = x_2 + sde_noise * sigma_s_1 * s_noise
|
||||||
|
denoised_2 = model(x_2, sigma_s_1 * s_in, **extra_args)
|
||||||
|
|
||||||
# Step 2
|
# Step 2
|
||||||
denoised_d = (1 - fac) * denoised + fac * denoised_2
|
denoised_d = torch.lerp(denoised, denoised_2, fac)
|
||||||
x = sigmas[i + 1] / sigmas[i] * (-h * eta).exp() * x - alpha_t * coeff_2 * denoised_d
|
x = sigmas[i + 1] / sigmas[i] * (-h * eta).exp() * x - alpha_t * ei_h_phi_1(-h_eta) * denoised_d
|
||||||
if inject_noise:
|
if inject_noise:
|
||||||
x = x + sigmas[i + 1] * (noise_coeff_2 * noise_1 + noise_coeff_1 * noise_2) * s_noise
|
segment_factor = (r - 1) * h * eta
|
||||||
|
sde_noise = sde_noise * segment_factor.exp()
|
||||||
|
sde_noise = sde_noise + segment_factor.mul(2).expm1().neg().sqrt() * noise_sampler(sigma_s_1, sigmas[i + 1])
|
||||||
|
x = x + sde_noise * sigmas[i + 1] * s_noise
|
||||||
return x
|
return x
|
||||||
|
|
||||||
|
|
||||||
@torch.no_grad()
|
@torch.no_grad()
|
||||||
def sample_seeds_3(model, x, sigmas, extra_args=None, callback=None, disable=None, eta=1., s_noise=1., noise_sampler=None, r_1=1./3, r_2=2./3):
|
def sample_seeds_3(model, x, sigmas, extra_args=None, callback=None, disable=None, eta=1., s_noise=1., noise_sampler=None, r_1=1./3, r_2=2./3):
|
||||||
"""SEEDS-3 - Stochastic Explicit Exponential Derivative-free Solvers (VP Data Prediction) stage 3.
|
"""SEEDS-3 - Stochastic Explicit Exponential Derivative-free Solvers (VP Data Prediction) stage 3.
|
||||||
arXiv: https://arxiv.org/abs/2305.14267
|
arXiv: https://arxiv.org/abs/2305.14267 (NeurIPS 2023)
|
||||||
"""
|
"""
|
||||||
extra_args = {} if extra_args is None else extra_args
|
extra_args = {} if extra_args is None else extra_args
|
||||||
seed = extra_args.get("seed", None)
|
seed = extra_args.get("seed", None)
|
||||||
noise_sampler = default_noise_sampler(x, seed=seed) if noise_sampler is None else noise_sampler
|
noise_sampler = default_noise_sampler(x, seed=seed) if noise_sampler is None else noise_sampler
|
||||||
s_in = x.new_ones([x.shape[0]])
|
s_in = x.new_ones([x.shape[0]])
|
||||||
|
|
||||||
inject_noise = eta > 0 and s_noise > 0
|
inject_noise = eta > 0 and s_noise > 0
|
||||||
|
|
||||||
model_sampling = model.inner_model.model_patcher.get_model_object('model_sampling')
|
model_sampling = model.inner_model.model_patcher.get_model_object('model_sampling')
|
||||||
@ -1624,45 +1631,49 @@ def sample_seeds_3(model, x, sigmas, extra_args=None, callback=None, disable=Non
|
|||||||
denoised = model(x, sigmas[i] * s_in, **extra_args)
|
denoised = model(x, sigmas[i] * s_in, **extra_args)
|
||||||
if callback is not None:
|
if callback is not None:
|
||||||
callback({'x': x, 'i': i, 'sigma': sigmas[i], 'sigma_hat': sigmas[i], 'denoised': denoised})
|
callback({'x': x, 'i': i, 'sigma': sigmas[i], 'sigma_hat': sigmas[i], 'denoised': denoised})
|
||||||
|
|
||||||
if sigmas[i + 1] == 0:
|
if sigmas[i + 1] == 0:
|
||||||
x = denoised
|
x = denoised
|
||||||
else:
|
continue
|
||||||
lambda_s, lambda_t = lambda_fn(sigmas[i]), lambda_fn(sigmas[i + 1])
|
|
||||||
h = lambda_t - lambda_s
|
|
||||||
h_eta = h * (eta + 1)
|
|
||||||
lambda_s_1 = lambda_s + r_1 * h
|
|
||||||
lambda_s_2 = lambda_s + r_2 * h
|
|
||||||
sigma_s_1, sigma_s_2 = sigma_fn(lambda_s_1), sigma_fn(lambda_s_2)
|
|
||||||
|
|
||||||
# alpha_t = sigma_t * exp(log(alpha_t / sigma_t)) = sigma_t * exp(lambda_t)
|
lambda_s, lambda_t = lambda_fn(sigmas[i]), lambda_fn(sigmas[i + 1])
|
||||||
alpha_s_1 = sigma_s_1 * lambda_s_1.exp()
|
h = lambda_t - lambda_s
|
||||||
alpha_s_2 = sigma_s_2 * lambda_s_2.exp()
|
h_eta = h * (eta + 1)
|
||||||
alpha_t = sigmas[i + 1] * lambda_t.exp()
|
lambda_s_1 = torch.lerp(lambda_s, lambda_t, r_1)
|
||||||
|
lambda_s_2 = torch.lerp(lambda_s, lambda_t, r_2)
|
||||||
|
sigma_s_1, sigma_s_2 = sigma_fn(lambda_s_1), sigma_fn(lambda_s_2)
|
||||||
|
|
||||||
coeff_1, coeff_2, coeff_3 = (-r_1 * h_eta).expm1(), (-r_2 * h_eta).expm1(), (-h_eta).expm1()
|
alpha_s_1 = sigma_s_1 * lambda_s_1.exp()
|
||||||
if inject_noise:
|
alpha_s_2 = sigma_s_2 * lambda_s_2.exp()
|
||||||
# 0 < r_1 < r_2 < 1
|
alpha_t = sigmas[i + 1] * lambda_t.exp()
|
||||||
noise_coeff_1 = (-2 * r_1 * h * eta).expm1().neg().sqrt()
|
|
||||||
noise_coeff_2 = (-r_1 * h * eta).exp() * (-2 * (r_2 - r_1) * h * eta).expm1().neg().sqrt()
|
|
||||||
noise_coeff_3 = (-r_2 * h * eta).exp() * (-2 * (1 - r_2) * h * eta).expm1().neg().sqrt()
|
|
||||||
noise_1, noise_2, noise_3 = noise_sampler(sigmas[i], sigma_s_1), noise_sampler(sigma_s_1, sigma_s_2), noise_sampler(sigma_s_2, sigmas[i + 1])
|
|
||||||
|
|
||||||
# Step 1
|
# Step 1
|
||||||
x_2 = sigma_s_1 / sigmas[i] * (-r_1 * h * eta).exp() * x - alpha_s_1 * coeff_1 * denoised
|
x_2 = sigma_s_1 / sigmas[i] * (-r_1 * h * eta).exp() * x - alpha_s_1 * ei_h_phi_1(-r_1 * h_eta) * denoised
|
||||||
if inject_noise:
|
if inject_noise:
|
||||||
x_2 = x_2 + sigma_s_1 * (noise_coeff_1 * noise_1) * s_noise
|
sde_noise = (-2 * r_1 * h * eta).expm1().neg().sqrt() * noise_sampler(sigmas[i], sigma_s_1)
|
||||||
denoised_2 = model(x_2, sigma_s_1 * s_in, **extra_args)
|
x_2 = x_2 + sde_noise * sigma_s_1 * s_noise
|
||||||
|
denoised_2 = model(x_2, sigma_s_1 * s_in, **extra_args)
|
||||||
|
|
||||||
# Step 2
|
# Step 2
|
||||||
x_3 = sigma_s_2 / sigmas[i] * (-r_2 * h * eta).exp() * x - alpha_s_2 * coeff_2 * denoised + (r_2 / r_1) * alpha_s_2 * (coeff_2 / (r_2 * h_eta) + 1) * (denoised_2 - denoised)
|
a3_2 = r_2 / r_1 * ei_h_phi_2(-r_2 * h_eta)
|
||||||
if inject_noise:
|
a3_1 = ei_h_phi_1(-r_2 * h_eta) - a3_2
|
||||||
x_3 = x_3 + sigma_s_2 * (noise_coeff_2 * noise_1 + noise_coeff_1 * noise_2) * s_noise
|
x_3 = sigma_s_2 / sigmas[i] * (-r_2 * h * eta).exp() * x - alpha_s_2 * (a3_1 * denoised + a3_2 * denoised_2)
|
||||||
denoised_3 = model(x_3, sigma_s_2 * s_in, **extra_args)
|
if inject_noise:
|
||||||
|
segment_factor = (r_1 - r_2) * h * eta
|
||||||
|
sde_noise = sde_noise * segment_factor.exp()
|
||||||
|
sde_noise = sde_noise + segment_factor.mul(2).expm1().neg().sqrt() * noise_sampler(sigma_s_1, sigma_s_2)
|
||||||
|
x_3 = x_3 + sde_noise * sigma_s_2 * s_noise
|
||||||
|
denoised_3 = model(x_3, sigma_s_2 * s_in, **extra_args)
|
||||||
|
|
||||||
# Step 3
|
# Step 3
|
||||||
x = sigmas[i + 1] / sigmas[i] * (-h * eta).exp() * x - alpha_t * coeff_3 * denoised + (1. / r_2) * alpha_t * (coeff_3 / h_eta + 1) * (denoised_3 - denoised)
|
b3 = ei_h_phi_2(-h_eta) / r_2
|
||||||
if inject_noise:
|
b1 = ei_h_phi_1(-h_eta) - b3
|
||||||
x = x + sigmas[i + 1] * (noise_coeff_3 * noise_1 + noise_coeff_2 * noise_2 + noise_coeff_1 * noise_3) * s_noise
|
x = sigmas[i + 1] / sigmas[i] * (-h * eta).exp() * x - alpha_t * (b1 * denoised + b3 * denoised_3)
|
||||||
|
if inject_noise:
|
||||||
|
segment_factor = (r_2 - 1) * h * eta
|
||||||
|
sde_noise = sde_noise * segment_factor.exp()
|
||||||
|
sde_noise = sde_noise + segment_factor.mul(2).expm1().neg().sqrt() * noise_sampler(sigma_s_2, sigmas[i + 1])
|
||||||
|
x = x + sde_noise * sigmas[i + 1] * s_noise
|
||||||
return x
|
return x
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
from inspect import cleandoc
|
from inspect import cleandoc
|
||||||
from comfy.comfy_types.node_typing import IO
|
from typing import Optional
|
||||||
|
from typing_extensions import override
|
||||||
|
|
||||||
|
from comfy_api.latest import ComfyExtension, io as comfy_io
|
||||||
from comfy_api_nodes.apis.stability_api import (
|
from comfy_api_nodes.apis.stability_api import (
|
||||||
StabilityUpscaleConservativeRequest,
|
StabilityUpscaleConservativeRequest,
|
||||||
StabilityUpscaleCreativeRequest,
|
StabilityUpscaleCreativeRequest,
|
||||||
@ -46,87 +49,94 @@ def get_async_dummy_status(x: StabilityResultsGetResponse):
|
|||||||
return StabilityPollStatus.in_progress
|
return StabilityPollStatus.in_progress
|
||||||
|
|
||||||
|
|
||||||
class StabilityStableImageUltraNode:
|
class StabilityStableImageUltraNode(comfy_io.ComfyNode):
|
||||||
"""
|
"""
|
||||||
Generates images synchronously based on prompt and resolution.
|
Generates images synchronously based on prompt and resolution.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
RETURN_TYPES = (IO.IMAGE,)
|
|
||||||
DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value
|
|
||||||
FUNCTION = "api_call"
|
|
||||||
API_NODE = True
|
|
||||||
CATEGORY = "api node/image/Stability AI"
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(s):
|
def define_schema(cls):
|
||||||
return {
|
return comfy_io.Schema(
|
||||||
"required": {
|
node_id="StabilityStableImageUltraNode",
|
||||||
"prompt": (
|
display_name="Stability AI Stable Image Ultra",
|
||||||
IO.STRING,
|
category="api node/image/Stability AI",
|
||||||
{
|
description=cleandoc(cls.__doc__ or ""),
|
||||||
"multiline": True,
|
inputs=[
|
||||||
"default": "",
|
comfy_io.String.Input(
|
||||||
"tooltip": "What you wish to see in the output image. A strong, descriptive prompt that clearly defines" +
|
"prompt",
|
||||||
"What you wish to see in the output image. A strong, descriptive prompt that clearly defines" +
|
multiline=True,
|
||||||
|
default="",
|
||||||
|
tooltip="What you wish to see in the output image. A strong, descriptive prompt that clearly defines" +
|
||||||
"elements, colors, and subjects will lead to better results. " +
|
"elements, colors, and subjects will lead to better results. " +
|
||||||
"To control the weight of a given word use the format `(word:weight)`," +
|
"To control the weight of a given word use the format `(word:weight)`," +
|
||||||
"where `word` is the word you'd like to control the weight of and `weight`" +
|
"where `word` is the word you'd like to control the weight of and `weight`" +
|
||||||
"is a value between 0 and 1. For example: `The sky was a crisp (blue:0.3) and (green:0.8)`" +
|
"is a value between 0 and 1. For example: `The sky was a crisp (blue:0.3) and (green:0.8)`" +
|
||||||
"would convey a sky that was blue and green, but more green than blue."
|
"would convey a sky that was blue and green, but more green than blue.",
|
||||||
},
|
|
||||||
),
|
),
|
||||||
"aspect_ratio": ([x.value for x in StabilityAspectRatio],
|
comfy_io.Combo.Input(
|
||||||
{
|
"aspect_ratio",
|
||||||
"default": StabilityAspectRatio.ratio_1_1,
|
options=[x.value for x in StabilityAspectRatio],
|
||||||
"tooltip": "Aspect ratio of generated image.",
|
default=StabilityAspectRatio.ratio_1_1.value,
|
||||||
},
|
tooltip="Aspect ratio of generated image.",
|
||||||
),
|
),
|
||||||
"style_preset": (get_stability_style_presets(),
|
comfy_io.Combo.Input(
|
||||||
{
|
"style_preset",
|
||||||
"tooltip": "Optional desired style of generated image.",
|
options=get_stability_style_presets(),
|
||||||
},
|
tooltip="Optional desired style of generated image.",
|
||||||
),
|
),
|
||||||
"seed": (
|
comfy_io.Int.Input(
|
||||||
IO.INT,
|
"seed",
|
||||||
{
|
default=0,
|
||||||
"default": 0,
|
min=0,
|
||||||
"min": 0,
|
max=4294967294,
|
||||||
"max": 4294967294,
|
step=1,
|
||||||
"control_after_generate": True,
|
display_mode=comfy_io.NumberDisplay.number,
|
||||||
"tooltip": "The random seed used for creating the noise.",
|
control_after_generate=True,
|
||||||
},
|
tooltip="The random seed used for creating the noise.",
|
||||||
),
|
),
|
||||||
},
|
comfy_io.Image.Input(
|
||||||
"optional": {
|
"image",
|
||||||
"image": (IO.IMAGE,),
|
optional=True,
|
||||||
"negative_prompt": (
|
|
||||||
IO.STRING,
|
|
||||||
{
|
|
||||||
"default": "",
|
|
||||||
"forceInput": True,
|
|
||||||
"tooltip": "A blurb of text describing what you do not wish to see in the output image. This is an advanced feature."
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
"image_denoise": (
|
comfy_io.String.Input(
|
||||||
IO.FLOAT,
|
"negative_prompt",
|
||||||
{
|
default="",
|
||||||
"default": 0.5,
|
tooltip="A blurb of text describing what you do not wish to see in the output image. This is an advanced feature.",
|
||||||
"min": 0.0,
|
force_input=True,
|
||||||
"max": 1.0,
|
optional=True,
|
||||||
"step": 0.01,
|
|
||||||
"tooltip": "Denoise of input image; 0.0 yields image identical to input, 1.0 is as if no image was provided at all.",
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
},
|
comfy_io.Float.Input(
|
||||||
"hidden": {
|
"image_denoise",
|
||||||
"auth_token": "AUTH_TOKEN_COMFY_ORG",
|
default=0.5,
|
||||||
"comfy_api_key": "API_KEY_COMFY_ORG",
|
min=0.0,
|
||||||
},
|
max=1.0,
|
||||||
}
|
step=0.01,
|
||||||
|
tooltip="Denoise of input image; 0.0 yields image identical to input, 1.0 is as if no image was provided at all.",
|
||||||
|
optional=True,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
outputs=[
|
||||||
|
comfy_io.Image.Output(),
|
||||||
|
],
|
||||||
|
hidden=[
|
||||||
|
comfy_io.Hidden.auth_token_comfy_org,
|
||||||
|
comfy_io.Hidden.api_key_comfy_org,
|
||||||
|
comfy_io.Hidden.unique_id,
|
||||||
|
],
|
||||||
|
is_api_node=True,
|
||||||
|
)
|
||||||
|
|
||||||
async def api_call(self, prompt: str, aspect_ratio: str, style_preset: str, seed: int,
|
@classmethod
|
||||||
negative_prompt: str=None, image: torch.Tensor = None, image_denoise: float=None,
|
async def execute(
|
||||||
**kwargs):
|
cls,
|
||||||
|
prompt: str,
|
||||||
|
aspect_ratio: str,
|
||||||
|
style_preset: str,
|
||||||
|
seed: int,
|
||||||
|
image: Optional[torch.Tensor] = None,
|
||||||
|
negative_prompt: str = "",
|
||||||
|
image_denoise: Optional[float] = 0.5,
|
||||||
|
) -> comfy_io.NodeOutput:
|
||||||
validate_string(prompt, strip_whitespace=False)
|
validate_string(prompt, strip_whitespace=False)
|
||||||
# prepare image binary if image present
|
# prepare image binary if image present
|
||||||
image_binary = None
|
image_binary = None
|
||||||
@ -144,6 +154,11 @@ class StabilityStableImageUltraNode:
|
|||||||
"image": image_binary
|
"image": image_binary
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auth = {
|
||||||
|
"auth_token": cls.hidden.auth_token_comfy_org,
|
||||||
|
"comfy_api_key": cls.hidden.api_key_comfy_org,
|
||||||
|
}
|
||||||
|
|
||||||
operation = SynchronousOperation(
|
operation = SynchronousOperation(
|
||||||
endpoint=ApiEndpoint(
|
endpoint=ApiEndpoint(
|
||||||
path="/proxy/stability/v2beta/stable-image/generate/ultra",
|
path="/proxy/stability/v2beta/stable-image/generate/ultra",
|
||||||
@ -161,7 +176,7 @@ class StabilityStableImageUltraNode:
|
|||||||
),
|
),
|
||||||
files=files,
|
files=files,
|
||||||
content_type="multipart/form-data",
|
content_type="multipart/form-data",
|
||||||
auth_kwargs=kwargs,
|
auth_kwargs=auth,
|
||||||
)
|
)
|
||||||
response_api = await operation.execute()
|
response_api = await operation.execute()
|
||||||
|
|
||||||
@ -171,95 +186,106 @@ class StabilityStableImageUltraNode:
|
|||||||
image_data = base64.b64decode(response_api.image)
|
image_data = base64.b64decode(response_api.image)
|
||||||
returned_image = bytesio_to_image_tensor(BytesIO(image_data))
|
returned_image = bytesio_to_image_tensor(BytesIO(image_data))
|
||||||
|
|
||||||
return (returned_image,)
|
return comfy_io.NodeOutput(returned_image)
|
||||||
|
|
||||||
|
|
||||||
class StabilityStableImageSD_3_5Node:
|
class StabilityStableImageSD_3_5Node(comfy_io.ComfyNode):
|
||||||
"""
|
"""
|
||||||
Generates images synchronously based on prompt and resolution.
|
Generates images synchronously based on prompt and resolution.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
RETURN_TYPES = (IO.IMAGE,)
|
@classmethod
|
||||||
DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value
|
def define_schema(cls):
|
||||||
FUNCTION = "api_call"
|
return comfy_io.Schema(
|
||||||
API_NODE = True
|
node_id="StabilityStableImageSD_3_5Node",
|
||||||
CATEGORY = "api node/image/Stability AI"
|
display_name="Stability AI Stable Diffusion 3.5 Image",
|
||||||
|
category="api node/image/Stability AI",
|
||||||
|
description=cleandoc(cls.__doc__ or ""),
|
||||||
|
inputs=[
|
||||||
|
comfy_io.String.Input(
|
||||||
|
"prompt",
|
||||||
|
multiline=True,
|
||||||
|
default="",
|
||||||
|
tooltip="What you wish to see in the output image. A strong, descriptive prompt that clearly defines elements, colors, and subjects will lead to better results.",
|
||||||
|
),
|
||||||
|
comfy_io.Combo.Input(
|
||||||
|
"model",
|
||||||
|
options=[x.value for x in Stability_SD3_5_Model],
|
||||||
|
),
|
||||||
|
comfy_io.Combo.Input(
|
||||||
|
"aspect_ratio",
|
||||||
|
options=[x.value for x in StabilityAspectRatio],
|
||||||
|
default=StabilityAspectRatio.ratio_1_1.value,
|
||||||
|
tooltip="Aspect ratio of generated image.",
|
||||||
|
),
|
||||||
|
comfy_io.Combo.Input(
|
||||||
|
"style_preset",
|
||||||
|
options=get_stability_style_presets(),
|
||||||
|
tooltip="Optional desired style of generated image.",
|
||||||
|
),
|
||||||
|
comfy_io.Float.Input(
|
||||||
|
"cfg_scale",
|
||||||
|
default=4.0,
|
||||||
|
min=1.0,
|
||||||
|
max=10.0,
|
||||||
|
step=0.1,
|
||||||
|
tooltip="How strictly the diffusion process adheres to the prompt text (higher values keep your image closer to your prompt)",
|
||||||
|
),
|
||||||
|
comfy_io.Int.Input(
|
||||||
|
"seed",
|
||||||
|
default=0,
|
||||||
|
min=0,
|
||||||
|
max=4294967294,
|
||||||
|
step=1,
|
||||||
|
display_mode=comfy_io.NumberDisplay.number,
|
||||||
|
control_after_generate=True,
|
||||||
|
tooltip="The random seed used for creating the noise.",
|
||||||
|
),
|
||||||
|
comfy_io.Image.Input(
|
||||||
|
"image",
|
||||||
|
optional=True,
|
||||||
|
),
|
||||||
|
comfy_io.String.Input(
|
||||||
|
"negative_prompt",
|
||||||
|
default="",
|
||||||
|
tooltip="Keywords of what you do not wish to see in the output image. This is an advanced feature.",
|
||||||
|
force_input=True,
|
||||||
|
optional=True,
|
||||||
|
),
|
||||||
|
comfy_io.Float.Input(
|
||||||
|
"image_denoise",
|
||||||
|
default=0.5,
|
||||||
|
min=0.0,
|
||||||
|
max=1.0,
|
||||||
|
step=0.01,
|
||||||
|
tooltip="Denoise of input image; 0.0 yields image identical to input, 1.0 is as if no image was provided at all.",
|
||||||
|
optional=True,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
outputs=[
|
||||||
|
comfy_io.Image.Output(),
|
||||||
|
],
|
||||||
|
hidden=[
|
||||||
|
comfy_io.Hidden.auth_token_comfy_org,
|
||||||
|
comfy_io.Hidden.api_key_comfy_org,
|
||||||
|
comfy_io.Hidden.unique_id,
|
||||||
|
],
|
||||||
|
is_api_node=True,
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(s):
|
async def execute(
|
||||||
return {
|
cls,
|
||||||
"required": {
|
model: str,
|
||||||
"prompt": (
|
prompt: str,
|
||||||
IO.STRING,
|
aspect_ratio: str,
|
||||||
{
|
style_preset: str,
|
||||||
"multiline": True,
|
seed: int,
|
||||||
"default": "",
|
cfg_scale: float,
|
||||||
"tooltip": "What you wish to see in the output image. A strong, descriptive prompt that clearly defines elements, colors, and subjects will lead to better results."
|
image: Optional[torch.Tensor] = None,
|
||||||
},
|
negative_prompt: str = "",
|
||||||
),
|
image_denoise: Optional[float] = 0.5,
|
||||||
"model": ([x.value for x in Stability_SD3_5_Model],),
|
) -> comfy_io.NodeOutput:
|
||||||
"aspect_ratio": ([x.value for x in StabilityAspectRatio],
|
|
||||||
{
|
|
||||||
"default": StabilityAspectRatio.ratio_1_1,
|
|
||||||
"tooltip": "Aspect ratio of generated image.",
|
|
||||||
},
|
|
||||||
),
|
|
||||||
"style_preset": (get_stability_style_presets(),
|
|
||||||
{
|
|
||||||
"tooltip": "Optional desired style of generated image.",
|
|
||||||
},
|
|
||||||
),
|
|
||||||
"cfg_scale": (
|
|
||||||
IO.FLOAT,
|
|
||||||
{
|
|
||||||
"default": 4.0,
|
|
||||||
"min": 1.0,
|
|
||||||
"max": 10.0,
|
|
||||||
"step": 0.1,
|
|
||||||
"tooltip": "How strictly the diffusion process adheres to the prompt text (higher values keep your image closer to your prompt)",
|
|
||||||
},
|
|
||||||
),
|
|
||||||
"seed": (
|
|
||||||
IO.INT,
|
|
||||||
{
|
|
||||||
"default": 0,
|
|
||||||
"min": 0,
|
|
||||||
"max": 4294967294,
|
|
||||||
"control_after_generate": True,
|
|
||||||
"tooltip": "The random seed used for creating the noise.",
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
"optional": {
|
|
||||||
"image": (IO.IMAGE,),
|
|
||||||
"negative_prompt": (
|
|
||||||
IO.STRING,
|
|
||||||
{
|
|
||||||
"default": "",
|
|
||||||
"forceInput": True,
|
|
||||||
"tooltip": "Keywords of what you do not wish to see in the output image. This is an advanced feature."
|
|
||||||
},
|
|
||||||
),
|
|
||||||
"image_denoise": (
|
|
||||||
IO.FLOAT,
|
|
||||||
{
|
|
||||||
"default": 0.5,
|
|
||||||
"min": 0.0,
|
|
||||||
"max": 1.0,
|
|
||||||
"step": 0.01,
|
|
||||||
"tooltip": "Denoise of input image; 0.0 yields image identical to input, 1.0 is as if no image was provided at all.",
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
"hidden": {
|
|
||||||
"auth_token": "AUTH_TOKEN_COMFY_ORG",
|
|
||||||
"comfy_api_key": "API_KEY_COMFY_ORG",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
async def api_call(self, model: str, prompt: str, aspect_ratio: str, style_preset: str, seed: int, cfg_scale: float,
|
|
||||||
negative_prompt: str=None, image: torch.Tensor = None, image_denoise: float=None,
|
|
||||||
**kwargs):
|
|
||||||
validate_string(prompt, strip_whitespace=False)
|
validate_string(prompt, strip_whitespace=False)
|
||||||
# prepare image binary if image present
|
# prepare image binary if image present
|
||||||
image_binary = None
|
image_binary = None
|
||||||
@ -280,6 +306,11 @@ class StabilityStableImageSD_3_5Node:
|
|||||||
"image": image_binary
|
"image": image_binary
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auth = {
|
||||||
|
"auth_token": cls.hidden.auth_token_comfy_org,
|
||||||
|
"comfy_api_key": cls.hidden.api_key_comfy_org,
|
||||||
|
}
|
||||||
|
|
||||||
operation = SynchronousOperation(
|
operation = SynchronousOperation(
|
||||||
endpoint=ApiEndpoint(
|
endpoint=ApiEndpoint(
|
||||||
path="/proxy/stability/v2beta/stable-image/generate/sd3",
|
path="/proxy/stability/v2beta/stable-image/generate/sd3",
|
||||||
@ -300,7 +331,7 @@ class StabilityStableImageSD_3_5Node:
|
|||||||
),
|
),
|
||||||
files=files,
|
files=files,
|
||||||
content_type="multipart/form-data",
|
content_type="multipart/form-data",
|
||||||
auth_kwargs=kwargs,
|
auth_kwargs=auth,
|
||||||
)
|
)
|
||||||
response_api = await operation.execute()
|
response_api = await operation.execute()
|
||||||
|
|
||||||
@ -310,72 +341,75 @@ class StabilityStableImageSD_3_5Node:
|
|||||||
image_data = base64.b64decode(response_api.image)
|
image_data = base64.b64decode(response_api.image)
|
||||||
returned_image = bytesio_to_image_tensor(BytesIO(image_data))
|
returned_image = bytesio_to_image_tensor(BytesIO(image_data))
|
||||||
|
|
||||||
return (returned_image,)
|
return comfy_io.NodeOutput(returned_image)
|
||||||
|
|
||||||
|
|
||||||
class StabilityUpscaleConservativeNode:
|
class StabilityUpscaleConservativeNode(comfy_io.ComfyNode):
|
||||||
"""
|
"""
|
||||||
Upscale image with minimal alterations to 4K resolution.
|
Upscale image with minimal alterations to 4K resolution.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
RETURN_TYPES = (IO.IMAGE,)
|
@classmethod
|
||||||
DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value
|
def define_schema(cls):
|
||||||
FUNCTION = "api_call"
|
return comfy_io.Schema(
|
||||||
API_NODE = True
|
node_id="StabilityUpscaleConservativeNode",
|
||||||
CATEGORY = "api node/image/Stability AI"
|
display_name="Stability AI Upscale Conservative",
|
||||||
|
category="api node/image/Stability AI",
|
||||||
|
description=cleandoc(cls.__doc__ or ""),
|
||||||
|
inputs=[
|
||||||
|
comfy_io.Image.Input("image"),
|
||||||
|
comfy_io.String.Input(
|
||||||
|
"prompt",
|
||||||
|
multiline=True,
|
||||||
|
default="",
|
||||||
|
tooltip="What you wish to see in the output image. A strong, descriptive prompt that clearly defines elements, colors, and subjects will lead to better results.",
|
||||||
|
),
|
||||||
|
comfy_io.Float.Input(
|
||||||
|
"creativity",
|
||||||
|
default=0.35,
|
||||||
|
min=0.2,
|
||||||
|
max=0.5,
|
||||||
|
step=0.01,
|
||||||
|
tooltip="Controls the likelihood of creating additional details not heavily conditioned by the init image.",
|
||||||
|
),
|
||||||
|
comfy_io.Int.Input(
|
||||||
|
"seed",
|
||||||
|
default=0,
|
||||||
|
min=0,
|
||||||
|
max=4294967294,
|
||||||
|
step=1,
|
||||||
|
display_mode=comfy_io.NumberDisplay.number,
|
||||||
|
control_after_generate=True,
|
||||||
|
tooltip="The random seed used for creating the noise.",
|
||||||
|
),
|
||||||
|
comfy_io.String.Input(
|
||||||
|
"negative_prompt",
|
||||||
|
default="",
|
||||||
|
tooltip="Keywords of what you do not wish to see in the output image. This is an advanced feature.",
|
||||||
|
force_input=True,
|
||||||
|
optional=True,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
outputs=[
|
||||||
|
comfy_io.Image.Output(),
|
||||||
|
],
|
||||||
|
hidden=[
|
||||||
|
comfy_io.Hidden.auth_token_comfy_org,
|
||||||
|
comfy_io.Hidden.api_key_comfy_org,
|
||||||
|
comfy_io.Hidden.unique_id,
|
||||||
|
],
|
||||||
|
is_api_node=True,
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(s):
|
async def execute(
|
||||||
return {
|
cls,
|
||||||
"required": {
|
image: torch.Tensor,
|
||||||
"image": (IO.IMAGE,),
|
prompt: str,
|
||||||
"prompt": (
|
creativity: float,
|
||||||
IO.STRING,
|
seed: int,
|
||||||
{
|
negative_prompt: str = "",
|
||||||
"multiline": True,
|
) -> comfy_io.NodeOutput:
|
||||||
"default": "",
|
|
||||||
"tooltip": "What you wish to see in the output image. A strong, descriptive prompt that clearly defines elements, colors, and subjects will lead to better results."
|
|
||||||
},
|
|
||||||
),
|
|
||||||
"creativity": (
|
|
||||||
IO.FLOAT,
|
|
||||||
{
|
|
||||||
"default": 0.35,
|
|
||||||
"min": 0.2,
|
|
||||||
"max": 0.5,
|
|
||||||
"step": 0.01,
|
|
||||||
"tooltip": "Controls the likelihood of creating additional details not heavily conditioned by the init image.",
|
|
||||||
},
|
|
||||||
),
|
|
||||||
"seed": (
|
|
||||||
IO.INT,
|
|
||||||
{
|
|
||||||
"default": 0,
|
|
||||||
"min": 0,
|
|
||||||
"max": 4294967294,
|
|
||||||
"control_after_generate": True,
|
|
||||||
"tooltip": "The random seed used for creating the noise.",
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
"optional": {
|
|
||||||
"negative_prompt": (
|
|
||||||
IO.STRING,
|
|
||||||
{
|
|
||||||
"default": "",
|
|
||||||
"forceInput": True,
|
|
||||||
"tooltip": "Keywords of what you do not wish to see in the output image. This is an advanced feature."
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
"hidden": {
|
|
||||||
"auth_token": "AUTH_TOKEN_COMFY_ORG",
|
|
||||||
"comfy_api_key": "API_KEY_COMFY_ORG",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
async def api_call(self, image: torch.Tensor, prompt: str, creativity: float, seed: int, negative_prompt: str=None,
|
|
||||||
**kwargs):
|
|
||||||
validate_string(prompt, strip_whitespace=False)
|
validate_string(prompt, strip_whitespace=False)
|
||||||
image_binary = tensor_to_bytesio(image, total_pixels=1024*1024).read()
|
image_binary = tensor_to_bytesio(image, total_pixels=1024*1024).read()
|
||||||
|
|
||||||
@ -386,6 +420,11 @@ class StabilityUpscaleConservativeNode:
|
|||||||
"image": image_binary
|
"image": image_binary
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auth = {
|
||||||
|
"auth_token": cls.hidden.auth_token_comfy_org,
|
||||||
|
"comfy_api_key": cls.hidden.api_key_comfy_org,
|
||||||
|
}
|
||||||
|
|
||||||
operation = SynchronousOperation(
|
operation = SynchronousOperation(
|
||||||
endpoint=ApiEndpoint(
|
endpoint=ApiEndpoint(
|
||||||
path="/proxy/stability/v2beta/stable-image/upscale/conservative",
|
path="/proxy/stability/v2beta/stable-image/upscale/conservative",
|
||||||
@ -401,7 +440,7 @@ class StabilityUpscaleConservativeNode:
|
|||||||
),
|
),
|
||||||
files=files,
|
files=files,
|
||||||
content_type="multipart/form-data",
|
content_type="multipart/form-data",
|
||||||
auth_kwargs=kwargs,
|
auth_kwargs=auth,
|
||||||
)
|
)
|
||||||
response_api = await operation.execute()
|
response_api = await operation.execute()
|
||||||
|
|
||||||
@ -411,77 +450,81 @@ class StabilityUpscaleConservativeNode:
|
|||||||
image_data = base64.b64decode(response_api.image)
|
image_data = base64.b64decode(response_api.image)
|
||||||
returned_image = bytesio_to_image_tensor(BytesIO(image_data))
|
returned_image = bytesio_to_image_tensor(BytesIO(image_data))
|
||||||
|
|
||||||
return (returned_image,)
|
return comfy_io.NodeOutput(returned_image)
|
||||||
|
|
||||||
|
|
||||||
class StabilityUpscaleCreativeNode:
|
class StabilityUpscaleCreativeNode(comfy_io.ComfyNode):
|
||||||
"""
|
"""
|
||||||
Upscale image with minimal alterations to 4K resolution.
|
Upscale image with minimal alterations to 4K resolution.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
RETURN_TYPES = (IO.IMAGE,)
|
@classmethod
|
||||||
DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value
|
def define_schema(cls):
|
||||||
FUNCTION = "api_call"
|
return comfy_io.Schema(
|
||||||
API_NODE = True
|
node_id="StabilityUpscaleCreativeNode",
|
||||||
CATEGORY = "api node/image/Stability AI"
|
display_name="Stability AI Upscale Creative",
|
||||||
|
category="api node/image/Stability AI",
|
||||||
|
description=cleandoc(cls.__doc__ or ""),
|
||||||
|
inputs=[
|
||||||
|
comfy_io.Image.Input("image"),
|
||||||
|
comfy_io.String.Input(
|
||||||
|
"prompt",
|
||||||
|
multiline=True,
|
||||||
|
default="",
|
||||||
|
tooltip="What you wish to see in the output image. A strong, descriptive prompt that clearly defines elements, colors, and subjects will lead to better results.",
|
||||||
|
),
|
||||||
|
comfy_io.Float.Input(
|
||||||
|
"creativity",
|
||||||
|
default=0.3,
|
||||||
|
min=0.1,
|
||||||
|
max=0.5,
|
||||||
|
step=0.01,
|
||||||
|
tooltip="Controls the likelihood of creating additional details not heavily conditioned by the init image.",
|
||||||
|
),
|
||||||
|
comfy_io.Combo.Input(
|
||||||
|
"style_preset",
|
||||||
|
options=get_stability_style_presets(),
|
||||||
|
tooltip="Optional desired style of generated image.",
|
||||||
|
),
|
||||||
|
comfy_io.Int.Input(
|
||||||
|
"seed",
|
||||||
|
default=0,
|
||||||
|
min=0,
|
||||||
|
max=4294967294,
|
||||||
|
step=1,
|
||||||
|
display_mode=comfy_io.NumberDisplay.number,
|
||||||
|
control_after_generate=True,
|
||||||
|
tooltip="The random seed used for creating the noise.",
|
||||||
|
),
|
||||||
|
comfy_io.String.Input(
|
||||||
|
"negative_prompt",
|
||||||
|
default="",
|
||||||
|
tooltip="Keywords of what you do not wish to see in the output image. This is an advanced feature.",
|
||||||
|
force_input=True,
|
||||||
|
optional=True,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
outputs=[
|
||||||
|
comfy_io.Image.Output(),
|
||||||
|
],
|
||||||
|
hidden=[
|
||||||
|
comfy_io.Hidden.auth_token_comfy_org,
|
||||||
|
comfy_io.Hidden.api_key_comfy_org,
|
||||||
|
comfy_io.Hidden.unique_id,
|
||||||
|
],
|
||||||
|
is_api_node=True,
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(s):
|
async def execute(
|
||||||
return {
|
cls,
|
||||||
"required": {
|
image: torch.Tensor,
|
||||||
"image": (IO.IMAGE,),
|
prompt: str,
|
||||||
"prompt": (
|
creativity: float,
|
||||||
IO.STRING,
|
style_preset: str,
|
||||||
{
|
seed: int,
|
||||||
"multiline": True,
|
negative_prompt: str = "",
|
||||||
"default": "",
|
) -> comfy_io.NodeOutput:
|
||||||
"tooltip": "What you wish to see in the output image. A strong, descriptive prompt that clearly defines elements, colors, and subjects will lead to better results."
|
|
||||||
},
|
|
||||||
),
|
|
||||||
"creativity": (
|
|
||||||
IO.FLOAT,
|
|
||||||
{
|
|
||||||
"default": 0.3,
|
|
||||||
"min": 0.1,
|
|
||||||
"max": 0.5,
|
|
||||||
"step": 0.01,
|
|
||||||
"tooltip": "Controls the likelihood of creating additional details not heavily conditioned by the init image.",
|
|
||||||
},
|
|
||||||
),
|
|
||||||
"style_preset": (get_stability_style_presets(),
|
|
||||||
{
|
|
||||||
"tooltip": "Optional desired style of generated image.",
|
|
||||||
},
|
|
||||||
),
|
|
||||||
"seed": (
|
|
||||||
IO.INT,
|
|
||||||
{
|
|
||||||
"default": 0,
|
|
||||||
"min": 0,
|
|
||||||
"max": 4294967294,
|
|
||||||
"control_after_generate": True,
|
|
||||||
"tooltip": "The random seed used for creating the noise.",
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
"optional": {
|
|
||||||
"negative_prompt": (
|
|
||||||
IO.STRING,
|
|
||||||
{
|
|
||||||
"default": "",
|
|
||||||
"forceInput": True,
|
|
||||||
"tooltip": "Keywords of what you do not wish to see in the output image. This is an advanced feature."
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
"hidden": {
|
|
||||||
"auth_token": "AUTH_TOKEN_COMFY_ORG",
|
|
||||||
"comfy_api_key": "API_KEY_COMFY_ORG",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
async def api_call(self, image: torch.Tensor, prompt: str, creativity: float, style_preset: str, seed: int, negative_prompt: str=None,
|
|
||||||
**kwargs):
|
|
||||||
validate_string(prompt, strip_whitespace=False)
|
validate_string(prompt, strip_whitespace=False)
|
||||||
image_binary = tensor_to_bytesio(image, total_pixels=1024*1024).read()
|
image_binary = tensor_to_bytesio(image, total_pixels=1024*1024).read()
|
||||||
|
|
||||||
@ -494,6 +537,11 @@ class StabilityUpscaleCreativeNode:
|
|||||||
"image": image_binary
|
"image": image_binary
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auth = {
|
||||||
|
"auth_token": cls.hidden.auth_token_comfy_org,
|
||||||
|
"comfy_api_key": cls.hidden.api_key_comfy_org,
|
||||||
|
}
|
||||||
|
|
||||||
operation = SynchronousOperation(
|
operation = SynchronousOperation(
|
||||||
endpoint=ApiEndpoint(
|
endpoint=ApiEndpoint(
|
||||||
path="/proxy/stability/v2beta/stable-image/upscale/creative",
|
path="/proxy/stability/v2beta/stable-image/upscale/creative",
|
||||||
@ -510,7 +558,7 @@ class StabilityUpscaleCreativeNode:
|
|||||||
),
|
),
|
||||||
files=files,
|
files=files,
|
||||||
content_type="multipart/form-data",
|
content_type="multipart/form-data",
|
||||||
auth_kwargs=kwargs,
|
auth_kwargs=auth,
|
||||||
)
|
)
|
||||||
response_api = await operation.execute()
|
response_api = await operation.execute()
|
||||||
|
|
||||||
@ -525,7 +573,8 @@ class StabilityUpscaleCreativeNode:
|
|||||||
completed_statuses=[StabilityPollStatus.finished],
|
completed_statuses=[StabilityPollStatus.finished],
|
||||||
failed_statuses=[StabilityPollStatus.failed],
|
failed_statuses=[StabilityPollStatus.failed],
|
||||||
status_extractor=lambda x: get_async_dummy_status(x),
|
status_extractor=lambda x: get_async_dummy_status(x),
|
||||||
auth_kwargs=kwargs,
|
auth_kwargs=auth,
|
||||||
|
node_id=cls.hidden.unique_id,
|
||||||
)
|
)
|
||||||
response_poll: StabilityResultsGetResponse = await operation.execute()
|
response_poll: StabilityResultsGetResponse = await operation.execute()
|
||||||
|
|
||||||
@ -535,41 +584,48 @@ class StabilityUpscaleCreativeNode:
|
|||||||
image_data = base64.b64decode(response_poll.result)
|
image_data = base64.b64decode(response_poll.result)
|
||||||
returned_image = bytesio_to_image_tensor(BytesIO(image_data))
|
returned_image = bytesio_to_image_tensor(BytesIO(image_data))
|
||||||
|
|
||||||
return (returned_image,)
|
return comfy_io.NodeOutput(returned_image)
|
||||||
|
|
||||||
|
|
||||||
class StabilityUpscaleFastNode:
|
class StabilityUpscaleFastNode(comfy_io.ComfyNode):
|
||||||
"""
|
"""
|
||||||
Quickly upscales an image via Stability API call to 4x its original size; intended for upscaling low-quality/compressed images.
|
Quickly upscales an image via Stability API call to 4x its original size; intended for upscaling low-quality/compressed images.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
RETURN_TYPES = (IO.IMAGE,)
|
@classmethod
|
||||||
DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value
|
def define_schema(cls):
|
||||||
FUNCTION = "api_call"
|
return comfy_io.Schema(
|
||||||
API_NODE = True
|
node_id="StabilityUpscaleFastNode",
|
||||||
CATEGORY = "api node/image/Stability AI"
|
display_name="Stability AI Upscale Fast",
|
||||||
|
category="api node/image/Stability AI",
|
||||||
|
description=cleandoc(cls.__doc__ or ""),
|
||||||
|
inputs=[
|
||||||
|
comfy_io.Image.Input("image"),
|
||||||
|
],
|
||||||
|
outputs=[
|
||||||
|
comfy_io.Image.Output(),
|
||||||
|
],
|
||||||
|
hidden=[
|
||||||
|
comfy_io.Hidden.auth_token_comfy_org,
|
||||||
|
comfy_io.Hidden.api_key_comfy_org,
|
||||||
|
comfy_io.Hidden.unique_id,
|
||||||
|
],
|
||||||
|
is_api_node=True,
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(s):
|
async def execute(cls, image: torch.Tensor) -> comfy_io.NodeOutput:
|
||||||
return {
|
|
||||||
"required": {
|
|
||||||
"image": (IO.IMAGE,),
|
|
||||||
},
|
|
||||||
"optional": {
|
|
||||||
},
|
|
||||||
"hidden": {
|
|
||||||
"auth_token": "AUTH_TOKEN_COMFY_ORG",
|
|
||||||
"comfy_api_key": "API_KEY_COMFY_ORG",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
async def api_call(self, image: torch.Tensor, **kwargs):
|
|
||||||
image_binary = tensor_to_bytesio(image, total_pixels=4096*4096).read()
|
image_binary = tensor_to_bytesio(image, total_pixels=4096*4096).read()
|
||||||
|
|
||||||
files = {
|
files = {
|
||||||
"image": image_binary
|
"image": image_binary
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auth = {
|
||||||
|
"auth_token": cls.hidden.auth_token_comfy_org,
|
||||||
|
"comfy_api_key": cls.hidden.api_key_comfy_org,
|
||||||
|
}
|
||||||
|
|
||||||
operation = SynchronousOperation(
|
operation = SynchronousOperation(
|
||||||
endpoint=ApiEndpoint(
|
endpoint=ApiEndpoint(
|
||||||
path="/proxy/stability/v2beta/stable-image/upscale/fast",
|
path="/proxy/stability/v2beta/stable-image/upscale/fast",
|
||||||
@ -580,7 +636,7 @@ class StabilityUpscaleFastNode:
|
|||||||
request=EmptyRequest(),
|
request=EmptyRequest(),
|
||||||
files=files,
|
files=files,
|
||||||
content_type="multipart/form-data",
|
content_type="multipart/form-data",
|
||||||
auth_kwargs=kwargs,
|
auth_kwargs=auth,
|
||||||
)
|
)
|
||||||
response_api = await operation.execute()
|
response_api = await operation.execute()
|
||||||
|
|
||||||
@ -590,24 +646,20 @@ class StabilityUpscaleFastNode:
|
|||||||
image_data = base64.b64decode(response_api.image)
|
image_data = base64.b64decode(response_api.image)
|
||||||
returned_image = bytesio_to_image_tensor(BytesIO(image_data))
|
returned_image = bytesio_to_image_tensor(BytesIO(image_data))
|
||||||
|
|
||||||
return (returned_image,)
|
return comfy_io.NodeOutput(returned_image)
|
||||||
|
|
||||||
|
|
||||||
# A dictionary that contains all nodes you want to export with their names
|
class StabilityExtension(ComfyExtension):
|
||||||
# NOTE: names should be globally unique
|
@override
|
||||||
NODE_CLASS_MAPPINGS = {
|
async def get_node_list(self) -> list[type[comfy_io.ComfyNode]]:
|
||||||
"StabilityStableImageUltraNode": StabilityStableImageUltraNode,
|
return [
|
||||||
"StabilityStableImageSD_3_5Node": StabilityStableImageSD_3_5Node,
|
StabilityStableImageUltraNode,
|
||||||
"StabilityUpscaleConservativeNode": StabilityUpscaleConservativeNode,
|
StabilityStableImageSD_3_5Node,
|
||||||
"StabilityUpscaleCreativeNode": StabilityUpscaleCreativeNode,
|
StabilityUpscaleConservativeNode,
|
||||||
"StabilityUpscaleFastNode": StabilityUpscaleFastNode,
|
StabilityUpscaleCreativeNode,
|
||||||
}
|
StabilityUpscaleFastNode,
|
||||||
|
]
|
||||||
|
|
||||||
# A dictionary that contains the friendly/humanly readable titles for the nodes
|
|
||||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
async def comfy_entrypoint() -> StabilityExtension:
|
||||||
"StabilityStableImageUltraNode": "Stability AI Stable Image Ultra",
|
return StabilityExtension()
|
||||||
"StabilityStableImageSD_3_5Node": "Stability AI Stable Diffusion 3.5 Image",
|
|
||||||
"StabilityUpscaleConservativeNode": "Stability AI Upscale Conservative",
|
|
||||||
"StabilityUpscaleCreativeNode": "Stability AI Upscale Creative",
|
|
||||||
"StabilityUpscaleFastNode": "Stability AI Upscale Fast",
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,98 +1,109 @@
|
|||||||
# Primitive nodes that are evaluated at backend.
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
from typing_extensions import override
|
||||||
|
|
||||||
from comfy.comfy_types.node_typing import ComfyNodeABC, InputTypeDict, IO
|
from comfy_api.latest import ComfyExtension, io
|
||||||
|
|
||||||
|
|
||||||
class String(ComfyNodeABC):
|
class String(io.ComfyNode):
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(cls) -> InputTypeDict:
|
def define_schema(cls):
|
||||||
return {
|
return io.Schema(
|
||||||
"required": {"value": (IO.STRING, {})},
|
node_id="PrimitiveString",
|
||||||
}
|
display_name="String",
|
||||||
|
category="utils/primitive",
|
||||||
|
inputs=[
|
||||||
|
io.String.Input("value"),
|
||||||
|
],
|
||||||
|
outputs=[io.String.Output()],
|
||||||
|
)
|
||||||
|
|
||||||
RETURN_TYPES = (IO.STRING,)
|
|
||||||
FUNCTION = "execute"
|
|
||||||
CATEGORY = "utils/primitive"
|
|
||||||
|
|
||||||
def execute(self, value: str) -> tuple[str]:
|
|
||||||
return (value,)
|
|
||||||
|
|
||||||
|
|
||||||
class StringMultiline(ComfyNodeABC):
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(cls) -> InputTypeDict:
|
def execute(cls, value: str) -> io.NodeOutput:
|
||||||
return {
|
return io.NodeOutput(value)
|
||||||
"required": {"value": (IO.STRING, {"multiline": True,},)},
|
|
||||||
}
|
|
||||||
|
|
||||||
RETURN_TYPES = (IO.STRING,)
|
|
||||||
FUNCTION = "execute"
|
|
||||||
CATEGORY = "utils/primitive"
|
|
||||||
|
|
||||||
def execute(self, value: str) -> tuple[str]:
|
|
||||||
return (value,)
|
|
||||||
|
|
||||||
|
|
||||||
class Int(ComfyNodeABC):
|
class StringMultiline(io.ComfyNode):
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(cls) -> InputTypeDict:
|
def define_schema(cls):
|
||||||
return {
|
return io.Schema(
|
||||||
"required": {"value": (IO.INT, {"min": -sys.maxsize, "max": sys.maxsize, "control_after_generate": True})},
|
node_id="PrimitiveStringMultiline",
|
||||||
}
|
display_name="String (Multiline)",
|
||||||
|
category="utils/primitive",
|
||||||
|
inputs=[
|
||||||
|
io.String.Input("value", multiline=True),
|
||||||
|
],
|
||||||
|
outputs=[io.String.Output()],
|
||||||
|
)
|
||||||
|
|
||||||
RETURN_TYPES = (IO.INT,)
|
|
||||||
FUNCTION = "execute"
|
|
||||||
CATEGORY = "utils/primitive"
|
|
||||||
|
|
||||||
def execute(self, value: int) -> tuple[int]:
|
|
||||||
return (value,)
|
|
||||||
|
|
||||||
|
|
||||||
class Float(ComfyNodeABC):
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(cls) -> InputTypeDict:
|
def execute(cls, value: str) -> io.NodeOutput:
|
||||||
return {
|
return io.NodeOutput(value)
|
||||||
"required": {"value": (IO.FLOAT, {"min": -sys.maxsize, "max": sys.maxsize})},
|
|
||||||
}
|
|
||||||
|
|
||||||
RETURN_TYPES = (IO.FLOAT,)
|
|
||||||
FUNCTION = "execute"
|
|
||||||
CATEGORY = "utils/primitive"
|
|
||||||
|
|
||||||
def execute(self, value: float) -> tuple[float]:
|
|
||||||
return (value,)
|
|
||||||
|
|
||||||
|
|
||||||
class Boolean(ComfyNodeABC):
|
class Int(io.ComfyNode):
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(cls) -> InputTypeDict:
|
def define_schema(cls):
|
||||||
return {
|
return io.Schema(
|
||||||
"required": {"value": (IO.BOOLEAN, {})},
|
node_id="PrimitiveInt",
|
||||||
}
|
display_name="Int",
|
||||||
|
category="utils/primitive",
|
||||||
|
inputs=[
|
||||||
|
io.Int.Input("value", min=-sys.maxsize, max=sys.maxsize, control_after_generate=True),
|
||||||
|
],
|
||||||
|
outputs=[io.Int.Output()],
|
||||||
|
)
|
||||||
|
|
||||||
RETURN_TYPES = (IO.BOOLEAN,)
|
@classmethod
|
||||||
FUNCTION = "execute"
|
def execute(cls, value: int) -> io.NodeOutput:
|
||||||
CATEGORY = "utils/primitive"
|
return io.NodeOutput(value)
|
||||||
|
|
||||||
def execute(self, value: bool) -> tuple[bool]:
|
|
||||||
return (value,)
|
|
||||||
|
|
||||||
|
|
||||||
NODE_CLASS_MAPPINGS = {
|
class Float(io.ComfyNode):
|
||||||
"PrimitiveString": String,
|
@classmethod
|
||||||
"PrimitiveStringMultiline": StringMultiline,
|
def define_schema(cls):
|
||||||
"PrimitiveInt": Int,
|
return io.Schema(
|
||||||
"PrimitiveFloat": Float,
|
node_id="PrimitiveFloat",
|
||||||
"PrimitiveBoolean": Boolean,
|
display_name="Float",
|
||||||
}
|
category="utils/primitive",
|
||||||
|
inputs=[
|
||||||
|
io.Float.Input("value", min=-sys.maxsize, max=sys.maxsize),
|
||||||
|
],
|
||||||
|
outputs=[io.Float.Output()],
|
||||||
|
)
|
||||||
|
|
||||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
@classmethod
|
||||||
"PrimitiveString": "String",
|
def execute(cls, value: float) -> io.NodeOutput:
|
||||||
"PrimitiveStringMultiline": "String (Multiline)",
|
return io.NodeOutput(value)
|
||||||
"PrimitiveInt": "Int",
|
|
||||||
"PrimitiveFloat": "Float",
|
|
||||||
"PrimitiveBoolean": "Boolean",
|
class Boolean(io.ComfyNode):
|
||||||
}
|
@classmethod
|
||||||
|
def define_schema(cls):
|
||||||
|
return io.Schema(
|
||||||
|
node_id="PrimitiveBoolean",
|
||||||
|
display_name="Boolean",
|
||||||
|
category="utils/primitive",
|
||||||
|
inputs=[
|
||||||
|
io.Boolean.Input("value"),
|
||||||
|
],
|
||||||
|
outputs=[io.Boolean.Output()],
|
||||||
|
)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def execute(cls, value: bool) -> io.NodeOutput:
|
||||||
|
return io.NodeOutput(value)
|
||||||
|
|
||||||
|
|
||||||
|
class PrimitivesExtension(ComfyExtension):
|
||||||
|
@override
|
||||||
|
async def get_node_list(self) -> list[type[io.ComfyNode]]:
|
||||||
|
return [
|
||||||
|
String,
|
||||||
|
StringMultiline,
|
||||||
|
Int,
|
||||||
|
Float,
|
||||||
|
Boolean,
|
||||||
|
]
|
||||||
|
|
||||||
|
async def comfy_entrypoint() -> PrimitivesExtension:
|
||||||
|
return PrimitivesExtension()
|
||||||
|
|||||||
@ -17,55 +17,61 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
import nodes
|
from typing_extensions import override
|
||||||
|
|
||||||
import comfy.utils
|
import comfy.utils
|
||||||
|
import nodes
|
||||||
|
from comfy_api.latest import ComfyExtension, io
|
||||||
|
|
||||||
|
|
||||||
class StableCascade_EmptyLatentImage:
|
class StableCascade_EmptyLatentImage(io.ComfyNode):
|
||||||
def __init__(self, device="cpu"):
|
@classmethod
|
||||||
self.device = device
|
def define_schema(cls):
|
||||||
|
return io.Schema(
|
||||||
|
node_id="StableCascade_EmptyLatentImage",
|
||||||
|
category="latent/stable_cascade",
|
||||||
|
inputs=[
|
||||||
|
io.Int.Input("width", default=1024, min=256, max=nodes.MAX_RESOLUTION, step=8),
|
||||||
|
io.Int.Input("height", default=1024, min=256, max=nodes.MAX_RESOLUTION, step=8),
|
||||||
|
io.Int.Input("compression", default=42, min=4, max=128, step=1),
|
||||||
|
io.Int.Input("batch_size", default=1, min=1, max=4096),
|
||||||
|
],
|
||||||
|
outputs=[
|
||||||
|
io.Latent.Output(display_name="stage_c"),
|
||||||
|
io.Latent.Output(display_name="stage_b"),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(s):
|
def execute(cls, width, height, compression, batch_size=1):
|
||||||
return {"required": {
|
|
||||||
"width": ("INT", {"default": 1024, "min": 256, "max": nodes.MAX_RESOLUTION, "step": 8}),
|
|
||||||
"height": ("INT", {"default": 1024, "min": 256, "max": nodes.MAX_RESOLUTION, "step": 8}),
|
|
||||||
"compression": ("INT", {"default": 42, "min": 4, "max": 128, "step": 1}),
|
|
||||||
"batch_size": ("INT", {"default": 1, "min": 1, "max": 4096})
|
|
||||||
}}
|
|
||||||
RETURN_TYPES = ("LATENT", "LATENT")
|
|
||||||
RETURN_NAMES = ("stage_c", "stage_b")
|
|
||||||
FUNCTION = "generate"
|
|
||||||
|
|
||||||
CATEGORY = "latent/stable_cascade"
|
|
||||||
|
|
||||||
def generate(self, width, height, compression, batch_size=1):
|
|
||||||
c_latent = torch.zeros([batch_size, 16, height // compression, width // compression])
|
c_latent = torch.zeros([batch_size, 16, height // compression, width // compression])
|
||||||
b_latent = torch.zeros([batch_size, 4, height // 4, width // 4])
|
b_latent = torch.zeros([batch_size, 4, height // 4, width // 4])
|
||||||
return ({
|
return io.NodeOutput({
|
||||||
"samples": c_latent,
|
"samples": c_latent,
|
||||||
}, {
|
}, {
|
||||||
"samples": b_latent,
|
"samples": b_latent,
|
||||||
})
|
})
|
||||||
|
|
||||||
class StableCascade_StageC_VAEEncode:
|
|
||||||
def __init__(self, device="cpu"):
|
class StableCascade_StageC_VAEEncode(io.ComfyNode):
|
||||||
self.device = device
|
@classmethod
|
||||||
|
def define_schema(cls):
|
||||||
|
return io.Schema(
|
||||||
|
node_id="StableCascade_StageC_VAEEncode",
|
||||||
|
category="latent/stable_cascade",
|
||||||
|
inputs=[
|
||||||
|
io.Image.Input("image"),
|
||||||
|
io.Vae.Input("vae"),
|
||||||
|
io.Int.Input("compression", default=42, min=4, max=128, step=1),
|
||||||
|
],
|
||||||
|
outputs=[
|
||||||
|
io.Latent.Output(display_name="stage_c"),
|
||||||
|
io.Latent.Output(display_name="stage_b"),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(s):
|
def execute(cls, image, vae, compression):
|
||||||
return {"required": {
|
|
||||||
"image": ("IMAGE",),
|
|
||||||
"vae": ("VAE", ),
|
|
||||||
"compression": ("INT", {"default": 42, "min": 4, "max": 128, "step": 1}),
|
|
||||||
}}
|
|
||||||
RETURN_TYPES = ("LATENT", "LATENT")
|
|
||||||
RETURN_NAMES = ("stage_c", "stage_b")
|
|
||||||
FUNCTION = "generate"
|
|
||||||
|
|
||||||
CATEGORY = "latent/stable_cascade"
|
|
||||||
|
|
||||||
def generate(self, image, vae, compression):
|
|
||||||
width = image.shape[-2]
|
width = image.shape[-2]
|
||||||
height = image.shape[-3]
|
height = image.shape[-3]
|
||||||
out_width = (width // compression) * vae.downscale_ratio
|
out_width = (width // compression) * vae.downscale_ratio
|
||||||
@ -75,51 +81,59 @@ class StableCascade_StageC_VAEEncode:
|
|||||||
|
|
||||||
c_latent = vae.encode(s[:,:,:,:3])
|
c_latent = vae.encode(s[:,:,:,:3])
|
||||||
b_latent = torch.zeros([c_latent.shape[0], 4, (height // 8) * 2, (width // 8) * 2])
|
b_latent = torch.zeros([c_latent.shape[0], 4, (height // 8) * 2, (width // 8) * 2])
|
||||||
return ({
|
return io.NodeOutput({
|
||||||
"samples": c_latent,
|
"samples": c_latent,
|
||||||
}, {
|
}, {
|
||||||
"samples": b_latent,
|
"samples": b_latent,
|
||||||
})
|
})
|
||||||
|
|
||||||
class StableCascade_StageB_Conditioning:
|
|
||||||
|
class StableCascade_StageB_Conditioning(io.ComfyNode):
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(s):
|
def define_schema(cls):
|
||||||
return {"required": { "conditioning": ("CONDITIONING",),
|
return io.Schema(
|
||||||
"stage_c": ("LATENT",),
|
node_id="StableCascade_StageB_Conditioning",
|
||||||
}}
|
category="conditioning/stable_cascade",
|
||||||
RETURN_TYPES = ("CONDITIONING",)
|
inputs=[
|
||||||
|
io.Conditioning.Input("conditioning"),
|
||||||
|
io.Latent.Input("stage_c"),
|
||||||
|
],
|
||||||
|
outputs=[
|
||||||
|
io.Conditioning.Output(),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
FUNCTION = "set_prior"
|
@classmethod
|
||||||
|
def execute(cls, conditioning, stage_c):
|
||||||
CATEGORY = "conditioning/stable_cascade"
|
|
||||||
|
|
||||||
def set_prior(self, conditioning, stage_c):
|
|
||||||
c = []
|
c = []
|
||||||
for t in conditioning:
|
for t in conditioning:
|
||||||
d = t[1].copy()
|
d = t[1].copy()
|
||||||
d['stable_cascade_prior'] = stage_c['samples']
|
d["stable_cascade_prior"] = stage_c["samples"]
|
||||||
n = [t[0], d]
|
n = [t[0], d]
|
||||||
c.append(n)
|
c.append(n)
|
||||||
return (c, )
|
return io.NodeOutput(c)
|
||||||
|
|
||||||
class StableCascade_SuperResolutionControlnet:
|
|
||||||
def __init__(self, device="cpu"):
|
class StableCascade_SuperResolutionControlnet(io.ComfyNode):
|
||||||
self.device = device
|
@classmethod
|
||||||
|
def define_schema(cls):
|
||||||
|
return io.Schema(
|
||||||
|
node_id="StableCascade_SuperResolutionControlnet",
|
||||||
|
category="_for_testing/stable_cascade",
|
||||||
|
is_experimental=True,
|
||||||
|
inputs=[
|
||||||
|
io.Image.Input("image"),
|
||||||
|
io.Vae.Input("vae"),
|
||||||
|
],
|
||||||
|
outputs=[
|
||||||
|
io.Image.Output(display_name="controlnet_input"),
|
||||||
|
io.Latent.Output(display_name="stage_c"),
|
||||||
|
io.Latent.Output(display_name="stage_b"),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(s):
|
def execute(cls, image, vae):
|
||||||
return {"required": {
|
|
||||||
"image": ("IMAGE",),
|
|
||||||
"vae": ("VAE", ),
|
|
||||||
}}
|
|
||||||
RETURN_TYPES = ("IMAGE", "LATENT", "LATENT")
|
|
||||||
RETURN_NAMES = ("controlnet_input", "stage_c", "stage_b")
|
|
||||||
FUNCTION = "generate"
|
|
||||||
|
|
||||||
EXPERIMENTAL = True
|
|
||||||
CATEGORY = "_for_testing/stable_cascade"
|
|
||||||
|
|
||||||
def generate(self, image, vae):
|
|
||||||
width = image.shape[-2]
|
width = image.shape[-2]
|
||||||
height = image.shape[-3]
|
height = image.shape[-3]
|
||||||
batch_size = image.shape[0]
|
batch_size = image.shape[0]
|
||||||
@ -127,15 +141,22 @@ class StableCascade_SuperResolutionControlnet:
|
|||||||
|
|
||||||
c_latent = torch.zeros([batch_size, 16, height // 16, width // 16])
|
c_latent = torch.zeros([batch_size, 16, height // 16, width // 16])
|
||||||
b_latent = torch.zeros([batch_size, 4, height // 2, width // 2])
|
b_latent = torch.zeros([batch_size, 4, height // 2, width // 2])
|
||||||
return (controlnet_input, {
|
return io.NodeOutput(controlnet_input, {
|
||||||
"samples": c_latent,
|
"samples": c_latent,
|
||||||
}, {
|
}, {
|
||||||
"samples": b_latent,
|
"samples": b_latent,
|
||||||
})
|
})
|
||||||
|
|
||||||
NODE_CLASS_MAPPINGS = {
|
|
||||||
"StableCascade_EmptyLatentImage": StableCascade_EmptyLatentImage,
|
class StableCascadeExtension(ComfyExtension):
|
||||||
"StableCascade_StageB_Conditioning": StableCascade_StageB_Conditioning,
|
@override
|
||||||
"StableCascade_StageC_VAEEncode": StableCascade_StageC_VAEEncode,
|
async def get_node_list(self) -> list[type[io.ComfyNode]]:
|
||||||
"StableCascade_SuperResolutionControlnet": StableCascade_SuperResolutionControlnet,
|
return [
|
||||||
}
|
StableCascade_EmptyLatentImage,
|
||||||
|
StableCascade_StageB_Conditioning,
|
||||||
|
StableCascade_StageC_VAEEncode,
|
||||||
|
StableCascade_SuperResolutionControlnet,
|
||||||
|
]
|
||||||
|
|
||||||
|
async def comfy_entrypoint() -> StableCascadeExtension:
|
||||||
|
return StableCascadeExtension()
|
||||||
|
|||||||
@ -5,52 +5,49 @@ import av
|
|||||||
import torch
|
import torch
|
||||||
import folder_paths
|
import folder_paths
|
||||||
import json
|
import json
|
||||||
from typing import Optional, Literal
|
from typing import Optional
|
||||||
|
from typing_extensions import override
|
||||||
from fractions import Fraction
|
from fractions import Fraction
|
||||||
from comfy.comfy_types import IO, FileLocator, ComfyNodeABC
|
from comfy_api.input import AudioInput, ImageInput, VideoInput
|
||||||
from comfy_api.latest import Input, InputImpl, Types
|
from comfy_api.input_impl import VideoFromComponents, VideoFromFile
|
||||||
|
from comfy_api.util import VideoCodec, VideoComponents, VideoContainer
|
||||||
|
from comfy_api.latest import ComfyExtension, io, ui
|
||||||
from comfy.cli_args import args
|
from comfy.cli_args import args
|
||||||
|
|
||||||
class SaveWEBM:
|
class SaveWEBM(io.ComfyNode):
|
||||||
def __init__(self):
|
@classmethod
|
||||||
self.output_dir = folder_paths.get_output_directory()
|
def define_schema(cls):
|
||||||
self.type = "output"
|
return io.Schema(
|
||||||
self.prefix_append = ""
|
node_id="SaveWEBM",
|
||||||
|
category="image/video",
|
||||||
|
is_experimental=True,
|
||||||
|
inputs=[
|
||||||
|
io.Image.Input("images"),
|
||||||
|
io.String.Input("filename_prefix", default="ComfyUI"),
|
||||||
|
io.Combo.Input("codec", options=["vp9", "av1"]),
|
||||||
|
io.Float.Input("fps", default=24.0, min=0.01, max=1000.0, step=0.01),
|
||||||
|
io.Float.Input("crf", default=32.0, min=0, max=63.0, step=1, tooltip="Higher crf means lower quality with a smaller file size, lower crf means higher quality higher filesize."),
|
||||||
|
],
|
||||||
|
outputs=[],
|
||||||
|
hidden=[io.Hidden.prompt, io.Hidden.extra_pnginfo],
|
||||||
|
is_output_node=True,
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(s):
|
def execute(cls, images, codec, fps, filename_prefix, crf) -> io.NodeOutput:
|
||||||
return {"required":
|
full_output_folder, filename, counter, subfolder, filename_prefix = folder_paths.get_save_image_path(
|
||||||
{"images": ("IMAGE", ),
|
filename_prefix, folder_paths.get_output_directory(), images[0].shape[1], images[0].shape[0]
|
||||||
"filename_prefix": ("STRING", {"default": "ComfyUI"}),
|
)
|
||||||
"codec": (["vp9", "av1"],),
|
|
||||||
"fps": ("FLOAT", {"default": 24.0, "min": 0.01, "max": 1000.0, "step": 0.01}),
|
|
||||||
"crf": ("FLOAT", {"default": 32.0, "min": 0, "max": 63.0, "step": 1, "tooltip": "Higher crf means lower quality with a smaller file size, lower crf means higher quality higher filesize."}),
|
|
||||||
},
|
|
||||||
"hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"},
|
|
||||||
}
|
|
||||||
|
|
||||||
RETURN_TYPES = ()
|
|
||||||
FUNCTION = "save_images"
|
|
||||||
|
|
||||||
OUTPUT_NODE = True
|
|
||||||
|
|
||||||
CATEGORY = "image/video"
|
|
||||||
|
|
||||||
EXPERIMENTAL = True
|
|
||||||
|
|
||||||
def save_images(self, images, codec, fps, filename_prefix, crf, prompt=None, extra_pnginfo=None):
|
|
||||||
filename_prefix += self.prefix_append
|
|
||||||
full_output_folder, filename, counter, subfolder, filename_prefix = folder_paths.get_save_image_path(filename_prefix, self.output_dir, images[0].shape[1], images[0].shape[0])
|
|
||||||
|
|
||||||
file = f"{filename}_{counter:05}_.webm"
|
file = f"{filename}_{counter:05}_.webm"
|
||||||
container = av.open(os.path.join(full_output_folder, file), mode="w")
|
container = av.open(os.path.join(full_output_folder, file), mode="w")
|
||||||
|
|
||||||
if prompt is not None:
|
if cls.hidden.prompt is not None:
|
||||||
container.metadata["prompt"] = json.dumps(prompt)
|
container.metadata["prompt"] = json.dumps(cls.hidden.prompt)
|
||||||
|
|
||||||
if extra_pnginfo is not None:
|
if cls.hidden.extra_pnginfo is not None:
|
||||||
for x in extra_pnginfo:
|
for x in cls.hidden.extra_pnginfo:
|
||||||
container.metadata[x] = json.dumps(extra_pnginfo[x])
|
container.metadata[x] = json.dumps(cls.hidden.extra_pnginfo[x])
|
||||||
|
|
||||||
codec_map = {"vp9": "libvpx-vp9", "av1": "libsvtav1"}
|
codec_map = {"vp9": "libvpx-vp9", "av1": "libsvtav1"}
|
||||||
stream = container.add_stream(codec_map[codec], rate=Fraction(round(fps * 1000), 1000))
|
stream = container.add_stream(codec_map[codec], rate=Fraction(round(fps * 1000), 1000))
|
||||||
@ -69,63 +66,46 @@ class SaveWEBM:
|
|||||||
container.mux(stream.encode())
|
container.mux(stream.encode())
|
||||||
container.close()
|
container.close()
|
||||||
|
|
||||||
results: list[FileLocator] = [{
|
return io.NodeOutput(ui=ui.PreviewVideo([ui.SavedResult(file, subfolder, io.FolderType.output)]))
|
||||||
"filename": file,
|
|
||||||
"subfolder": subfolder,
|
|
||||||
"type": self.type
|
|
||||||
}]
|
|
||||||
|
|
||||||
return {"ui": {"images": results, "animated": (True,)}} # TODO: frontend side
|
class SaveVideo(io.ComfyNode):
|
||||||
|
@classmethod
|
||||||
class SaveVideo(ComfyNodeABC):
|
def define_schema(cls):
|
||||||
def __init__(self):
|
return io.Schema(
|
||||||
self.output_dir = folder_paths.get_output_directory()
|
node_id="SaveVideo",
|
||||||
self.type: Literal["output"] = "output"
|
display_name="Save Video",
|
||||||
self.prefix_append = ""
|
category="image/video",
|
||||||
|
description="Saves the input images to your ComfyUI output directory.",
|
||||||
|
inputs=[
|
||||||
|
io.Video.Input("video", tooltip="The video to save."),
|
||||||
|
io.String.Input("filename_prefix", default="video/ComfyUI", tooltip="The prefix for the file to save. This may include formatting information such as %date:yyyy-MM-dd% or %Empty Latent Image.width% to include values from nodes."),
|
||||||
|
io.Combo.Input("format", options=VideoContainer.as_input(), default="auto", tooltip="The format to save the video as."),
|
||||||
|
io.Combo.Input("codec", options=VideoCodec.as_input(), default="auto", tooltip="The codec to use for the video."),
|
||||||
|
],
|
||||||
|
outputs=[],
|
||||||
|
hidden=[io.Hidden.prompt, io.Hidden.extra_pnginfo],
|
||||||
|
is_output_node=True,
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(cls):
|
def execute(cls, video: VideoInput, filename_prefix, format, codec) -> io.NodeOutput:
|
||||||
return {
|
|
||||||
"required": {
|
|
||||||
"video": (IO.VIDEO, {"tooltip": "The video to save."}),
|
|
||||||
"filename_prefix": ("STRING", {"default": "video/ComfyUI", "tooltip": "The prefix for the file to save. This may include formatting information such as %date:yyyy-MM-dd% or %Empty Latent Image.width% to include values from nodes."}),
|
|
||||||
"format": (Types.VideoContainer.as_input(), {"default": "auto", "tooltip": "The format to save the video as."}),
|
|
||||||
"codec": (Types.VideoCodec.as_input(), {"default": "auto", "tooltip": "The codec to use for the video."}),
|
|
||||||
},
|
|
||||||
"hidden": {
|
|
||||||
"prompt": "PROMPT",
|
|
||||||
"extra_pnginfo": "EXTRA_PNGINFO"
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
RETURN_TYPES = ()
|
|
||||||
FUNCTION = "save_video"
|
|
||||||
|
|
||||||
OUTPUT_NODE = True
|
|
||||||
|
|
||||||
CATEGORY = "image/video"
|
|
||||||
DESCRIPTION = "Saves the input images to your ComfyUI output directory."
|
|
||||||
|
|
||||||
def save_video(self, video: Input.Video, filename_prefix, format, codec, prompt=None, extra_pnginfo=None):
|
|
||||||
filename_prefix += self.prefix_append
|
|
||||||
width, height = video.get_dimensions()
|
width, height = video.get_dimensions()
|
||||||
full_output_folder, filename, counter, subfolder, filename_prefix = folder_paths.get_save_image_path(
|
full_output_folder, filename, counter, subfolder, filename_prefix = folder_paths.get_save_image_path(
|
||||||
filename_prefix,
|
filename_prefix,
|
||||||
self.output_dir,
|
folder_paths.get_output_directory(),
|
||||||
width,
|
width,
|
||||||
height
|
height
|
||||||
)
|
)
|
||||||
results: list[FileLocator] = list()
|
|
||||||
saved_metadata = None
|
saved_metadata = None
|
||||||
if not args.disable_metadata:
|
if not args.disable_metadata:
|
||||||
metadata = {}
|
metadata = {}
|
||||||
if extra_pnginfo is not None:
|
if cls.hidden.extra_pnginfo is not None:
|
||||||
metadata.update(extra_pnginfo)
|
metadata.update(cls.hidden.extra_pnginfo)
|
||||||
if prompt is not None:
|
if cls.hidden.prompt is not None:
|
||||||
metadata["prompt"] = prompt
|
metadata["prompt"] = cls.hidden.prompt
|
||||||
if len(metadata) > 0:
|
if len(metadata) > 0:
|
||||||
saved_metadata = metadata
|
saved_metadata = metadata
|
||||||
file = f"{filename}_{counter:05}_.{Types.VideoContainer.get_extension(format)}"
|
file = f"{filename}_{counter:05}_.{VideoContainer.get_extension(format)}"
|
||||||
video.save_to(
|
video.save_to(
|
||||||
os.path.join(full_output_folder, file),
|
os.path.join(full_output_folder, file),
|
||||||
format=format,
|
format=format,
|
||||||
@ -133,83 +113,82 @@ class SaveVideo(ComfyNodeABC):
|
|||||||
metadata=saved_metadata
|
metadata=saved_metadata
|
||||||
)
|
)
|
||||||
|
|
||||||
results.append({
|
return io.NodeOutput(ui=ui.PreviewVideo([ui.SavedResult(file, subfolder, io.FolderType.output)]))
|
||||||
"filename": file,
|
|
||||||
"subfolder": subfolder,
|
|
||||||
"type": self.type
|
|
||||||
})
|
|
||||||
counter += 1
|
|
||||||
|
|
||||||
return { "ui": { "images": results, "animated": (True,) } }
|
|
||||||
|
|
||||||
class CreateVideo(ComfyNodeABC):
|
class CreateVideo(io.ComfyNode):
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(cls):
|
def define_schema(cls):
|
||||||
return {
|
return io.Schema(
|
||||||
"required": {
|
node_id="CreateVideo",
|
||||||
"images": (IO.IMAGE, {"tooltip": "The images to create a video from."}),
|
display_name="Create Video",
|
||||||
"fps": ("FLOAT", {"default": 30.0, "min": 1.0, "max": 120.0, "step": 1.0}),
|
category="image/video",
|
||||||
},
|
description="Create a video from images.",
|
||||||
"optional": {
|
inputs=[
|
||||||
"audio": (IO.AUDIO, {"tooltip": "The audio to add to the video."}),
|
io.Image.Input("images", tooltip="The images to create a video from."),
|
||||||
}
|
io.Float.Input("fps", default=30.0, min=1.0, max=120.0, step=1.0),
|
||||||
}
|
io.Audio.Input("audio", optional=True, tooltip="The audio to add to the video."),
|
||||||
|
],
|
||||||
|
outputs=[
|
||||||
|
io.Video.Output(),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
RETURN_TYPES = (IO.VIDEO,)
|
|
||||||
FUNCTION = "create_video"
|
|
||||||
|
|
||||||
CATEGORY = "image/video"
|
|
||||||
DESCRIPTION = "Create a video from images."
|
|
||||||
|
|
||||||
def create_video(self, images: Input.Image, fps: float, audio: Optional[Input.Audio] = None):
|
|
||||||
return (InputImpl.VideoFromComponents(
|
|
||||||
Types.VideoComponents(
|
|
||||||
images=images,
|
|
||||||
audio=audio,
|
|
||||||
frame_rate=Fraction(fps),
|
|
||||||
)
|
|
||||||
),)
|
|
||||||
|
|
||||||
class GetVideoComponents(ComfyNodeABC):
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(cls):
|
def execute(cls, images: ImageInput, fps: float, audio: Optional[AudioInput] = None) -> io.NodeOutput:
|
||||||
return {
|
return io.NodeOutput(
|
||||||
"required": {
|
VideoFromComponents(VideoComponents(images=images, audio=audio, frame_rate=Fraction(fps)))
|
||||||
"video": (IO.VIDEO, {"tooltip": "The video to extract components from."}),
|
)
|
||||||
}
|
|
||||||
}
|
|
||||||
RETURN_TYPES = (IO.IMAGE, IO.AUDIO, IO.FLOAT)
|
|
||||||
RETURN_NAMES = ("images", "audio", "fps")
|
|
||||||
FUNCTION = "get_components"
|
|
||||||
|
|
||||||
CATEGORY = "image/video"
|
class GetVideoComponents(io.ComfyNode):
|
||||||
DESCRIPTION = "Extracts all components from a video: frames, audio, and framerate."
|
@classmethod
|
||||||
|
def define_schema(cls):
|
||||||
|
return io.Schema(
|
||||||
|
node_id="GetVideoComponents",
|
||||||
|
display_name="Get Video Components",
|
||||||
|
category="image/video",
|
||||||
|
description="Extracts all components from a video: frames, audio, and framerate.",
|
||||||
|
inputs=[
|
||||||
|
io.Video.Input("video", tooltip="The video to extract components from."),
|
||||||
|
],
|
||||||
|
outputs=[
|
||||||
|
io.Image.Output(display_name="images"),
|
||||||
|
io.Audio.Output(display_name="audio"),
|
||||||
|
io.Float.Output(display_name="fps"),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
def get_components(self, video: Input.Video):
|
@classmethod
|
||||||
|
def execute(cls, video: VideoInput) -> io.NodeOutput:
|
||||||
components = video.get_components()
|
components = video.get_components()
|
||||||
|
|
||||||
return (components.images, components.audio, float(components.frame_rate))
|
return io.NodeOutput(components.images, components.audio, float(components.frame_rate))
|
||||||
|
|
||||||
class LoadVideo(ComfyNodeABC):
|
class LoadVideo(io.ComfyNode):
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(cls):
|
def define_schema(cls):
|
||||||
input_dir = folder_paths.get_input_directory()
|
input_dir = folder_paths.get_input_directory()
|
||||||
files = [f for f in os.listdir(input_dir) if os.path.isfile(os.path.join(input_dir, f))]
|
files = [f for f in os.listdir(input_dir) if os.path.isfile(os.path.join(input_dir, f))]
|
||||||
files = folder_paths.filter_files_content_types(files, ["video"])
|
files = folder_paths.filter_files_content_types(files, ["video"])
|
||||||
return {"required":
|
return io.Schema(
|
||||||
{"file": (sorted(files), {"video_upload": True})},
|
node_id="LoadVideo",
|
||||||
}
|
display_name="Load Video",
|
||||||
|
category="image/video",
|
||||||
CATEGORY = "image/video"
|
inputs=[
|
||||||
|
io.Combo.Input("file", options=sorted(files), upload=io.UploadType.video),
|
||||||
RETURN_TYPES = (IO.VIDEO,)
|
],
|
||||||
FUNCTION = "load_video"
|
outputs=[
|
||||||
def load_video(self, file):
|
io.Video.Output(),
|
||||||
video_path = folder_paths.get_annotated_filepath(file)
|
],
|
||||||
return (InputImpl.VideoFromFile(video_path),)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def IS_CHANGED(cls, file):
|
def execute(cls, file) -> io.NodeOutput:
|
||||||
|
video_path = folder_paths.get_annotated_filepath(file)
|
||||||
|
return io.NodeOutput(VideoFromFile(video_path))
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def fingerprint_inputs(s, file):
|
||||||
video_path = folder_paths.get_annotated_filepath(file)
|
video_path = folder_paths.get_annotated_filepath(file)
|
||||||
mod_time = os.path.getmtime(video_path)
|
mod_time = os.path.getmtime(video_path)
|
||||||
# Instead of hashing the file, we can just use the modification time to avoid
|
# Instead of hashing the file, we can just use the modification time to avoid
|
||||||
@ -217,24 +196,23 @@ class LoadVideo(ComfyNodeABC):
|
|||||||
return mod_time
|
return mod_time
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def VALIDATE_INPUTS(cls, file):
|
def validate_inputs(s, file):
|
||||||
if not folder_paths.exists_annotated_filepath(file):
|
if not folder_paths.exists_annotated_filepath(file):
|
||||||
return "Invalid video file: {}".format(file)
|
return "Invalid video file: {}".format(file)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
NODE_CLASS_MAPPINGS = {
|
|
||||||
"SaveWEBM": SaveWEBM,
|
|
||||||
"SaveVideo": SaveVideo,
|
|
||||||
"CreateVideo": CreateVideo,
|
|
||||||
"GetVideoComponents": GetVideoComponents,
|
|
||||||
"LoadVideo": LoadVideo,
|
|
||||||
}
|
|
||||||
|
|
||||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
class VideoExtension(ComfyExtension):
|
||||||
"SaveVideo": "Save Video",
|
@override
|
||||||
"CreateVideo": "Create Video",
|
async def get_node_list(self) -> list[type[io.ComfyNode]]:
|
||||||
"GetVideoComponents": "Get Video Components",
|
return [
|
||||||
"LoadVideo": "Load Video",
|
SaveWEBM,
|
||||||
}
|
SaveVideo,
|
||||||
|
CreateVideo,
|
||||||
|
GetVideoComponents,
|
||||||
|
LoadVideo,
|
||||||
|
]
|
||||||
|
|
||||||
|
async def comfy_entrypoint() -> VideoExtension:
|
||||||
|
return VideoExtension()
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
# This file is automatically generated by the build process when version is
|
# This file is automatically generated by the build process when version is
|
||||||
# updated in pyproject.toml.
|
# updated in pyproject.toml.
|
||||||
__version__ = "0.3.55"
|
__version__ = "0.3.56"
|
||||||
|
|||||||
2
main.py
2
main.py
@ -128,7 +128,7 @@ import gc
|
|||||||
|
|
||||||
|
|
||||||
if os.name == "nt":
|
if os.name == "nt":
|
||||||
logging.getLogger("xformers").addFilter(lambda record: 'A matching Triton is not available' not in record.getMessage())
|
os.environ['MIMALLOC_PURGE_DELAY'] = '0'
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if args.default_device is not None:
|
if args.default_device is not None:
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "ComfyUI"
|
name = "ComfyUI"
|
||||||
version = "0.3.55"
|
version = "0.3.56"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = { file = "LICENSE" }
|
license = { file = "LICENSE" }
|
||||||
requires-python = ">=3.9"
|
requires-python = ">=3.9"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user