Connect 2D upscaler through H3 parameter output

This commit is contained in:
2026-11-12 09:05:49 +00:00
parent 6a899bfacb
commit 100f17d356
3 changed files with 106 additions and 18 deletions
+5
View File
@@ -95,6 +95,11 @@ tile; temporal splitting is intentionally not used. Put the checkpoint in
`models/latent_upscale_models`, then set `tile_size` and `tile_overlap` to fit
available VRAM.
`DumasMMH3LatentUpscale2DModelParams` is the matching parameter node. Its output
is `latent_upscale_param` with type `H3_UPSCALE_PARAM`, so it connects to the
existing DUMAS Continuum tiled-upscale node in the same place as the native H3
model-parameter node.
### DUMAS H3 Sequence Prompt Builder
`DumasH3SequencePromptBuilder` provides the tabbed, timeline-oriented prompt
+46 -1
View File
@@ -14,6 +14,47 @@ def _upscaler_module():
return module
class DumasMMH3LatentUpscale2DModelParams:
"""Provide the H3_UPSCALE_PARAM contract for the DUMAS 2D path."""
@classmethod
def INPUT_TYPES(cls):
import folder_paths
names = [
name for name in folder_paths.get_filename_list("latent_upscale_models")
if str(name).lower().endswith((".safetensors", ".pth"))
]
return {"required": {
"model_name": (names or ["(place model in models/latent_upscale_models)"],),
"device": (["cuda", "rocm", "cpu"], {"default": "cuda"}),
"precision": (["fp32", "fp16", "bf16"], {"default": "fp16"}),
"scale": ("FLOAT", {"default": 2.0, "min": 1.0, "max": 4.0, "step": 0.05}),
"tile_size": ("INT", {"default": 64, "min": 8, "max": 1024, "step": 8}),
"tile_overlap": ("INT", {"default": 8, "min": 0, "max": 128, "step": 1}),
"sharpness": ("INT", {"default": 1, "min": 1, "max": 6, "step": 1}),
}}
RETURN_TYPES = ("H3_UPSCALE_PARAM",)
RETURN_NAMES = ("latent_upscale_param",)
FUNCTION = "build"
CATEGORY = "Dumas/MiniMax H3/Upscale"
def build(self, model_name, device, precision, scale, tile_size, tile_overlap, sharpness):
if str(model_name).startswith("("):
raise ValueError("Place the 2D H3 model in models/latent_upscale_models")
return ({
"dumas_h3_2d": True,
"model_name": str(model_name),
"device": str(device),
"precision": str(precision),
"scale": float(scale),
"tile_size": int(tile_size),
"tile_overlap": int(tile_overlap),
"sharpness": int(sharpness),
},)
class DumasMMH3LatentUpscale2D:
"""Apply the MiniMax H3 2D upscaler using X/Y tiles only."""
@@ -113,7 +154,11 @@ class DumasMMH3LatentUpscale2D:
)
NODE_CLASS_MAPPINGS = {"DumasMMH3LatentUpscale2D": DumasMMH3LatentUpscale2D}
NODE_CLASS_MAPPINGS = {
"DumasMMH3LatentUpscale2DModelParams": DumasMMH3LatentUpscale2DModelParams,
"DumasMMH3LatentUpscale2D": DumasMMH3LatentUpscale2D,
}
NODE_DISPLAY_NAME_MAPPINGS = {
"DumasMMH3LatentUpscale2D": "DUMAS MiniMax-H3 2D Spatial Latent Upscale",
"DumasMMH3LatentUpscale2DModelParams": "DUMAS MiniMax-H3 2D Latent Upscale Model",
}
+55 -17
View File
@@ -243,23 +243,6 @@ class DumasH3ContinuumTiledLatentUpscalePerClip:
temporal_split_param=None,
upscale_sigmas=None,
):
native = _native_node("MMH3UltimateUpscale")
random_noise = _native_node("RandomNoise")
sampler_select = _native_node("KSamplerSelect")
scheduler = _native_node("BasicScheduler")
missing = [
name
for name, value in (
("MMH3UltimateUpscale", native),
("RandomNoise", random_noise),
("KSamplerSelect", sampler_select),
("BasicScheduler", scheduler),
)
if value is None
]
if missing:
raise RuntimeError("Missing native ComfyUI nodes: " + ", ".join(missing))
latents = _clips(video_latents)
if not latents:
raise ValueError("video_latents must contain at least one clip")
@@ -314,6 +297,25 @@ class DumasH3ContinuumTiledLatentUpscalePerClip:
upscale_param = _one(latent_upscale_param, "latent_upscale_param")
spatial_param = _one(spatial_split_param, "spatial_split_param")
native = _native_node("MMH3UltimateUpscale")
random_noise = _native_node("RandomNoise")
sampler_select = _native_node("KSamplerSelect")
scheduler = _native_node("BasicScheduler")
is_dumas_2d = isinstance(upscale_param, dict) and upscale_param.get("dumas_h3_2d")
if not is_dumas_2d:
missing = [
name
for name, value in (
("MMH3UltimateUpscale", native),
("RandomNoise", random_noise),
("KSamplerSelect", sampler_select),
("BasicScheduler", scheduler),
)
if value is None
]
if missing:
raise RuntimeError("Missing native ComfyUI nodes: " + ", ".join(missing))
outputs = []
video_outputs = []
reports = []
@@ -324,6 +326,42 @@ class DumasH3ContinuumTiledLatentUpscalePerClip:
raise ValueError(
"audio_latents must contain one first-pass audio latent per physical clip"
)
if is_dumas_2d:
from .dumas_h3_latent_upscale_2d import DumasMMH3LatentUpscale2D
processor = DumasMMH3LatentUpscale2D()
for index, clip_latent in enumerate(latents, start=1):
samples = clip_latent.get("samples") if isinstance(clip_latent, dict) else None
if samples is None or getattr(samples, "ndim", None) != 5:
raise ValueError(f"clip {index} is not a 5-D H3 LATENT")
upscaled, report = processor.upscale(
{"samples": samples},
model_name=upscale_param["model_name"],
scale=upscale_param["scale"],
tile_size=upscale_param["tile_size"],
tile_overlap=upscale_param["tile_overlap"],
sharpness=upscale_param["sharpness"],
device=upscale_param["device"],
precision=upscale_param["precision"],
)
audio_latent = audio_values[index - 1]
audio_samples = audio_latent.get("samples")
output = build_av_latent(upscaled["samples"], audio_samples)
outputs.append(output)
video_outputs.append(upscaled)
reports.append(f"clip {index}: {report}")
audio_outputs = _clips(audio_latents)
update_geometry = _continuum_helper("update_second_pass_geometry")
updated_plan = update_geometry(
_one(assembly_plan, "assembly_plan"), video_outputs
)
return (
outputs, audio_outputs, updated_plan,
"H3 Continuum DUMAS 2D spatial latent upscale; "
+ "; ".join(reports),
)
for index, (clip_latent, clip_model, clip_conditioning) in enumerate(
zip(latents, models, conditionings), start=1
):