Use Continuum refine context for per-clip upscale
This commit is contained in:
@@ -3,14 +3,20 @@
|
|||||||
## Dumas per-clip tiled latent upscale
|
## Dumas per-clip tiled latent upscale
|
||||||
|
|
||||||
This fork adds **H3 Continuum Tiled Latent Upscale (Per Clip)**. Connect the
|
This fork adds **H3 Continuum Tiled Latent Upscale (Per Clip)**. Connect the
|
||||||
`video_latents` list from a Continuum sampler, the same model/conditioning,
|
`video_latents`, `assembly_plan`, and `refine_context` outputs from the
|
||||||
and the native `MMH3 Latent Upscale` and `MMH3 Spatial Split Params` nodes.
|
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
|
Each physical clip is sent through `MMH3UltimateUpscale` independently, with
|
||||||
its own upscale sampler, scheduler, steps, denoise, CFG and seed controls.
|
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
|
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
|
larger VRAM allocation before the tiled pass. Temporal length is validated and
|
||||||
cannot silently change.
|
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
|
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; it does not include model weights or vendor the upstream
|
||||||
implementation. Install this repository as a normal custom-node folder and
|
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))},
|
{"samples": FakeSamples((1, 16, 141, 48, 84))},
|
||||||
]
|
]
|
||||||
outputs, report = node.upscale(
|
outputs, report = node.upscale(
|
||||||
["model"],
|
model=["model"], clip=["clip"], video_latents=clips,
|
||||||
["conditioning"],
|
assembly_plan=["plan"], refine_context=["context"],
|
||||||
clips,
|
latent_upscale_param=["upscale"], spatial_split_param=["spatial"],
|
||||||
["upscale"],
|
upscale_sampler=["euler"], upscale_scheduler=["simple"],
|
||||||
["spatial"],
|
upscale_steps=[3], upscale_denoise=[0.2], upscale_cfg=[1.0],
|
||||||
["euler"],
|
upscale_noise_seed=[100], conditioning=["conditioning"],
|
||||||
["simple"],
|
|
||||||
[3],
|
|
||||||
[0.2],
|
|
||||||
[1.0],
|
|
||||||
[100],
|
|
||||||
)
|
)
|
||||||
self.assertEqual(len(outputs), 2)
|
self.assertEqual(len(outputs), 2)
|
||||||
self.assertEqual([call["latent"] for call in FakeUpscale.calls], clips)
|
self.assertEqual([call["latent"] for call in FakeUpscale.calls], clips)
|
||||||
@@ -94,10 +89,13 @@ class TiledUpscaleTests(unittest.TestCase):
|
|||||||
node = MODULE.H3ContinuumTiledLatentUpscalePerClip()
|
node = MODULE.H3ContinuumTiledLatentUpscalePerClip()
|
||||||
with self.assertRaisesRegex(RuntimeError, "temporal length"):
|
with self.assertRaisesRegex(RuntimeError, "temporal length"):
|
||||||
node.upscale(
|
node.upscale(
|
||||||
["model"], ["conditioning"],
|
model=["model"], clip=["clip"],
|
||||||
[{"samples": FakeSamples((1, 16, 85, 48, 84))}],
|
video_latents=[{"samples": FakeSamples((1, 16, 85, 48, 84))}],
|
||||||
["upscale"], ["spatial"], ["euler"], ["simple"],
|
assembly_plan=["plan"], refine_context=["context"],
|
||||||
[3], [0.2], [1.0], [100],
|
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 {
|
return {
|
||||||
"required": {
|
"required": {
|
||||||
"model": ("MODEL",),
|
"model": ("MODEL",),
|
||||||
"conditioning": ("CONDITIONING",),
|
"clip": ("CLIP",),
|
||||||
"video_latents": ("LATENT",),
|
"video_latents": ("LATENT",),
|
||||||
|
"assembly_plan": ("H3_CONTINUUM_ASSEMBLY_PLAN",),
|
||||||
|
"refine_context": ("H3_CONTINUUM_REFINE_CONTEXT",),
|
||||||
"latent_upscale_param": ("H3_UPSCALE_PARAM",),
|
"latent_upscale_param": ("H3_UPSCALE_PARAM",),
|
||||||
"spatial_split_param": ("H3_SPATIAL_PARAM",),
|
"spatial_split_param": ("H3_SPATIAL_PARAM",),
|
||||||
"upscale_sampler": (
|
"upscale_sampler": (
|
||||||
@@ -120,6 +122,8 @@ class H3ContinuumTiledLatentUpscalePerClip:
|
|||||||
),
|
),
|
||||||
},
|
},
|
||||||
"optional": {
|
"optional": {
|
||||||
|
"conditioning": ("CONDITIONING",),
|
||||||
|
"video_vae": ("VAE",),
|
||||||
"negative": ("CONDITIONING",),
|
"negative": ("CONDITIONING",),
|
||||||
"temporal_split_param": ("H3_TEMPORAL_PARAM",),
|
"temporal_split_param": ("H3_TEMPORAL_PARAM",),
|
||||||
"upscale_sigmas": ("SIGMAS",),
|
"upscale_sigmas": ("SIGMAS",),
|
||||||
@@ -136,8 +140,10 @@ class H3ContinuumTiledLatentUpscalePerClip:
|
|||||||
def upscale(
|
def upscale(
|
||||||
self,
|
self,
|
||||||
model,
|
model,
|
||||||
conditioning,
|
clip,
|
||||||
video_latents,
|
video_latents,
|
||||||
|
assembly_plan,
|
||||||
|
refine_context,
|
||||||
latent_upscale_param,
|
latent_upscale_param,
|
||||||
spatial_split_param,
|
spatial_split_param,
|
||||||
upscale_sampler,
|
upscale_sampler,
|
||||||
@@ -146,6 +152,8 @@ class H3ContinuumTiledLatentUpscalePerClip:
|
|||||||
upscale_denoise,
|
upscale_denoise,
|
||||||
upscale_cfg,
|
upscale_cfg,
|
||||||
upscale_noise_seed,
|
upscale_noise_seed,
|
||||||
|
conditioning=None,
|
||||||
|
video_vae=None,
|
||||||
negative=None,
|
negative=None,
|
||||||
temporal_split_param=None,
|
temporal_split_param=None,
|
||||||
upscale_sigmas=None,
|
upscale_sigmas=None,
|
||||||
@@ -170,6 +178,31 @@ class H3ContinuumTiledLatentUpscalePerClip:
|
|||||||
latents = _clips(video_latents)
|
latents = _clips(video_latents)
|
||||||
if not latents:
|
if not latents:
|
||||||
raise ValueError("video_latents must contain at least one clip")
|
raise ValueError("video_latents must contain at least one clip")
|
||||||
|
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")
|
models = _per_clip(model, len(latents), "model")
|
||||||
conditionings = _per_clip(conditioning, len(latents), "conditioning")
|
conditionings = _per_clip(conditioning, len(latents), "conditioning")
|
||||||
negatives = (
|
negatives = (
|
||||||
|
|||||||
Reference in New Issue
Block a user