Use Continuum refine context for per-clip upscale
This commit is contained in:
@@ -3,14 +3,20 @@
|
||||
## Dumas per-clip tiled latent upscale
|
||||
|
||||
This fork adds **H3 Continuum Tiled Latent Upscale (Per Clip)**. Connect the
|
||||
`video_latents` list from a Continuum sampler, the same model/conditioning,
|
||||
and the native `MMH3 Latent Upscale` and `MMH3 Spatial Split Params` nodes.
|
||||
`video_latents`, `assembly_plan`, and `refine_context` outputs from the
|
||||
Continuum sampler, plus its `model` and `CLIP`, and connect the native
|
||||
`MMH3 Latent Upscale` and `MMH3 Spatial Split Params` nodes.
|
||||
Each physical clip is sent through `MMH3UltimateUpscale` independently, with
|
||||
its own upscale sampler, scheduler, steps, denoise, CFG and seed controls.
|
||||
The result remains a LATENT list, so clips do not get concatenated into one
|
||||
larger VRAM allocation before the tiled pass. Temporal length is validated and
|
||||
cannot silently change.
|
||||
|
||||
The node consumes `refine_context` directly and internally performs the same
|
||||
context-to-conditioning adaptation as **H3 Continuum Conditioning Bridge V3.5**.
|
||||
The separate `conditioning` input is optional for advanced legacy graphs; it is
|
||||
not needed in the normal Continuum wiring.
|
||||
|
||||
The node is an adapter around ComfyUI's native MiniMax H3 tiled-upscale
|
||||
implementation; it does not include model weights or vendor the upstream
|
||||
implementation. Install this repository as a normal custom-node folder and
|
||||
|
||||
@@ -62,17 +62,12 @@ class TiledUpscaleTests(unittest.TestCase):
|
||||
{"samples": FakeSamples((1, 16, 141, 48, 84))},
|
||||
]
|
||||
outputs, report = node.upscale(
|
||||
["model"],
|
||||
["conditioning"],
|
||||
clips,
|
||||
["upscale"],
|
||||
["spatial"],
|
||||
["euler"],
|
||||
["simple"],
|
||||
[3],
|
||||
[0.2],
|
||||
[1.0],
|
||||
[100],
|
||||
model=["model"], clip=["clip"], video_latents=clips,
|
||||
assembly_plan=["plan"], refine_context=["context"],
|
||||
latent_upscale_param=["upscale"], spatial_split_param=["spatial"],
|
||||
upscale_sampler=["euler"], upscale_scheduler=["simple"],
|
||||
upscale_steps=[3], upscale_denoise=[0.2], upscale_cfg=[1.0],
|
||||
upscale_noise_seed=[100], conditioning=["conditioning"],
|
||||
)
|
||||
self.assertEqual(len(outputs), 2)
|
||||
self.assertEqual([call["latent"] for call in FakeUpscale.calls], clips)
|
||||
@@ -94,10 +89,13 @@ class TiledUpscaleTests(unittest.TestCase):
|
||||
node = MODULE.H3ContinuumTiledLatentUpscalePerClip()
|
||||
with self.assertRaisesRegex(RuntimeError, "temporal length"):
|
||||
node.upscale(
|
||||
["model"], ["conditioning"],
|
||||
[{"samples": FakeSamples((1, 16, 85, 48, 84))}],
|
||||
["upscale"], ["spatial"], ["euler"], ["simple"],
|
||||
[3], [0.2], [1.0], [100],
|
||||
model=["model"], clip=["clip"],
|
||||
video_latents=[{"samples": FakeSamples((1, 16, 85, 48, 84))}],
|
||||
assembly_plan=["plan"], refine_context=["context"],
|
||||
latent_upscale_param=["upscale"], spatial_split_param=["spatial"],
|
||||
upscale_sampler=["euler"], upscale_scheduler=["simple"],
|
||||
upscale_steps=[3], upscale_denoise=[0.2], upscale_cfg=[1.0],
|
||||
upscale_noise_seed=[100], conditioning=["conditioning"],
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -88,8 +88,10 @@ class H3ContinuumTiledLatentUpscalePerClip:
|
||||
return {
|
||||
"required": {
|
||||
"model": ("MODEL",),
|
||||
"conditioning": ("CONDITIONING",),
|
||||
"clip": ("CLIP",),
|
||||
"video_latents": ("LATENT",),
|
||||
"assembly_plan": ("H3_CONTINUUM_ASSEMBLY_PLAN",),
|
||||
"refine_context": ("H3_CONTINUUM_REFINE_CONTEXT",),
|
||||
"latent_upscale_param": ("H3_UPSCALE_PARAM",),
|
||||
"spatial_split_param": ("H3_SPATIAL_PARAM",),
|
||||
"upscale_sampler": (
|
||||
@@ -120,6 +122,8 @@ class H3ContinuumTiledLatentUpscalePerClip:
|
||||
),
|
||||
},
|
||||
"optional": {
|
||||
"conditioning": ("CONDITIONING",),
|
||||
"video_vae": ("VAE",),
|
||||
"negative": ("CONDITIONING",),
|
||||
"temporal_split_param": ("H3_TEMPORAL_PARAM",),
|
||||
"upscale_sigmas": ("SIGMAS",),
|
||||
@@ -136,8 +140,10 @@ class H3ContinuumTiledLatentUpscalePerClip:
|
||||
def upscale(
|
||||
self,
|
||||
model,
|
||||
conditioning,
|
||||
clip,
|
||||
video_latents,
|
||||
assembly_plan,
|
||||
refine_context,
|
||||
latent_upscale_param,
|
||||
spatial_split_param,
|
||||
upscale_sampler,
|
||||
@@ -146,6 +152,8 @@ class H3ContinuumTiledLatentUpscalePerClip:
|
||||
upscale_denoise,
|
||||
upscale_cfg,
|
||||
upscale_noise_seed,
|
||||
conditioning=None,
|
||||
video_vae=None,
|
||||
negative=None,
|
||||
temporal_split_param=None,
|
||||
upscale_sigmas=None,
|
||||
@@ -170,8 +178,33 @@ class H3ContinuumTiledLatentUpscalePerClip:
|
||||
latents = _clips(video_latents)
|
||||
if not latents:
|
||||
raise ValueError("video_latents must contain at least one clip")
|
||||
models = _per_clip(model, len(latents), "model")
|
||||
conditionings = _per_clip(conditioning, len(latents), "conditioning")
|
||||
if conditioning is None:
|
||||
# The Continuum sampler's refine context is a runtime contract, not
|
||||
# a Core CONDITIONING value. Reuse Continuum's own bridge so each
|
||||
# physical clip receives its captured prompt/reference conditioning
|
||||
# and its context-aware model clone at the target geometry.
|
||||
from .second_pass import prepare_physical_refine_groups
|
||||
|
||||
prepared = prepare_physical_refine_groups(
|
||||
model=_one(model, "model"),
|
||||
clip=_one(clip, "clip"),
|
||||
video_latents=latents,
|
||||
assembly_plan=_one(assembly_plan, "assembly_plan"),
|
||||
refine_context=_one(refine_context, "refine_context"),
|
||||
video_vae=(
|
||||
None if video_vae is None else _one(video_vae, "video_vae")
|
||||
),
|
||||
)
|
||||
models = prepared["group_models"]
|
||||
conditionings = prepared["conditioning"]
|
||||
if len(models) != len(latents) or len(conditionings) != len(latents):
|
||||
raise ValueError(
|
||||
"refine context bridge did not produce one model and conditioning "
|
||||
"value per physical clip"
|
||||
)
|
||||
else:
|
||||
models = _per_clip(model, len(latents), "model")
|
||||
conditionings = _per_clip(conditioning, len(latents), "conditioning")
|
||||
negatives = (
|
||||
[None] * len(latents)
|
||||
if negative is None
|
||||
|
||||
Reference in New Issue
Block a user