Release H3 Continuum V3.2.4

This commit is contained in:
ukr8b3g-cmyk
2026-08-15 12:41:13 +09:00
parent 85c626cd3d
commit ec197341ef
26 changed files with 973 additions and 231 deletions
+24
View File
@@ -81,6 +81,30 @@ def test_apply_model_wrapper_repairs_payload_before_executor():
assert torch.equal(result["layout"].position_ids[3:4], result["layout"].position_ids[6:7])
def test_apply_model_wrapper_repairs_keyframes_with_audio_reference_without_continuum():
first = torch.zeros(1, 24, 1, 1, 1)
last = torch.ones(1, 24, 1, 1, 1)
audio = torch.zeros(1, 32, 2, 1)
payload = {
"keyframes": [
{"resolved_frame_index": 0, "latent": first},
{"resolved_frame_index": 4, "latent": last},
],
"refs": [
{"kind": "audio", "ref_audio_t": 1, "audio_latent": audio}
],
# ComfyUI Core 0.33.1 overwrites this list while processing refs.
"cond_video_latents": [],
"cond_audio_latents": [audio],
}
wrapper = _wrapper_factory(strict=True, debug=False)
result = wrapper(Executor(), torch.zeros(1), minimax_payload=payload)
assert result["cond_video_latents"] == [first, last]
assert result["cond_audio_latents"] == [audio]
def test_apply_model_wrapper_fails_when_actual_topology_changes():
video = torch.zeros(1, 24, 1, 1, 1)
audio = torch.zeros(1, 32, 2, 1)
+1 -1
View File
@@ -139,4 +139,4 @@ def test_v217_result_pack_expands_legacy_outputs():
def test_v217_has_no_frontend_display_controller():
assert not (ROOT / "web" / "h3_continuum_v2.js").exists()
version_source = (ROOT / "version.py").read_text(encoding="utf-8")
assert 'PACKAGE_VERSION = "3.2.2"' in version_source
assert 'PACKAGE_VERSION = "3.2.4"' in version_source
+16
View File
@@ -72,6 +72,17 @@ def test_timeline_prompt_maps_ranges_and_chunk_headers():
assert plan["prompts"] == ["one", "two", "three"]
def test_timeline_preamble_is_applied_to_every_chunk():
plan = make_prompt_plan(
mode=PROMPT_FORMAT_AUTO,
script="Refer to <Picture 1>.\n[0-5s]\none\n[5-10s]\ntwo",
chunks=2,
chunk_seconds=5,
)
assert plan["prompts"] == ["Refer to <Picture 1>.\n\none", "Refer to <Picture 1>.\n\ntwo"]
assert plan["notes"] == ["Auto detected Timeline", "applied timeline preamble to all chunks"]
def test_timeline_requires_coverage():
with pytest.raises(PromptPlanError):
make_prompt_plan(
@@ -148,3 +159,8 @@ def test_sparse_override_rejects_out_of_range_clip():
def test_sparse_override_rejects_duplicate_clip():
with pytest.raises(PromptPlanError, match="more than once"):
parse_sparse_prompt_overrides("[Clip 2]\nfirst\n\n[Chunk 2]\nsecond")
def test_sparse_override_rejects_timeline_preamble():
with pytest.raises(PromptPlanError, match="before the first"):
parse_sparse_prompt_overrides("global text\n[Clip 1]\nopening override")
+37 -1
View File
@@ -3,7 +3,7 @@ import hashlib
import torch
from ComfyUI_H3_Continuum_Join.constants import CONTINUUM_INTEROP_KEY, DIAGNOSTICS_BASIC, PROMPT_MODE_FIXED, V2_CONTINUITY_OPTIONS
from ComfyUI_H3_Continuum_Join.temporal import audio_latent_t, video_latent_t
from ComfyUI_H3_Continuum_Join.v2.h3_builder import IdentityAssets, _tensor_fingerprint
from ComfyUI_H3_Continuum_Join.v2.h3_builder import IdentityAssets, _tensor_fingerprint, encode_prompt_conditioning
from ComfyUI_H3_Continuum_Join.v2.prompts import make_prompt_plan
from ComfyUI_H3_Continuum_Join.v2 import sequence
@@ -19,6 +19,18 @@ class FakeClip:
def encode_from_tokens_scheduled(self,tokens): self.events.append(("encode",tokens)); return [[torch.zeros(1,1,2),{}]]
class ReferenceAudioClip:
def __init__(self):
self.tokenize_options = None
def tokenize(self, prompt, **kwargs):
self.tokenize_options = kwargs
return prompt
def encode_from_tokens_scheduled(self, tokens):
return [[torch.zeros(1, 1, 2), {}]]
def test_identity_fingerprint_hashes_full_resized_rgb_tensor():
image = torch.zeros((1, 96, 64, 3), dtype=torch.float32)
image[0, 95, 63, 2] = 1.0
@@ -28,6 +40,30 @@ def test_identity_fingerprint_hashes_full_resized_rgb_tensor():
digest.update(image.contiguous().view(torch.uint8).numpy().tobytes(order="C"))
assert _tensor_fingerprint(image) == digest.hexdigest()
def test_first_last_and_reference_audio_use_ordered_tokenizer_items_only():
first = torch.zeros((1, 32, 32, 3))
last = torch.ones((1, 32, 32, 3))
audio_latent = torch.zeros((1, 32, 2, 1))
clip = ReferenceAudioClip()
conditioning = encode_prompt_conditioning(
clip,
"Use <Picture 1>, <Picture 2>, and <Audio 1>.",
first_image=first,
last_image=last,
reference_audio_assets=SimpleNamespace(audio_latent=audio_latent),
)
items = clip.tokenize_options["minimax_ref_items"]
assert [item["type"] for item in items] == ["image", "image", "audio"]
assert items[0]["data"] is first
assert items[1]["data"] is last
assert "images" not in clip.tokenize_options
assert conditioning[0][1]["minimax_refs"] == [
{"kind": "audio", "ref_audio_t": 1, "audio_latent": audio_latent}
]
def test_v2_samples_every_chunk_before_any_decode(monkeypatch):
events=[]; width,height=96,64
fake_model=SimpleNamespace(model=SimpleNamespace(diffusion_model=SimpleNamespace()),model_options={},wrappers={},model_dtype=lambda:torch.bfloat16,model_size=lambda:0)
+62
View File
@@ -18,6 +18,10 @@ from ComfyUI_H3_Continuum_Join.run_storage import (
resolve_run_storage_name,
revision_identity,
)
from ComfyUI_H3_Continuum_Join.reference import (
REFERENCE_SIZE_MATCH_OUTPUT,
ReferenceAssets,
)
from ComfyUI_H3_Continuum_Join.graph_contract import (
CHECKPOINT_FL2VA,
CHECKPOINT_REF2VA,
@@ -311,6 +315,64 @@ def _sampling_contract(
)
def test_v322_golden_reference_contract_preserves_revision_identity():
model = _Model()
clip = _Clip()
video_vae = _VideoVAE()
sampler = _Sampler()
no_reference, safe, reasons = _sampling_contract(
model=model,
clip=clip,
video_vae=video_vae,
sampler=sampler,
conditioning_mode="t2va",
first_frame_hash="",
reference_contract=None,
)
assert safe, reasons
assert "reference" not in no_reference["global"]
for count in (1, 2):
hashes = tuple(str(index) * 64 for index in range(1, count + 1))
expected_reference = {
"reference_contract_version": 1,
"count": count,
"size_mode": REFERENCE_SIZE_MATCH_OUTPUT,
"image_hashes": list(hashes),
"combined_hash": "a" * 64,
}
actual_reference = ReferenceAssets(
images=tuple(torch.zeros((1, 32, 32, 3)) for _ in range(count)),
latents=tuple(None for _ in range(count)),
image_hashes=hashes,
combined_hash="a" * 64,
size_mode=REFERENCE_SIZE_MATCH_OUTPUT,
).contract
expected, expected_safe, expected_reasons = _sampling_contract(
model=model,
clip=clip,
video_vae=video_vae,
sampler=sampler,
conditioning_mode="reference",
first_frame_hash="",
reference_contract=expected_reference,
)
actual, actual_safe, actual_reasons = _sampling_contract(
model=model,
clip=clip,
video_vae=video_vae,
sampler=sampler,
conditioning_mode="reference",
first_frame_hash="",
reference_contract=actual_reference,
)
assert expected_safe, expected_reasons
assert actual_safe, actual_reasons
assert actual == expected
assert revision_identity(actual) == revision_identity(expected)
def test_clip_and_required_video_vae_are_part_of_sampling_contract():
clip = _Clip()
vae = _VideoVAE()
+99 -13
View File
@@ -10,6 +10,7 @@ from ComfyUI_H3_Continuum_Join.reference import (
prepare_reference_assets,
validate_reference_prompts,
)
from ComfyUI_H3_Continuum_Join.reference_audio import validate_reference_audio_prompts
from ComfyUI_H3_Continuum_Join.v3.nodes import _validate_reference_checkpoint
@@ -44,10 +45,46 @@ def test_reference_contract_contains_metadata_only():
assert not any(torch.is_tensor(value) for value in contract.values())
def test_picture_tags_must_match_connected_references():
@pytest.mark.parametrize("count", (1, 2))
def test_v322_reference_contract_json_is_golden_compatible(count):
hashes = [str(index) * 64 for index in range(1, count + 1)]
assert _assets(count).contract == {
"reference_contract_version": 1,
"count": count,
"size_mode": REFERENCE_SIZE_MATCH_OUTPUT,
"image_hashes": hashes,
"combined_hash": "a" * 64,
}
def test_v323_third_reference_adds_only_the_image_3_extension():
contract = _assets(3).contract
assert set(contract) == {
"reference_contract_version",
"count",
"size_mode",
"image_hashes",
"combined_hash",
"reference_image_3",
}
assert contract["reference_image_3"] == {
"reference_position": 3,
"shape": [1, 32, 32, 3],
"dtype": "torch.float32",
"sha256": "3" * 64,
"preprocess_version": 1,
}
def test_unavailable_picture_tags_warn_without_stopping_like_core():
assert validate_reference_prompts(["Use <Picture 1> and <Picture 2>."], 2) == ""
with pytest.raises(ReferenceConditioningError, match="Picture 2"):
validate_reference_prompts(["Use <Picture 2>."], 1)
message = validate_reference_prompts(["Use <Picture 2>."], 1)
assert "only 1 active reference image(s) reached the Sampler" in message
assert "generation will continue" in message
assert "ignored or hallucinated" in message
message = validate_reference_prompts(["Use <Picture 3>."], 2)
assert "unavailable <Picture 3>" in message
assert "generation will continue" in message
def test_missing_picture_tag_is_a_warning_not_an_error():
@@ -66,6 +103,18 @@ def test_reference_socket_rejects_image_batches():
)
def test_reference_image_3_rejects_image_batches():
with pytest.raises(ReferenceConditioningError, match="batch size B=1"):
prepare_reference_assets(
reference_image_1=torch.zeros((1, 32, 32, 3)),
reference_image_2=torch.zeros((1, 32, 32, 3)),
reference_image_3=torch.zeros((2, 32, 32, 3)),
output_width=32,
output_height=32,
size_mode=REFERENCE_SIZE_MATCH_OUTPUT,
)
def test_three_reference_images_are_ordered_and_contiguous():
assets = prepare_reference_assets(
reference_image_1=torch.zeros((1, 32, 32, 3)),
@@ -80,16 +129,53 @@ def test_three_reference_images_are_ordered_and_contiguous():
assert validate_reference_prompts(["Use <Picture 1>, <Picture 2>, and <Picture 3>."], 3) == ""
def test_reference_image_3_rejects_gaps():
with pytest.raises(ReferenceConditioningError, match="requires Reference Image 2"):
prepare_reference_assets(
reference_image_1=torch.zeros((1, 32, 32, 3)),
reference_image_2=None,
reference_image_3=torch.zeros((1, 32, 32, 3)),
output_width=32,
output_height=32,
size_mode=REFERENCE_SIZE_MATCH_OUTPUT,
)
def test_reference_image_gaps_are_compacted_like_core():
first = torch.zeros((1, 32, 32, 3))
third = torch.ones((1, 32, 32, 3))
assets = prepare_reference_assets(
reference_image_1=first,
reference_image_2=None,
reference_image_3=third,
output_width=32,
output_height=32,
size_mode=REFERENCE_SIZE_MATCH_OUTPUT,
)
assert assets is not None
assert len(assets.images) == 2
assert torch.equal(assets.images[0], first)
assert torch.equal(assets.images[1], third)
def test_reference_image_2_alone_becomes_picture_1_like_core():
second = torch.ones((1, 32, 32, 3))
assets = prepare_reference_assets(
reference_image_1=None,
reference_image_2=second,
reference_image_3=None,
output_width=32,
output_height=32,
size_mode=REFERENCE_SIZE_MATCH_OUTPUT,
)
assert assets is not None
assert len(assets.images) == 1
assert torch.equal(assets.images[0], second)
def test_unavailable_audio_tags_warn_without_stopping_like_core():
message = validate_reference_audio_prompts(
["Perform <Audio 1> and <Audio 2>."], None
)
assert "unavailable <Audio 1>" in message
assert "unavailable <Audio 2>" in message
assert "generation will continue" in message
def test_connected_audio_keeps_unavailable_extra_tag_as_warning():
message = validate_reference_audio_prompts(
["Perform <Audio 2>."], object()
)
assert "unavailable <Audio 2>" in message
assert "no <Audio 1> tag" in message
def _reference_prompt(checkpoint_name: str) -> dict: