Fix per-clip upscale geometry latent contract

This commit is contained in:
2026-10-20 17:04:53 +00:00
parent 15d3247fff
commit c8568633a4
2 changed files with 17 additions and 2 deletions
+10 -1
View File
@@ -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,
+7 -1
View File
@@ -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