Make per-clip H3 upscale a Second Pass replacement
This commit is contained in:
@@ -72,14 +72,16 @@ implementation.
|
||||
|
||||
### DUMAS H3 Continuum Tiled Latent Upscale (Per Clip)
|
||||
|
||||
`DumasH3ContinuumTiledLatentUpscalePerClip` applies the native H3 tiled
|
||||
upscale independently to each physical Continuum clip. It accepts the
|
||||
Continuum `refine_context` and uses the upstream refine bridge when no direct
|
||||
conditioning is connected. Its sampler, scheduler, sigma input, steps,
|
||||
denoise, CFG, and noise seed are separate from the base generation pass.
|
||||
Connected sockets take precedence over node defaults. The node preserves one
|
||||
LATENT list item per physical clip to avoid concatenating a long sequence
|
||||
into one oversized VRAM allocation.
|
||||
`DumasH3ContinuumTiledLatentUpscalePerClip` is a replacement for the upstream
|
||||
Second Pass when tiled latent upscale is required. It applies the native H3
|
||||
tiled upscale independently to each physical Continuum clip, passes the
|
||||
first-pass audio latents through unchanged, and returns the updated assembly
|
||||
plan plus status. It accepts the Continuum `refine_context` and uses the
|
||||
upstream refine bridge when no direct conditioning is connected. Its sampler,
|
||||
scheduler, sigma input, steps, denoise, CFG, and noise seed are separate from
|
||||
the base generation pass. Connected sockets take precedence over node
|
||||
defaults. The node preserves one LATENT list item per physical clip to avoid
|
||||
concatenating a long sequence into one oversized VRAM allocation.
|
||||
|
||||
The CSGlide `Render Project` control is the generation orchestrator: it renders
|
||||
clips sequentially, adopts each completed render, extracts the previous clip's
|
||||
|
||||
@@ -165,6 +165,7 @@ class DumasH3ContinuumTiledLatentUpscalePerClip:
|
||||
"model": ("MODEL",),
|
||||
"clip": ("CLIP",),
|
||||
"video_latents": ("LATENT",),
|
||||
"audio_latents": ("LATENT",),
|
||||
"assembly_plan": ("H3_CONTINUUM_ASSEMBLY_PLAN",),
|
||||
"refine_context": ("H3_CONTINUUM_REFINE_CONTEXT",),
|
||||
"latent_upscale_param": ("H3_UPSCALE_PARAM",),
|
||||
@@ -206,9 +207,9 @@ class DumasH3ContinuumTiledLatentUpscalePerClip:
|
||||
}
|
||||
|
||||
INPUT_IS_LIST = True
|
||||
RETURN_TYPES = ("LATENT", "STRING")
|
||||
RETURN_NAMES = ("upscaled_video_latents", "report")
|
||||
OUTPUT_IS_LIST = (True, False)
|
||||
RETURN_TYPES = ("LATENT", "LATENT", "H3_CONTINUUM_ASSEMBLY_PLAN", "STRING")
|
||||
RETURN_NAMES = ("refined_video_latents", "audio_latents", "updated_assembly_plan", "status")
|
||||
OUTPUT_IS_LIST = (True, True, False, False)
|
||||
FUNCTION = "upscale"
|
||||
CATEGORY = "Dumas/MiniMax H3/Upscale"
|
||||
|
||||
@@ -217,6 +218,7 @@ class DumasH3ContinuumTiledLatentUpscalePerClip:
|
||||
model,
|
||||
clip,
|
||||
video_latents,
|
||||
audio_latents,
|
||||
assembly_plan,
|
||||
refine_context,
|
||||
latent_upscale_param,
|
||||
@@ -354,12 +356,21 @@ class DumasH3ContinuumTiledLatentUpscalePerClip:
|
||||
f"clip {index}: {tuple(samples.shape)} -> {tuple(output_samples.shape)}"
|
||||
)
|
||||
|
||||
audio_outputs = _clips(audio_latents)
|
||||
if len(audio_outputs) != len(outputs):
|
||||
raise ValueError(
|
||||
"audio_latents must contain one first-pass audio latent per physical clip"
|
||||
)
|
||||
update_geometry = _continuum_helper("update_second_pass_geometry")
|
||||
updated_plan = update_geometry(_one(assembly_plan, "assembly_plan"), outputs)
|
||||
return (
|
||||
outputs,
|
||||
"H3 Continuum per-clip tiled upscale; "
|
||||
audio_outputs,
|
||||
updated_plan,
|
||||
"H3 Continuum per-clip tiled upscale replacement; "
|
||||
f"clips={len(outputs)}, sampler={sampler_name}, scheduler={scheduler_name}, "
|
||||
f"steps={steps}, denoise={denoise:g}, cfg={cfg:g}, seed_base={seed}; "
|
||||
+ "; ".join(reports),
|
||||
"audio=first-pass passthrough; " + "; ".join(reports),
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -90,6 +90,7 @@ class H3NodeTests(unittest.TestCase):
|
||||
|
||||
def test_per_clip_upscale_uses_connected_sigmas(self):
|
||||
original = UPSCALE._native_node
|
||||
original_helper = UPSCALE._continuum_helper
|
||||
FakeUpscale.calls = []
|
||||
UPSCALE._native_node = lambda name: {
|
||||
"MMH3UltimateUpscale": FakeUpscale,
|
||||
@@ -97,12 +98,16 @@ class H3NodeTests(unittest.TestCase):
|
||||
"KSamplerSelect": FakeSampler,
|
||||
"BasicScheduler": FakeScheduler,
|
||||
}.get(name)
|
||||
UPSCALE._continuum_helper = lambda name: (
|
||||
lambda plan, latents: {**plan, "updated": True}
|
||||
)
|
||||
try:
|
||||
node = UPSCALE.DumasH3ContinuumTiledLatentUpscalePerClip()
|
||||
outputs, report = node.upscale(
|
||||
outputs, audio, plan, report = node.upscale(
|
||||
model=["model"], clip=["clip"],
|
||||
video_latents=[{"samples": FakeSamples((1, 16, 85, 48, 84))}],
|
||||
assembly_plan=["plan"], refine_context=["context"],
|
||||
audio_latents=[{"audio": "first-pass"}],
|
||||
assembly_plan=[{"plan": True}], 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],
|
||||
@@ -110,10 +115,13 @@ class H3NodeTests(unittest.TestCase):
|
||||
upscale_sigmas=["connected-sigmas"],
|
||||
)
|
||||
self.assertEqual(len(outputs), 1)
|
||||
self.assertEqual(audio, [{"audio": "first-pass"}])
|
||||
self.assertTrue(plan["updated"])
|
||||
self.assertEqual(FakeUpscale.calls[0]["sigmas"], "connected-sigmas")
|
||||
self.assertIn("clips=1", report)
|
||||
finally:
|
||||
UPSCALE._native_node = original
|
||||
UPSCALE._continuum_helper = original_helper
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user