2025-09-13 15:58:43 -06:00
|
|
|
from typing_extensions import override
|
|
|
|
|
from typing import Callable
|
|
|
|
|
|
|
|
|
|
import torch
|
|
|
|
|
|
|
|
|
|
import comfy.model_management
|
|
|
|
|
from comfy_api.latest import ComfyExtension, io
|
|
|
|
|
|
|
|
|
|
import nodes
|
|
|
|
|
|
|
|
|
|
class EmptyChromaRadianceLatentImage(io.ComfyNode):
|
|
|
|
|
@classmethod
|
|
|
|
|
def define_schema(cls) -> io.Schema:
|
|
|
|
|
return io.Schema(
|
|
|
|
|
node_id="EmptyChromaRadianceLatentImage",
|
|
|
|
|
category="latent/chroma_radiance",
|
|
|
|
|
inputs=[
|
|
|
|
|
io.Int.Input(id="width", default=1024, min=16, max=nodes.MAX_RESOLUTION, step=16),
|
|
|
|
|
io.Int.Input(id="height", default=1024, min=16, max=nodes.MAX_RESOLUTION, step=16),
|
|
|
|
|
io.Int.Input(id="batch_size", default=1, min=1, max=4096),
|
|
|
|
|
],
|
|
|
|
|
outputs=[io.Latent().Output()],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def execute(cls, *, width: int, height: int, batch_size: int=1) -> io.NodeOutput:
|
|
|
|
|
latent = torch.zeros((batch_size, 3, height, width), device=comfy.model_management.intermediate_device())
|
|
|
|
|
return io.NodeOutput({"samples":latent})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ChromaRadianceOptions(io.ComfyNode):
|
|
|
|
|
@classmethod
|
|
|
|
|
def define_schema(cls) -> io.Schema:
|
|
|
|
|
return io.Schema(
|
|
|
|
|
node_id="ChromaRadianceOptions",
|
|
|
|
|
category="model_patches/chroma_radiance",
|
|
|
|
|
description="Allows setting advanced options for the Chroma Radiance model.",
|
|
|
|
|
inputs=[
|
|
|
|
|
io.Model.Input(id="model"),
|
|
|
|
|
io.Boolean.Input(
|
|
|
|
|
id="preserve_wrapper",
|
|
|
|
|
default=True,
|
|
|
|
|
tooltip="When enabled, will delegate to an existing model function wrapper if it exists. Generally should be left enabled.",
|
|
|
|
|
),
|
|
|
|
|
io.Float.Input(
|
|
|
|
|
id="start_sigma",
|
|
|
|
|
default=1.0,
|
|
|
|
|
min=0.0,
|
|
|
|
|
max=1.0,
|
|
|
|
|
tooltip="First sigma that these options will be in effect.",
|
feat: mark 429 widgets as advanced for collapsible UI (#12197)
* feat: mark 429 widgets as advanced for collapsible UI
Mark widgets as advanced across core, comfy_extras, and comfy_api_nodes
to support the new collapsible advanced inputs section in the frontend.
Changes:
- 267 advanced markers in comfy_extras/
- 162 advanced markers in comfy_api_nodes/
- All files pass python3 -m py_compile verification
Widgets marked advanced (hidden by default):
- Scheduler internals: sigma_max, sigma_min, rho, mu, beta, alpha
- Sampler internals: eta, s_noise, order, rtol, atol, h_init, pcoeff, etc.
- Memory optimization: tile_size, overlap, temporal_size, temporal_overlap
- Pipeline controls: add_noise, start_at_step, end_at_step
- Timing controls: start_percent, end_percent
- Layer selection: stop_at_clip_layer, layers, block_number
- Video encoding: codec, crf, format
- Device/dtype: device, noise_device, dtype, weight_dtype
Widgets kept basic (always visible):
- Core params: strength, steps, cfg, denoise, seed, width, height
- Model selectors: ckpt_name, lora_name, vae_name, sampler_name
- Common controls: upscale_method, crop, batch_size, fps, opacity
Related: frontend PR #11939
Amp-Thread-ID: https://ampcode.com/threads/T-019c1734-6b61-702e-b333-f02c399963fc
* fix: remove advanced=True from DynamicCombo.Input (unsupported)
Amp-Thread-ID: https://ampcode.com/threads/T-019c1734-6b61-702e-b333-f02c399963fc
* fix: address review - un-mark model merge, video, image, and training node widgets as advanced
Per comfyanonymous review:
- Model merge arguments should not be advanced (all 14 model-specific merge classes)
- SaveAnimatedWEBP lossless/quality/method should not be advanced
- SaveWEBM/SaveVideo codec/crf/format should not be advanced
- TrainLoraNode options should not be advanced (7 inputs)
Amp-Thread-ID: https://ampcode.com/threads/T-019c322b-a3a8-71b7-9962-d44573ca6352
* fix: un-mark batch_size and webcam width/height as advanced (should stay basic)
Amp-Thread-ID: https://ampcode.com/threads/T-019c3236-1417-74aa-82a3-bcb365fbe9d1
---------
Co-authored-by: Jedrzej Kosinski <kosinkadink1@gmail.com>
2026-02-19 19:20:02 -08:00
|
|
|
advanced=True,
|
2025-09-13 15:58:43 -06:00
|
|
|
),
|
|
|
|
|
io.Float.Input(
|
|
|
|
|
id="end_sigma",
|
|
|
|
|
default=0.0,
|
|
|
|
|
min=0.0,
|
|
|
|
|
max=1.0,
|
|
|
|
|
tooltip="Last sigma that these options will be in effect.",
|
feat: mark 429 widgets as advanced for collapsible UI (#12197)
* feat: mark 429 widgets as advanced for collapsible UI
Mark widgets as advanced across core, comfy_extras, and comfy_api_nodes
to support the new collapsible advanced inputs section in the frontend.
Changes:
- 267 advanced markers in comfy_extras/
- 162 advanced markers in comfy_api_nodes/
- All files pass python3 -m py_compile verification
Widgets marked advanced (hidden by default):
- Scheduler internals: sigma_max, sigma_min, rho, mu, beta, alpha
- Sampler internals: eta, s_noise, order, rtol, atol, h_init, pcoeff, etc.
- Memory optimization: tile_size, overlap, temporal_size, temporal_overlap
- Pipeline controls: add_noise, start_at_step, end_at_step
- Timing controls: start_percent, end_percent
- Layer selection: stop_at_clip_layer, layers, block_number
- Video encoding: codec, crf, format
- Device/dtype: device, noise_device, dtype, weight_dtype
Widgets kept basic (always visible):
- Core params: strength, steps, cfg, denoise, seed, width, height
- Model selectors: ckpt_name, lora_name, vae_name, sampler_name
- Common controls: upscale_method, crop, batch_size, fps, opacity
Related: frontend PR #11939
Amp-Thread-ID: https://ampcode.com/threads/T-019c1734-6b61-702e-b333-f02c399963fc
* fix: remove advanced=True from DynamicCombo.Input (unsupported)
Amp-Thread-ID: https://ampcode.com/threads/T-019c1734-6b61-702e-b333-f02c399963fc
* fix: address review - un-mark model merge, video, image, and training node widgets as advanced
Per comfyanonymous review:
- Model merge arguments should not be advanced (all 14 model-specific merge classes)
- SaveAnimatedWEBP lossless/quality/method should not be advanced
- SaveWEBM/SaveVideo codec/crf/format should not be advanced
- TrainLoraNode options should not be advanced (7 inputs)
Amp-Thread-ID: https://ampcode.com/threads/T-019c322b-a3a8-71b7-9962-d44573ca6352
* fix: un-mark batch_size and webcam width/height as advanced (should stay basic)
Amp-Thread-ID: https://ampcode.com/threads/T-019c3236-1417-74aa-82a3-bcb365fbe9d1
---------
Co-authored-by: Jedrzej Kosinski <kosinkadink1@gmail.com>
2026-02-19 19:20:02 -08:00
|
|
|
advanced=True,
|
2025-09-13 15:58:43 -06:00
|
|
|
),
|
|
|
|
|
io.Int.Input(
|
|
|
|
|
id="nerf_tile_size",
|
|
|
|
|
default=-1,
|
|
|
|
|
min=-1,
|
|
|
|
|
tooltip="Allows overriding the default NeRF tile size. -1 means use the default (32). 0 means use non-tiling mode (may require a lot of VRAM).",
|
feat: mark 429 widgets as advanced for collapsible UI (#12197)
* feat: mark 429 widgets as advanced for collapsible UI
Mark widgets as advanced across core, comfy_extras, and comfy_api_nodes
to support the new collapsible advanced inputs section in the frontend.
Changes:
- 267 advanced markers in comfy_extras/
- 162 advanced markers in comfy_api_nodes/
- All files pass python3 -m py_compile verification
Widgets marked advanced (hidden by default):
- Scheduler internals: sigma_max, sigma_min, rho, mu, beta, alpha
- Sampler internals: eta, s_noise, order, rtol, atol, h_init, pcoeff, etc.
- Memory optimization: tile_size, overlap, temporal_size, temporal_overlap
- Pipeline controls: add_noise, start_at_step, end_at_step
- Timing controls: start_percent, end_percent
- Layer selection: stop_at_clip_layer, layers, block_number
- Video encoding: codec, crf, format
- Device/dtype: device, noise_device, dtype, weight_dtype
Widgets kept basic (always visible):
- Core params: strength, steps, cfg, denoise, seed, width, height
- Model selectors: ckpt_name, lora_name, vae_name, sampler_name
- Common controls: upscale_method, crop, batch_size, fps, opacity
Related: frontend PR #11939
Amp-Thread-ID: https://ampcode.com/threads/T-019c1734-6b61-702e-b333-f02c399963fc
* fix: remove advanced=True from DynamicCombo.Input (unsupported)
Amp-Thread-ID: https://ampcode.com/threads/T-019c1734-6b61-702e-b333-f02c399963fc
* fix: address review - un-mark model merge, video, image, and training node widgets as advanced
Per comfyanonymous review:
- Model merge arguments should not be advanced (all 14 model-specific merge classes)
- SaveAnimatedWEBP lossless/quality/method should not be advanced
- SaveWEBM/SaveVideo codec/crf/format should not be advanced
- TrainLoraNode options should not be advanced (7 inputs)
Amp-Thread-ID: https://ampcode.com/threads/T-019c322b-a3a8-71b7-9962-d44573ca6352
* fix: un-mark batch_size and webcam width/height as advanced (should stay basic)
Amp-Thread-ID: https://ampcode.com/threads/T-019c3236-1417-74aa-82a3-bcb365fbe9d1
---------
Co-authored-by: Jedrzej Kosinski <kosinkadink1@gmail.com>
2026-02-19 19:20:02 -08:00
|
|
|
advanced=True,
|
2025-09-13 15:58:43 -06:00
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
outputs=[io.Model.Output()],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def execute(
|
|
|
|
|
cls,
|
|
|
|
|
*,
|
|
|
|
|
model: io.Model.Type,
|
|
|
|
|
preserve_wrapper: bool,
|
|
|
|
|
start_sigma: float,
|
|
|
|
|
end_sigma: float,
|
|
|
|
|
nerf_tile_size: int,
|
|
|
|
|
) -> io.NodeOutput:
|
|
|
|
|
radiance_options = {}
|
|
|
|
|
if nerf_tile_size >= 0:
|
|
|
|
|
radiance_options["nerf_tile_size"] = nerf_tile_size
|
|
|
|
|
|
|
|
|
|
if not radiance_options:
|
|
|
|
|
return io.NodeOutput(model)
|
|
|
|
|
|
|
|
|
|
old_wrapper = model.model_options.get("model_function_wrapper")
|
|
|
|
|
|
|
|
|
|
def model_function_wrapper(apply_model: Callable, args: dict) -> torch.Tensor:
|
|
|
|
|
c = args["c"].copy()
|
|
|
|
|
sigma = args["timestep"].max().detach().cpu().item()
|
|
|
|
|
if end_sigma <= sigma <= start_sigma:
|
|
|
|
|
transformer_options = c.get("transformer_options", {}).copy()
|
|
|
|
|
transformer_options["chroma_radiance_options"] = radiance_options.copy()
|
|
|
|
|
c["transformer_options"] = transformer_options
|
|
|
|
|
if not (preserve_wrapper and old_wrapper):
|
|
|
|
|
return apply_model(args["input"], args["timestep"], **c)
|
|
|
|
|
return old_wrapper(apply_model, args | {"c": c})
|
|
|
|
|
|
|
|
|
|
model = model.clone()
|
|
|
|
|
model.set_model_unet_function_wrapper(model_function_wrapper)
|
|
|
|
|
return io.NodeOutput(model)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ChromaRadianceExtension(ComfyExtension):
|
|
|
|
|
@override
|
|
|
|
|
async def get_node_list(self) -> list[type[io.ComfyNode]]:
|
|
|
|
|
return [
|
|
|
|
|
EmptyChromaRadianceLatentImage,
|
|
|
|
|
ChromaRadianceOptions,
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def comfy_entrypoint() -> ChromaRadianceExtension:
|
|
|
|
|
return ChromaRadianceExtension()
|