From c8568633a43892660ec74fb1e2bc70d21e5c94b2 Mon Sep 17 00:00:00 2001 From: Chris Dumas Date: Tue, 20 Oct 2026 17:04:53 +0000 Subject: [PATCH] Fix per-clip upscale geometry latent contract --- dumas_h3_upscale_nodes.py | 11 ++++++++++- tests/test_dumas_h3_nodes.py | 8 +++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/dumas_h3_upscale_nodes.py b/dumas_h3_upscale_nodes.py index 642cafd..68a6cee 100644 --- a/dumas_h3_upscale_nodes.py +++ b/dumas_h3_upscale_nodes.py @@ -315,6 +315,7 @@ class DumasH3ContinuumTiledLatentUpscalePerClip: spatial_param = _one(spatial_split_param, "spatial_split_param") outputs = [] + video_outputs = [] reports = [] build_av_latent = _continuum_helper("latent_from_cpu") extract_av_streams = _continuum_helper("extract_av_streams") @@ -378,6 +379,12 @@ class DumasH3ContinuumTiledLatentUpscalePerClip: if output_samples.shape[2] != samples.shape[2]: raise RuntimeError(f"tiled upscale changed temporal length for clip {index}") outputs.append(output) + # The native node returns an H3 AV latent (video + audio nested in + # ``samples``), while the Continuum geometry contract deliberately + # accepts plain video LATENT mappings. Keep the AV latent for the + # node output, but pass only the extracted video tensor to the + # geometry validator/update helper. + video_outputs.append({"samples": output_samples}) reports.append( f"clip {index}: {tuple(samples.shape)} -> {tuple(output_samples.shape)}" ) @@ -388,7 +395,9 @@ class DumasH3ContinuumTiledLatentUpscalePerClip: "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) + updated_plan = update_geometry( + _one(assembly_plan, "assembly_plan"), video_outputs + ) return ( outputs, audio_outputs, diff --git a/tests/test_dumas_h3_nodes.py b/tests/test_dumas_h3_nodes.py index 9ad7916..4d32bea 100644 --- a/tests/test_dumas_h3_nodes.py +++ b/tests/test_dumas_h3_nodes.py @@ -169,12 +169,16 @@ class H3NodeTests(unittest.TestCase): "KSamplerSelect": FakeSampler, "BasicScheduler": FakeScheduler, }.get(name) + geometry_inputs = [] def fake_helper(name): if name == "latent_from_cpu": return lambda video, audio: {"samples": video} if name == "extract_av_streams": return lambda latent: (latent["samples"], None) - return lambda plan, latents: {**plan, "updated": True} + def update_geometry(plan, latents): + geometry_inputs.append(latents) + return {**plan, "updated": True} + return update_geometry UPSCALE._continuum_helper = fake_helper try: node = UPSCALE.DumasH3ContinuumTiledLatentUpscalePerClip() @@ -193,6 +197,8 @@ class H3NodeTests(unittest.TestCase): self.assertEqual(audio, [{"samples": "first-pass"}]) self.assertTrue(plan["updated"]) self.assertEqual(FakeUpscale.calls[0]["sigmas"], "connected-sigmas") + self.assertEqual(len(geometry_inputs), 1) + self.assertIsInstance(geometry_inputs[0][0]["samples"], FakeSamples) self.assertIn("clips=1", report) finally: UPSCALE._native_node = original