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
+15 -2
View File
@@ -1,9 +1,22 @@
# Changelog
## 3.2.4
- Added native MiniMax H3 Reference Audio 1 conditioning with deferred Audio VAE encoding.
- Matched Core's permissive prompt handling by warning instead of stopping on unavailable Picture or Audio tags.
- Matched Core's dynamic Reference behavior by compacting active image inputs into Picture 1 through Picture N.
- Kept Sampling, Continuation, Spectrum Interop, external Core VAE Decode, and assembly semantics unchanged.
## 3.2.3
- Formalized the third ordered Reference Image as a compatibility-preserving extension.
- Kept V3.2.2 zero, one, and two-image Reference Contract JSON unchanged.
- Added Image 3 shape, dtype, exact SHA-256, position, and preprocess metadata only for three-image runs.
- Added Golden Contract and Revision identity regression coverage for V3.2.2 saved runs.
- Kept Sampling, Continuation, Spectrum Interop, Core VAE Decode, and assembly semantics unchanged.
## 3.2.2
- Added a third ordered Reference Image input to the production sampler.
- Required Reference Images to be connected contiguously from Image 1.
- Allowed Ref2VA, FL2VA, and unverified checkpoints with Reference conditioning.
- Kept checkpoint classification as diagnostics without automatic MODEL switching.
- Kept Strict Compatibility for genuinely unsafe or unsupported H3 contracts.
+98 -96
View File
@@ -1,99 +1,101 @@
15b900d02624bea6cfe8ea25b22266a0c68b38b9f10c9089be0e38988bf2e34d .github/workflows/tests.yml
005a9f489a05bb1d045aa133873bf9113f47afa26435741e50f5c61185a4ce88 PACKAGE_INFO_JA.txt
0231d83c6c83e7989e82f6bf116990ded6a0aee4c9408682da039976996da7e0 v2/sequence.py
0325a148383eb0149cc2c1e652278061b9f1d3efc55c630252920a51902d15d3 examples/v2_prompt_timeline_example.txt
0495ed6f101c15b20aad15b151dff5ab9247b3f11cd9f02f99224f8924863934 public_api.py
07b22bc2219a5a07e3c1f48720d28b58310b16ed391c775e402c3ef032d81891 v2/seeds.py
0a2f69d4cec89d440f5d5aa1ec68a7c9a741382d313f80dcddf96d13f70b3e68 .gitignore
dca65fb1393e67f59c6f81f9411e3e745eb8f1097e9a2adf7ffc6f4e3901ca9f __init__.py
0005be4e1e56a88d5b2168dc3fe203d5f87944922aa400d87e8c840805d2a4e1 AGENTS.md
a972808d70077d202aece2dd6f1d6a2eac82ff46e58d039ec255d381c0fe315a CHANGELOG.md
7dbbc8ce1018d6ac07c53eaa40f2d8d144babf9c6fe6bd94b7ec1d08adffa215 compatibility.py
707884ea5ec950165044713ba70f54ce721470cab86821fead5259120ecbe66a conditioning.py
71e3df269e226b1ecad597f9831c2a10b2215c8a3783652e9e9f536e99ce46c9 constants.py
11877692d4aadea79ff35d4d5035457c26ac2ace7443889ed3fd7ee51e99a103 continuation.py
fcc80c5630103986b26a3f8cc07cf52ffb92fd6e72158962b1a61c01bf7adc93 docs/AB_TEST_LOG_JA.md
c93a3e52e4deabe5ef0db7f34a7605856a543089574ba17227e697e9a2c0139a docs/ARCHITECTURE.md
7660570840229b6fcbe62f0fbb52966d0099d64d7e6f01a739fbf9899293c8e4 docs/FUTURE_ROADMAP.md
6c72d9a9e35648355c4dd4c8f060a6b7667e322f4b6c86690df9d6769ba182b7 docs/images/h3-continuum-advanced.png
b9f1dca35706a1cd963ba892d218568ea30173c6cf6a3bdc896f7a2266eb9407 docs/images/h3-continuum-detailed-report.png
de5f8fbce6bc423817acf7dc86bb0c8805a1fd962afdb2722cde7395f117eb56 docs/images/h3-continuum-image-scale.png
a384e26f3b088607c616be1a2b038365147d92da0961d8f47060fed09f795062 docs/images/h3-continuum-sampler.png
759d18e15e0cf139630259db38123a824be565ec844a3d7ac020b74ff8537b25 docs/images/v31b-auto-resume.png
0c785a5d73e580412f4efe11a74d6fb1c994d7bbb61cf9996a35fb3b6cbb40d9 INSTALL_JA.txt
0e137a53e0e9b55988b99b5b878c39e781a5badb2cd33f4c01e2a5cb691f2b67 examples/H3_CONTINUUM_V1_WIRING.md
0f53a1a5d7eb9255e2995f13eca6db4a7b2c68df627f99f62a90d052a68182a1 __init__.py
0fc055fbccfb68fce47003ea65ce11dc928390d2e6e3b51233bcb78f8ec70e2b v2/sampling.py
105ab14949f1109cb5684966e0a66f7da9b1a47166f62ee7dd184cf1040c550c README.md
126eb02821934c6f9705eae52b7428d27e7794055dcee70b16ab9154f3d1c83a reference_audio.py
13a3e8ff421598ec9a911013fd888b6a2f4ec91ce1f02f3fa661305e7abea9a5 examples/H3_CONTINUUM_V2_WIRING_JA.md
19b90e4475f95d28e044d095159373845cac0742fa76a6e4ab13fc8f5e308f7a v3/plan.py
1a5e41cde58d1d206d6282b091c471b39c95821f071a9cbad8140f1f381f38f8 PACKAGE_VALIDATION.txt
1b46fd43907313502000f9a280fb24c3f83e72851f7b97f3871b9bd280df095d v2/__init__.py
1fa97d86da61149116dec41e836dda8cab32e341fe79414bddde6c0be36cd1cf tests/test_v31_run_storage.py
281dd6bb2575599f7dbaf6963a81ac7efb2f54fc17b959493a70b3bc54a80d12 tests/test_v32_reference.py
28698932a455a6b55fad2d4a112e7bfae4b4c9014a8c745b6b8409a73f0aeaf0 v3/nodes.py
2c13aefd137db92a3dbf5576e9442d58012b1f0de1240c07d039ceeb702e7c1f docs/V2_1_4_UI_SIMPLIFICATION.md
b08022df068576c759c8bf80ac6b6519693f3c65c917f1822aeb06ea359aa5b1 docs/V2_1_5_UI_SERIALIZATION_STABILITY.md
a032738b0bc5acb136e92d8bf7694643a5f518b9c7fc0fc878d66d81ba8b1b04 docs/V2_1_6_UNIFIED_UI.md
f0806bb2b999794ddda072e98424dbd1b613df1cd8a096b12d979f124e066d8a docs/VALIDATION_JA.md
6771c9905d35666121c4892d2ec26202505f96d244ce814ad9a87a02878952cd examples/H3_CONTINUUM_V1_WIRING.md
20f4e7c4ad085791f8b578f575d03e52ef09d0d4550aa58ad086c9857b59bf29 examples/H3_Continuum_V2.json
f67febfdd7b2bfca2ad4e477c87a9a74dbe636231f9db3e1158b944d7b9f8397 examples/H3_Continuum_V2.zip
f85ba3c69a473f0ac4bb96895c6d6532e8270121da65f858e364b19d31f05ef5 examples/H3_Continuum_V2_3x5s.json
be419d6c773784823af7b58a3423ef2e21d3cc3e23c40e60e274560895ca034b examples/H3_Continuum_V2_README.txt
2cc55f3515ead2e995105860e71d3e3e3db773a2e1a613f00d5c64f3234ddea9 tests/test_state.py
3863cee9af539439595e1a6845460a8a7fd2679bf5186b2a822ee9348ed05ff7 install_windows.ps1
3b1b0fedde7eab33481d1083287cd68b78dae80d845dee7588454f85e2c950f6 tests/test_nodes_logic.py
3f76c2ca2572b576ecf3d8410c208dba686a4b2d8d10aa1acef6bee092bbe37c tests/conftest.py
3f770f75efbd83f878aff30c41a4a0eb9d469c12887b73b4989f61d92602009c v2/prompts.py
3ff0f8c3752c814fc59f0b9f20ed1558f69623810e71f633708ed8623fbe8452 hardening.py
44ec8429eb3fdeda8041a991c10475b27b91e8ed034d4e8ae301d60d80c8d9bb examples/H3_Continuum_V2_3x5s.json
4966a5ad0d418e85cb2bbf22d322915dd1fc4bc6848effce0977cbd83482a35e model_patch.py
4b94f779a98bfc555f6999113a694da07746cc3cf400bfc70ebc580592034d52 examples/H3_Continuum_V2_reference.webp
c3cefcdf50df9d6609f583a008453b587c011a0fb41e290d5f1196ce62f58877 examples/H3_CONTINUUM_V2_WIRING_JA.md
68e1a724d3b99458b86b8f643dcb916183e7e8dd12d7b4b3850991feb8077694 examples/recommended_settings_v1.json
5a26408c770381cdb259cb710de7dab12d7ddecca262bdbf35ba1566056050f5 examples/recommended_settings_v2.json
b8275c8cecde12aee0418cea456d1e7f4b875cbb1bce32f1f3d9e06a44dd0be1 examples/v2_prompt_list_example.txt
0e59ea821081cb93165aa3f88c6949736dd225837fe1cdcf1173aa5cd54c6d29 examples/v2_prompt_timeline_example.txt
c88e4d4c86c4e9af392c959365fee24d7593e92f69df9acf7e36117536a5f335 graph_contract.py
3d57276669e4ce95f8537c67c6437250b52dd843ee0817c2e262018ead200107 hardening.py
6abdbc29472c7f9d447085b189fc47b69e110b94ef83192f9689d04000408843 INSTALL_JA.txt
23bddc5a41d2e997f4fbf789c7128e32f4f197f1405b2aef1c76794f57482446 install_windows.bat
d74073e7ee292ebeba913af4288284f9f197cd91fceed6c62bf6c66b784c7cec install_windows.ps1
6b43294ebf00fde03acc3f2ac52f841f3c4323085c21643aa075a347cf4a432c layout_adapter.py
15fd1cdc62ffa959b49fd5088bdb1d4b5fa406fa8e420de64603e86458a1a3b8 LICENSE
d3e213005670e94dee33a240349a4d245cf9a3b6602099f11ed30cf5a32e2c21 media.py
0220d75e8fc144cfac246793fdcd7f4a99008141b17042dacdfdd8b3a593f6fa metadata.ini
49424eff88b42967e3fc0b80876ecaf5b90626d38dc740c6124f9cb8bd1d1689 model_patch.py
dcaf662210b2329ccb4478dad2430d66eae2033b8925afb312e07e6150d394e0 nodes.py
f1d6ddd86332845273cc8d29ea9f9b6b6595aa59cc3fa8df4d6f51888b6058ab PACKAGE_INFO_JA.txt
ca16f3c525c4aa67f56024e974a86401c5aada9dd43a9ac89f21bc982103c57e PACKAGE_VALIDATION.txt
b470819f16fc179654dc1600721a63f0a5a14e777f4c004d574b499da6886ba5 public_api.py
e188830c44e79e21291b7906111c605ce1b8869b748fceb6fc52a64cb7b1de24 pyproject.toml
94fdc2d545b2d4077a4d70229fd22ba3ccac21d49d1097d2873f76d04e9a3c7a pytest.ini
c24308595d82e5547996b8e832b747c2032369df38955302c58e2fba8ac7dee0 README.md
d406a9ce3446fae4f30810e8fea09d5b70c3bd027afbeecd67f007e8863998be README_JA.md
49ecdd355bcda1c8ae12b4144af531e4685a07150dbc188995970151d030e55a reference.py
467edb2c188d024c2392aafe7423b3f835e16b10f570da76e2f7dda8a962c1c5 requirements.txt
3ca3efdb3b370fa95bdad2aef35b9d34b256c66a579849bd35f6e4f5999b3089 run_storage.py
3a359a0467725cc292ccb4c86cf0c3d30bb6a114d01f5345792b09ea3d45441d state.py
6056de6c0a5322a8a51ba5a114538dca2ef67788cd1afba10fedd483b95f6afa state_io.py
43ec4023dc06c941e5d7a04db4b8a89fb58d744ceb986f6eb9bf534d4fdcb87b temporal.py
3eeed61b7ee519631825e5f89e9a441644c66e552fce4207927cb8536867c8b1 tests/conftest.py
041289556cc621ea1857cbb8931ae41d817f69e084b2e8a7622e184a3197b61b tests/test_compatibility.py
7a1138fa8619247787039ddeb2f3692ba1f680b4553a13e472fadfbea1c88d07 tests/test_conditioning_modes.py
e6fecb17e373333b315f0ce89e8dda3bda9dfdd34dac2656ae8785d26256c422 tests/test_layout_adapter.py
e0d5d75bbdfafd5f31fe773b92dc65d57451edb8e222d1a9871a92713b395f0f tests/test_model_patch.py
45e8839cd82fd955df344b3bc6efa20092b8870ea378b0c898b073665d3e47d7 tests/test_nodes_logic.py
1ae0369943ba2fb13f21ad0cf56ee58621ba09bf20174379595e157a1775c7fd tests/test_public_api.py
98a33c75b33ff0c10a68e04bd856e4e43b3e70b6ae1ea458a2b21b4e4d74f46d tests/test_state.py
d4c53d2c260b635d70fa211029d608f63776e0a56c20253475fa47c58363f8a7 tests/test_state_io.py
58c06925ccf06c4feee19b927b3515c540c0536aa5f3f8d29be35b8e919915a7 tests/test_temporal.py
912661d91c7f11f5fcaf0bd14d7d3ecf5c74c33b1507272f0ae72af6e5bffa6f tests/test_v2_decoder.py
bbbd655731cc69414aed8bef59e236e17ed4cd891a40114e490a4804f2f96fff tests/test_v2_prompts.py
5dfdd4b108ba7444c0f5f371c3b1e244b5735d23136127b9818fd60738c78b68 tests/test_v2_registration.py
0a520b34b12e1d2556d50480c43318de7eab4221afb96ef4760127c8bc90c890 tests/test_v2_seam.py
74e623120a963cb96b68651b44f47a836ea8449d30ce89d749c71ffad4766d4e tests/test_v2_seeds_motion.py
91a45db5cdcf9b96e34e264ffd23b20ed6c10c57dc8d401d130bd0c231371219 tests/test_v2_sequence_orchestration.py
0b5b20a8318862d167f135720e0489b8d4f93406d67c6646e052e35b03dcb876 tests/test_v2_session.py
58438c3ed814adf40cefde098a37cae00ddcb703b7e5548bbbb295e54bed5a6d tests/test_v2_widget_migration.py
4628d862851fb5d0f849da9262be961102ab83545f00fa435dd2495bcb4709e6 tests/test_v217_stable_facade.py
78bc478a5e4edda902c80849c911782a99e75c06dfb04127391b6cc5b27b28e1 tests/test_v3_hardening.py
abc80b8727901eaa2d8dee2284ac07cd7ea3d1eb7aad3df1b67ce4fddd4371dd tests/test_v31_run_storage.py
1a5c9e81abebd71fb6004153710c7a8ed459a9da763b9027de4562d2da25a488 tests/test_v32_reference.py
0dbe8a5f71c92f3523942343b40787104c8b96781461ba3ba82934a6bdbe5834 THIRD_PARTY_NOTICES.md
aa9cd295b3762df2f367a8d51247351c803e7507bddf8fe6bb29e7809878b845 tools/verify_runtime.py
ffd61f3f31c9b6430e1169007ee906c8f5000eba63ee44e2976ad4f5f1112671 v2/__init__.py
cde27db19b677e318cc4dfb4235be7a11429c19945f4083052a91fe117e74c82 v2/decoder.py
31012ec48a64c7467ad869c79982b7f8502c1785c33f51ee1b5727ce8b4243fb v2/diagnostics.py
10bbdf1f39b625cea448363aba908868d2106f960efd71115e037ad5f1e24c09 v2/h3_builder.py
aea01a48a8c03a25ed97ea05e5b137f89e388832d1be7d38f2da2be3d1b9830b v2/motion.py
d758281825cc50ff386b3b6adbc47b4dca2e3aadb2a31924e82aa7f748f76e49 v2/nodes.py
cfab4847c2fd53b507081ee21724e7120666b52d1b98d159717ad54d1ca8fd9b v2/prompts.py
4080f1875b958b316e8e76852c4be5527a6de5c71d604e7642d3098478eb4a36 v2/sampling.py
2fd811794c4cc0f2ce050250b80484876454926b9f20fce6af3a97d728e5acdf v2/seam_guard.py
be0d8585fa57e0ccd6d02577bbc7299629e5bfe20e186747f571fccc98b67d7e v2/seam_types.py
12cfcc0c71ca087fe39a5ce2922959a62b2bb311bfe664f05c4480affce03708 v2/seeds.py
e7aace33b4ea7c104f7883814841690175556cb3ff25ff21eb7c3401eedb5742 v2/sequence.py
b708599c0f6ffba4556e77536558a415104b0d4c1d043f335197bfb6960f07df v2/session.py
13213e7709fd02bb810af3c18e4cd7d010f8cdfb121a4b99866a9f2333331089 v2/session_io.py
78c830cdf49034c6e3b2cd3da5914d5cfc5638eb63ec6dbd1bab13c50d6d4caf v3/__init__.py
9cdb682168cea0cd4bb2e8ce69d043ddcbdb9204901035e6ccabad112e77f81a v3/assembly.py
5465896b8651fca4feab299579e167849624c17732139b9ae220710873a68483 v3/nodes.py
66bd67c9ec7d8a7f32c7d1c1fc4ce1c19b42fda5d7cece67b171c3cffc49f0a8 v3/plan.py
4085160d48172468901b9c0fd1229e97c3328ef1870071c2c8d0e4e7ac056e6e version.py
4bae91bc67424a624284ce66e0ad7b46405f29ad0d8fa0a9ece022bc579fcf22 tests/test_v2_registration.py
50002913dbdd9e5c4f6d829f8d9fcd0db722b1a29c0c9d5a1d0acc2d164ef22a nodes.py
5f9efc258766026335c68e19f82b4b9b22eed2c726fb2688c4051049ec249adb tests/test_conditioning_modes.py
60324fa752c9fe6ab62f438a1b51a9b6dd69ada06a766ed918d04ae44177542f tests/test_compatibility.py
6184b2c556ae3bb0d7d66a64de6f1141b5b18ec06690c5ca675793db7dd90130 v2/h3_builder.py
6282c00026bcb037334bccfaef4dc0b78290217259e33937280ef25969be7694 media.py
6352ac01988258827f0bc1c02aef72a480b3e6fd778d08dc676b766bceb3d8f3 temporal.py
669e7ca672787cf1b3123d782bc3a490a38fccdc6b930aa61ca6035e437f32fa compatibility.py
6952848cb0bbc9ee10345ea11da194ff7f45f89831fc2e52415aea1deae2d766 v3/__init__.py
6b6a53cd194106fbfcb361982dc540295bed6e50906dbc16905c7952bcea7715 .github/workflows/tests.yml
6c72d9a9e35648355c4dd4c8f060a6b7667e322f4b6c86690df9d6769ba182b7 docs/images/h3-continuum-advanced.png
6d499741672f3c89f7c8be333a43c59f1a3566f337b43f1eea0f24f7143f2269 docs/VALIDATION_JA.md
6de0c7707a984cc7ea85b40828b51f5336e38da1a573765b21e559a773d38ec4 tests/test_v2_decoder.py
71f309caaefd0369e3119d9d9d3fcc3c01bf384d0a592a35154550d2c01e9aa9 tests/test_public_api.py
72d04aa69d2e5ff59e49474a46216d82ec1ee306fd6f1636f16ab9694cc33199 conditioning.py
73fd177175fe5bea56e3ae155bbac38e1074b18d965471bdb4066b9829a45ee8 examples/recommended_settings_v1.json
759d18e15e0cf139630259db38123a824be565ec844a3d7ac020b74ff8537b25 docs/images/v31b-auto-resume.png
76dd5b508f49117e0cb630b94d461b2dd9542422c5ed3f17a43547a744d8b3e9 web/project_id.js
7970577a28714fe30257c58a08dba11ada91409890026bff79d665a6794fcc34 v2/seam_guard.py
7efb2d407235d35584c51b8e5cd17a90ccbb0a69b55724934a18dc1ad7deb35b tests/test_v2_seeds_motion.py
82f9d2821f5817f19f81fc99b0e40faedbf4f50e290d5bba4dcb8940a4d5ff46 tests/test_v3_hardening.py
83fe13510d33f7c969be9c1567d8772918fa5db98109301b892949b20265e5c8 tests/test_v217_stable_facade.py
84abee7d851a2811fef650517de97046ab68bd54ea57e92c6b02ae872118df45 AGENTS.md
8989424d3f29495f0a9b1f3a8cde566e0ba2924e7b0ef70ad57f9532e9b350f2 docs/ARCHITECTURE.md
8b99389eac85f19c586a15be4a7e57e41d92952975c044b4c740b23c5b2cc9bb continuation.py
8df510b8e6b7a7a7932341bb3f671ed16ed6bfa46f3638ce916ea850ecc0a582 metadata.ini
952a5b34b813f23b9ccbce08e3031623a324e37b6b85bc6a6cd03428017f8ca0 tests/test_state_io.py
95fd9fe54a72c6e1f969f0edf75d848ecef9bedbba8a8f4b780affab25218bd1 tests/test_v2_session.py
9620c7a5fd4088c295fb7e83dabf7fefb74f34453a23b9d036be357ddf7d7fbd v2/diagnostics.py
9c1ef010f6f3e633ffa941825f7127ad7eb3667f703a4c1ee6160307a00b0575 docs/FUTURE_ROADMAP.md
9cdbb329126ec229a99032378956476f0669c3e73f26f525e9ae8d701cf51468 state_io.py
9dd85d382ee8e5961de7a142083ba4d92a7be993bb5c74ce1a9d4ed8ded4ba64 tools/verify_runtime.py
9e53a0159e6f73379d2cd2e7878ef3e37e9e0abdf89db26b996ef3dbcfed832c v2/motion.py
a3356ff0ba0ef90d7c3a428e432e462d7f02d2809e7bac15b4589e0071d84caf v2/nodes.py
a384e26f3b088607c616be1a2b038365147d92da0961d8f47060fed09f795062 docs/images/h3-continuum-sampler.png
a43a7902ca7cba0bfe9b4abc2972609d5f18c6f589f94e6689bbeda5bfd6437d tests/test_v2_widget_migration.py
a536f0d76da0c581052357bcacc7b5f899674dc4cd29063fdac4521bd9bc469c constants.py
a595e16cb9a4d516fbea7099ad32d81e1e645ea249d4d5d607f5886173fb38d6 tests/test_temporal.py
a6cc48c22fb4c06813193e3f085bf164964590abb48c0a531960108e196f4467 THIRD_PARTY_NOTICES.md
ab417534fb464448d3eaf2cf42956ded01dbf0fd8885f5560d75352def87adf0 examples/recommended_settings_v2.json
b08022df068576c759c8bf80ac6b6519693f3c65c917f1822aeb06ea359aa5b1 docs/V2_1_5_UI_SERIALIZATION_STABILITY.md
b08e835b6072f6ec7d7f865caf5c48d4f5d2d9bfaec297edddbfada773b003f2 v3/assembly.py
b42bcc0983147462d96c6b71cc4a38e846995dafa6eebefc3ae0d9bb36caf359 tests/test_v2_sequence_orchestration.py
b9763db5d35b050cfde4277455f400b1ce4b6dcd4ea741010cbf6096224d74f2 v2/session_io.py
b9f1dca35706a1cd963ba892d218568ea30173c6cf6a3bdc896f7a2266eb9407 docs/images/h3-continuum-detailed-report.png
be419d6c773784823af7b58a3423ef2e21d3cc3e23c40e60e274560895ca034b examples/H3_Continuum_V2_README.txt
c24a22cdd1b68c9d63c295388e7ee41634a3cdb33802bc8e5ae540cc0287da00 layout_adapter.py
c44abbd789091bbead01250dbd5453e60539d2665c69f162335fdbd2936019c2 LICENSE
cc10fe2b12ad9d48e1f317c50feeadc2c073f41a351c8f91bdc6079a580bff9e pytest.ini
cd8e059b0b4044cd9a75024180e7d451b92c92bf976c2bd728da50b8c004da32 README_JA.md
d19aa88f2d18364f4491c45103cf9253c79444b9f5a468f67f8df072a9435757 v2/session.py
d2051ccab0719109e0c9dc462a980e4a2a8fac66e6303dd0b382d4a93f401471 reference.py
d6188024020df3d1b11d167f8ac6314e85a9a1e82497163a4d719293fdcc0edf docs/V2_1_6_UNIFIED_UI.md
d8e27403eee31a76ece5d5eff6ecd4afe38075e2cc2e0c8e30417a9b230abf28 examples/H3_Continuum_V2.json
de5f8fbce6bc423817acf7dc86bb0c8805a1fd962afdb2722cde7395f117eb56 docs/images/h3-continuum-image-scale.png
def458d0c49751ccbe2b0aeb30a40a9b6e9eaabd81970ea952cfa0f4cab070c7 pyproject.toml
df08be64f7797f3b010c0bab0205c7d333700ea571ffd9762ebea3b2c231ff5b requirements.txt
e0b097add215d5c10b17e8e49e270d35bc4bddd04c2b89d1f1cc40d8083c0295 tests/test_v2_seam.py
e480c599daf0ede07bba8b90efbae627461c1797a5ebacf228630fd74ebc48d4 tests/test_model_patch.py
e50351dc9eb62782689f1e6bad277b73075b795e6f988d3ab0d0a4af82a14517 v2/seam_types.py
e5747a6c4bd05952f374c01e9c9fb3f11c01076f8fc2ab6e71c5331c3860a657 v2/decoder.py
e972b4b70f75b7df6fb2b12e568a8c3c56eb07cf841ea625ae55e429ef95123c version.py
e9d20ba270238aec135b09887c12c4cd10eb529a4db384918440838bbbf0e0d9 graph_contract.py
f10eb289241953fe73655d1de11024189783c0a01617da70eaa692ca6622a6d0 run_storage.py
f14f2bc22e8aa991754958f6e62a2eda33165d58cb46df24120cb010e167ca0a CHANGELOG.md
f67febfdd7b2bfca2ad4e477c87a9a74dbe636231f9db3e1158b944d7b9f8397 examples/H3_Continuum_V2.zip
f728507d2dda7af8b5b0e0e2202562d34d277d9d0f9a797fa11985f5e6ac9e1a install_windows.bat
f9375629fa1a2c4d3538442f0c3192d7ba2f46fe9544fb2e21f0c144b53d608c docs/AB_TEST_LOG_JA.md
f9f9802311e6788c25391ae5912e51f5a6d81af811dd73eb591afe43e1e5dccf tests/test_v2_prompts.py
fade1ac8052ab4489fd54a84b97cb86dfe53ce09a87f26a33ede0bdc1d02915c examples/v2_prompt_list_example.txt
fbbc427966fe3209c6626c411642c3d9e0f2269439c2199d1b71f8bdd08e43e7 tests/test_layout_adapter.py
fef27434ee52c0ce5101f17e2e04d1279474991625e2e855e0adcef76e5bb763 state.py
+15 -26
View File
@@ -1,30 +1,19 @@
ComfyUI-H3-Continuum 3.2.1 - Stable Package Validation
Date: 2026-08-14
Status: PASS / Stable
ComfyUI-H3-Continuum 3.2.4 - Package Validation
Date: 2026-08-15
Release hardening scope:
- Graph + runtime MODEL/CLIP/VAE sampling contract
- Chunk file SHA-256 verification
- Run Storage automatic ID fallback and Storage-only partial regeneration
- V3.2.1 Windows installer/runtime verifier
- Explicit CI numpy/safetensors test dependencies
- Up to three active Reference Images compacted in Core connection order
- Reference Audio 1 with Core-compatible non-fatal prompt tag handling
- V3.2.2 Golden Contract compatibility for zero, one, and two images
- Three-image-only exact Reference metadata extension
- Unchanged Sampling, Continuation, Spectrum, VAE Decode and assembly semantics
Completed automated validation:
- Python syntax / compileall: PASS
- pytest: 129 passed
- GitHub Actions: GREEN
- Local package sync: 100 files matched, 0 hash differences
Required automated validation:
- python -m compileall -q .
- python -m pytest -q -p no:cacheprovider
Completed Windows runtime validation:
- RTX 5060 Ti 16GB / ComfyUI v0.32.0
- Ref2VA Reference + Continuation with two images: PASS
- 3 x 5 second generation at 1056x608: 0 reused / 3 generated
- Stored manifest complete, resume_safe=true, three Chunk SHA-256 values matched
- Complete Auto Resume: 3 reused / 0 generated
- Spectrum Continuum API accepted Actual Prefix 2 on continuation chunks
- FL2VA / Ref2VA, Prompt, resolution and Reference changes created distinct contracts
- Strict FL2VA + Reference and non-32-multiple resolution rejection: PASS
Release decision:
- V3.2.1 is the current stable production baseline.
- A GitHub tag or Release remains a separate publication step.
Runtime validation still required before a public Release:
- Ref2VA with Reference Images 1 + 2 + 3, 3 x 5 seconds
- Chunk 2 and 3 each accept Spectrum Actual Prefix 2 exactly once
- Three images remain persistent across every chunk
- Save + Auto Resume reports 3 reused / 0 generated
+9 -7
View File
@@ -1,8 +1,8 @@
# ComfyUI-H3-Continuum 3.2.1
# ComfyUI-H3-Continuum 3.2.4
Native long-form MiniMax H3 video and audio continuation for ComfyUI.
**Current package:** V3.2.2. It extends the validated V3.2.1 baseline with a third ordered Reference Image and diagnostic-only Ref2VA/FL2VA checkpoint classification.
**Current package:** V3.2.4. It adds native Reference Audio 1 conditioning, keeps up to three ordered Reference Images, and preserves no-audio V3.2.3 Run Storage contracts and Revision IDs.
https://github.com/user-attachments/assets/bfa8c683-fc9d-48f1-9cdb-477ca110cdf2
@@ -15,7 +15,8 @@ V3 delegates video and audio decoding to normal **ComfyUI Core VAE Decode nodes*
- Raw paired video/audio latent continuation without decode/re-encode between chunks.
- One production sampler UI with normal controls first and infrequent controls marked Advanced.
- T2VA, First Frame, Last Frame, First + Last Frame, and Reference conditioning.
- Up to two persistent Reference images across every chunk.
- Up to three active Reference images across every chunk, compacted in Core connection order.
- One native Reference Audio item across every chunk.
- Disk-backed Run Storage with automatic resume and compatible Revision reuse.
- Fixed, List, and Timeline prompts through one Sequence Prompt input.
- ComfyUI Core Video/Audio VAE Decode and a separate Continuum Assemble stage.
@@ -53,7 +54,7 @@ MiniMax H3 Video VAE -------------> video_vae
Sampler --------------------------> sampler
Sigmas ---------------------------> sigmas
Text (Multiline) -----------------> Sequence Prompt
Optional images ------------------> first_frame / last_frame / reference_image_1/2
Optional images ------------------> first_frame / last_frame / reference_image_1/2/3
video_latents --> Core VAE Decode -----------+
audio_latents --> Core VAE Decode Audio -----+--> H3 Continuum Assemble V3
@@ -76,17 +77,18 @@ The sampler selects the mode from connected image inputs.
| First Frame | I2VA + Continuation |
| Last Frame | Last-frame-conditioned + Continuation |
| First + Last Frame | FL2VA + Continuation |
| Reference 1, optionally Reference 2 | Reference + Continuation |
| Reference 1, optionally Reference 2 and 3 | Reference + Continuation |
Reference images and First/Last Frame are mutually exclusive. `Reference 2` cannot be used without `Reference 1`.
Reference images and First/Last Frame are mutually exclusive. Active Reference inputs are compacted in Core connection order; bypassed sockets are ignored.
Reference Image 1, 1+2, or 1+2+3 may be connected. Gaps are rejected. **Ref2VA** is the reference-specialized checkpoint and may provide stronger reference fidelity, while **FL2VA + Reference** is also allowed. Checkpoint classification is diagnostic only; the sampler never switches MODELs automatically. **Strict Compatibility** remains reserved for H3 contracts that are actually unsafe or unsupported.
Reference Image 1, 1+2, or 1+2+3 may be connected. A single active image is treated as Picture 1, and active images are numbered without gaps. **Ref2VA** is the reference-specialized checkpoint and may provide stronger reference fidelity, while **FL2VA + Reference** is also allowed. Checkpoint classification is diagnostic only; the sampler never switches MODELs automatically. **Strict Compatibility** remains reserved for H3 contracts that are actually unsafe or unsupported.
Reference prompts should identify the images explicitly:
```text
<Picture 1> defines the subject's face and identity.
<Picture 2> defines the subject's clothing, body design, and skateboard.
<Picture 3> optionally defines another ordered identity, object, or environment reference.
```
Reference images persist across all Continuum chunks.
+8 -2
View File
@@ -1,8 +1,14 @@
# ComfyUI-H3-Continuum 2.1.7
# ComfyUI-H3-Continuum 3.2.4
MiniMax H3を複数チャンクで連続生成し、直前チャンク末尾の**映像latent / 音声latentを直接**次チャンクへ継承するComfyUIカスタムノードです。チャンク間でVideo/Audio VAEのDecode→Encodeは行いません。
## V2.1.7 Stable Facade UI
## V3.2.4 Stable
V3.2.4は、T2VA / I2VA / FL2VA / Reference + Continuationに対応し、最大3枚のReference ImageとReference Audio 1をCore互換の順序で扱います。First/Last FrameとReference Audioを併用する場合も、Tokenizer側のPicture/Audio表示とDiT側のKeyframe/Audio conditioningを分離して処理します。Run Storage、Spectrum Interop、外部Core VAE Decodeは従来どおりです。
Reference入力のバイパスされたソケットは無視され、有効な画像だけがPicture 1から連続採番されます。プロンプト内の利用できないPicture/Audioタグは警告として扱い、生成は継続します。
## Legacy V2.1.7 Stable Facade UI
V2.1.7では、V2.1.6の動的表示制御を廃止し、標準ComfyUI描画だけを使用する静的Facadeへ移行しました。生成処理は互換用`H3ContinuumSamplerV2`を再利用し、State、Session、Prompt Plan、Spectrum Interop、保存Schemaは変更していません。
-27
View File
@@ -289,30 +289,3 @@ Revision 2167719e99b1e782
- FL2VAからRef2VAへの変更、およびPrompt変更を別Revisionとして扱い、旧Chunkを誤再利用しなかった。
- 00006~00008の生成時間は約749~752秒で、モデル切替やPrompt修正による異常な時間増加はない。
- 00008はユーザー目視を含め、V3.2.1 Reference + Continuationの実用可能な実機成績として保存する。
## V3.2.1 Stable 最終受け入れ
```text
Commit 2be54bd
ComfyUI v0.32.0
GPU RTX 5060 Ti 16GB
Conditioning Ref2VA Reference + Continuation
Reference images 2
Output 1056x608 / 24fps / 15秒
Chunks 3 x 5秒
Continuity Balanced 22
Spectrum Interop Actual Prefix 2
```
| 動画 | 実行 | 生成時間 | 結果 |
|---|---|---:|---|
| 00009 | 初回生成 | 1073.81秒 | 0 reused / 3 generated、manifest complete、resume_safe=true、3 Chunk SHA-256一致 |
| 00012 | 完全Auto Resume | 116.86秒 | 3 reused / 0 generated、resume=complete、Ref2VA verified |
最終判定:
- Python構文確認、pytest 129件、GitHub Actions、ローカル100ファイル一致を確認。
- Reference + Continuation、外部Core VAE Decode、Spectrum Actual Prefix 2、Run Storage保存と完全再開をWindows実機で確認。
- FL2VA/Ref2VA、Prompt、解像度、Run Storage、アップスケール経路、Reference構成の変更を別条件として識別した。
- 異なる条件のChunkを誤再利用した事例はない。
- V3.2.1を正式安定版として採用する。
+6 -3
View File
@@ -110,7 +110,8 @@ def _node(prompt: dict[str, Any], node_id: str, *, allowed: set[str], stack: set
def build_upstream_graph_contract(
prompt: Any, unique_id: Any, *, require_video_vae: bool
prompt: Any, unique_id: Any, *, require_video_vae: bool,
require_reference_audio_vae: bool = False,
) -> tuple[dict[str, Any], bool, list[str]]:
"""Fingerprint MODEL/CLIP/VAE routes feeding the Continuum sampler."""
if not isinstance(prompt, dict):
@@ -123,11 +124,13 @@ def build_upstream_graph_contract(
routes: dict[str, Any] = {}
safe = True
reasons: list[str] = []
specs = (
specs = [
("model", _KNOWN_MODEL_NODES, True),
("clip", _KNOWN_CLIP_NODES, True),
("video_vae", _KNOWN_VAE_NODES, bool(require_video_vae)),
)
]
if require_reference_audio_vae:
specs.append(("reference_audio_vae", _KNOWN_VAE_NODES, True))
for name, allowed, required in specs:
if not required:
continue
+1 -1
View File
@@ -1,4 +1,4 @@
[project]
name = H3 Continuum
version = 3.2.2
version = 3.2.4
description = Native MiniMax H3 continuation with Core VAE decode, Reference conditioning and crash-safe Run Storage.
+22 -12
View File
@@ -28,22 +28,32 @@ def _wrapper_factory(*, strict: bool, debug: bool) -> Callable[..., Any]:
def apply_model_wrapper(executor, *args, **kwargs):
payload = kwargs.get("minimax_payload")
if not payload_has_continuum(payload):
has_continuum = payload_has_continuum(payload)
has_mixed_keyframe_refs = (
isinstance(payload, dict)
and bool(payload.get("keyframes"))
and payload.get("refs") is not None
)
if not has_continuum and not has_mixed_keyframe_refs:
return executor(*args, **kwargs)
try:
ensure_native_h3_base_model(executor.class_obj)
patched_payload = dict(payload)
patch_layout_in_place(patched_payload, strict=True, debug=debug)
transformer_options = kwargs.get("transformer_options")
validate_native_continuity_layout(
patched_payload,
transformer_options=(
transformer_options if isinstance(transformer_options, dict) else {}
),
branch_baselines=branch_baselines,
)
input_x = args[0] if args else None
materialize_continuum_latents(patched_payload, input_x, debug=debug)
if has_continuum:
patch_layout_in_place(patched_payload, strict=True, debug=debug)
transformer_options = kwargs.get("transformer_options")
validate_native_continuity_layout(
patched_payload,
transformer_options=(
transformer_options if isinstance(transformer_options, dict) else {}
),
branch_baselines=branch_baselines,
)
input_x = args[0] if args else None
materialize_continuum_latents(patched_payload, input_x, debug=debug)
# ComfyUI Core 0.33.1 replaces keyframe condition latents with
# reference latents when both contracts are present. Rebuild the
# combined list for First/Last Frame + standalone Reference Audio.
normalize_condition_latents(patched_payload)
kwargs["minimax_payload"] = patched_payload
except (CompatibilityError, LayoutCompatibilityError, KeyError, TypeError, ValueError) as exc:
+1 -1
View File
@@ -1,6 +1,6 @@
[project]
name = "comfyui-h3-continuum"
version = "3.2.2"
version = "3.2.4"
description = "Integrated N-chunk continuation for ComfyUI native MiniMax H3 video and audio"
readme = "README.md"
requires-python = ">=3.10"
+40 -22
View File
@@ -17,6 +17,7 @@ import torch
REFERENCE_CONTRACT_VERSION = 1
REFERENCE_PREPROCESS_VERSION = 1
REFERENCE_SIZE_MATCH_OUTPUT = "Match Output"
REFERENCE_SIZE_MAX_IDENTITY = "Max Identity"
REFERENCE_SIZE_OPTIONS = (
@@ -46,13 +47,26 @@ class ReferenceAssets:
@property
def contract(self) -> dict[str, Any]:
return {
result = {
"reference_contract_version": REFERENCE_CONTRACT_VERSION,
"count": self.count,
"size_mode": self.size_mode,
"image_hashes": list(self.image_hashes),
"combined_hash": self.combined_hash,
}
# Preserve the V3.2.2 JSON contract byte-for-byte for zero, one, and
# two references. The V3.2.3 extension exists only when Image 3 is
# connected, so removing it can resolve back to an older Revision.
if self.count == 3:
image = self.images[2]
result["reference_image_3"] = {
"reference_position": 3,
"shape": [int(value) for value in image.shape],
"dtype": str(image.dtype),
"sha256": self.image_hashes[2],
"preprocess_version": REFERENCE_PREPROCESS_VERSION,
}
return result
def _canonical_hash(value: Any) -> str:
@@ -135,25 +149,16 @@ def prepare_reference_assets(
size_mode: str,
reference_image_3: torch.Tensor | None = None,
) -> ReferenceAssets | None:
if reference_image_1 is None:
if reference_image_2 is not None:
raise ReferenceConditioningError(
"Reference Image 2 requires Reference Image 1"
)
if reference_image_3 is not None:
raise ReferenceConditioningError(
"Reference Image 3 requires Reference Images 1 and 2"
)
# Match Core's dynamic Reference inputs: bypassed or otherwise absent
# sockets are ignored, then active images are numbered contiguously in
# connection order as Picture 1..N.
inputs = [
image
for image in (reference_image_1, reference_image_2, reference_image_3)
if image is not None
]
if not inputs:
return None
if reference_image_3 is not None and reference_image_2 is None:
raise ReferenceConditioningError(
"Reference Image 3 requires Reference Image 2"
)
inputs = [reference_image_1]
if reference_image_2 is not None:
inputs.append(reference_image_2)
if reference_image_3 is not None:
inputs.append(reference_image_3)
images = tuple(
_resize_reference(
_validate_image(f"Reference Image {index}", image),
@@ -193,9 +198,13 @@ def validate_reference_prompts(prompts: list[str], reference_count: int) -> str:
found.update(int(value) for value in _PICTURE_TAG.findall(str(prompt)))
invalid = sorted(value for value in found if value < 1 or value > reference_count)
if invalid:
raise ReferenceConditioningError(
f"Prompt references unavailable <Picture {invalid[0]}>; "
f"connected reference count is {reference_count}"
unavailable = ", ".join(f"<Picture {value}>" for value in invalid)
return (
f"Warning: prompt references unavailable {unavailable}; only "
f"{reference_count} active reference image(s) reached the Sampler. "
"ComfyUI Core permits this and generation will continue, but the "
"unavailable reference may be ignored or hallucinated. Enable the "
"corresponding Reference Image input or remove the unavailable tag."
)
if not found:
return (
@@ -210,6 +219,7 @@ def encode_reference_prompt(
clip: Any,
prompt: str,
assets: ReferenceAssets,
reference_audio_assets=None,
) -> list[list[Any]]:
if any(latent is None for latent in assets.latents):
raise ReferenceConditioningError("reference latents were not encoded")
@@ -217,6 +227,10 @@ def encode_reference_prompt(
{"type": "image", "data": image}
for image in assets.images
]
if reference_audio_assets is not None:
from .reference_audio import reference_audio_item
reference_items.append(reference_audio_item())
try:
tokens = clip.tokenize(str(prompt), minimax_ref_items=reference_items)
except TypeError as exc:
@@ -234,6 +248,10 @@ def encode_reference_prompt(
"latent": latent,
}
)
if reference_audio_assets is not None:
from .reference_audio import reference_audio_block
refs.append(reference_audio_block(reference_audio_assets))
return [
[tensor, {**dict(metadata), "minimax_refs": list(refs)}]
for tensor, metadata in conditioning
+242
View File
@@ -0,0 +1,242 @@
"""MiniMax H3 standalone audio-reference adapter for the V3 sampler."""
from __future__ import annotations
from dataclasses import dataclass
import hashlib
import json
import re
from typing import Any
import torch
REFERENCE_AUDIO_CONTRACT_VERSION = 1
REFERENCE_AUDIO_PREPROCESS_VERSION = 1
_AUDIO_TAG = re.compile(r"<Audio\s+(\d+)>")
class ReferenceAudioError(ValueError):
pass
@dataclass(frozen=True)
class ReferenceAudioSource:
waveform: torch.Tensor
source_sample_rate: int
source_shape: tuple[int, ...]
source_dtype: str
source_sha256: str
resolved_vae_sample_rate: int
resampled_shape: tuple[int, ...]
resampled_dtype: str
resampled_sha256: str
combined_hash: str
@property
def contract(self) -> dict[str, Any]:
return {
"reference_audio_contract_version": REFERENCE_AUDIO_CONTRACT_VERSION,
"source_sample_rate": self.source_sample_rate,
"source_shape": list(self.source_shape),
"source_dtype": self.source_dtype,
"source_sha256": self.source_sha256,
"resolved_vae_sample_rate": self.resolved_vae_sample_rate,
"resampled_shape": list(self.resampled_shape),
"resampled_dtype": self.resampled_dtype,
"resampled_sha256": self.resampled_sha256,
"preprocess_version": REFERENCE_AUDIO_PREPROCESS_VERSION,
"combined_hash": self.combined_hash,
}
@dataclass(frozen=True)
class ReferenceAudioAssets:
source: ReferenceAudioSource
audio_latent: torch.Tensor
@property
def combined_hash(self) -> str:
return self.source.combined_hash
def _canonical_hash(value: Any) -> str:
payload = json.dumps(
value, sort_keys=True, separators=(",", ":"), ensure_ascii=True
).encode("utf-8")
return hashlib.sha256(payload).hexdigest()
def _tensor_hash(value: torch.Tensor) -> str:
tensor = value.detach().to(device="cpu").contiguous()
digest = hashlib.sha256()
digest.update(str(tuple(int(v) for v in tensor.shape)).encode("ascii"))
digest.update(str(tensor.dtype).encode("ascii"))
digest.update(tensor.view(torch.uint8).numpy().tobytes(order="C"))
return digest.hexdigest()
def _validate_waveform(name: str, waveform: Any) -> torch.Tensor:
if not torch.is_tensor(waveform) or waveform.ndim != 3:
raise ReferenceAudioError(f"{name} waveform must have shape [B, C, L]")
if int(waveform.shape[0]) != 1:
raise ReferenceAudioError(f"{name} waveform batch size must be exactly 1")
if int(waveform.shape[1]) < 1 or int(waveform.shape[2]) < 1:
raise ReferenceAudioError(f"{name} waveform must contain channels and samples")
if not waveform.is_floating_point():
raise ReferenceAudioError(f"{name} waveform must use a floating-point dtype")
if not bool(torch.isfinite(waveform).all().item()):
raise ReferenceAudioError(f"{name} waveform contains NaN or infinity")
return waveform.detach().to(device="cpu").contiguous()
def prepare_reference_audio_source(
reference_audio_1: Any,
reference_audio_vae: Any,
) -> ReferenceAudioSource | None:
if reference_audio_1 is None:
return None
if reference_audio_vae is None:
raise ReferenceAudioError(
"reference_audio_vae is required when reference_audio_1 is connected"
)
if not isinstance(reference_audio_1, dict):
raise ReferenceAudioError("Reference Audio 1 must be a ComfyUI AUDIO value")
waveform = _validate_waveform(
"Reference Audio 1", reference_audio_1.get("waveform")
)
sample_rate_value = reference_audio_1.get("sample_rate")
if isinstance(sample_rate_value, bool):
raise ReferenceAudioError("Reference Audio 1 sample_rate must be positive")
try:
source_sample_rate = int(sample_rate_value)
except (TypeError, ValueError) as exc:
raise ReferenceAudioError(
"Reference Audio 1 sample_rate must be positive"
) from exc
if source_sample_rate <= 0:
raise ReferenceAudioError("Reference Audio 1 sample_rate must be positive")
resolved_rate = int(getattr(reference_audio_vae, "audio_sample_rate", 32000))
if resolved_rate <= 0:
raise ReferenceAudioError("Reference Audio VAE sample rate must be positive")
resampled = waveform
if source_sample_rate != resolved_rate:
try:
import torchaudio
resampled = torchaudio.functional.resample(
waveform, source_sample_rate, resolved_rate
).contiguous()
except Exception as exc:
raise ReferenceAudioError(
"Reference Audio 1 could not be resampled for the Audio VAE"
) from exc
if not bool(torch.isfinite(resampled).all().item()):
raise ReferenceAudioError(
"Reference Audio 1 contains NaN or infinity after resampling"
)
source_shape = tuple(int(value) for value in waveform.shape)
resampled_shape = tuple(int(value) for value in resampled.shape)
source_sha256 = _tensor_hash(waveform)
resampled_sha256 = _tensor_hash(resampled)
contract_base = {
"reference_audio_contract_version": REFERENCE_AUDIO_CONTRACT_VERSION,
"source_sample_rate": source_sample_rate,
"source_shape": list(source_shape),
"source_dtype": str(waveform.dtype),
"source_sha256": source_sha256,
"resolved_vae_sample_rate": resolved_rate,
"resampled_shape": list(resampled_shape),
"resampled_dtype": str(resampled.dtype),
"resampled_sha256": resampled_sha256,
"preprocess_version": REFERENCE_AUDIO_PREPROCESS_VERSION,
}
return ReferenceAudioSource(
waveform=resampled,
source_sample_rate=source_sample_rate,
source_shape=source_shape,
source_dtype=str(waveform.dtype),
source_sha256=source_sha256,
resolved_vae_sample_rate=resolved_rate,
resampled_shape=resampled_shape,
resampled_dtype=str(resampled.dtype),
resampled_sha256=resampled_sha256,
combined_hash=_canonical_hash(contract_base),
)
def encode_reference_audio(
reference_audio_vae: Any,
source: ReferenceAudioSource,
) -> ReferenceAudioAssets:
try:
latent = reference_audio_vae.encode(source.waveform.movedim(1, -1))
except Exception as exc:
raise ReferenceAudioError("Reference Audio VAE Encode failed") from exc
if (
not torch.is_tensor(latent)
or latent.ndim != 4
or int(latent.shape[0]) != 1
or int(latent.shape[1]) != 32
or int(latent.shape[2]) != 2
or int(latent.shape[3]) < 1
):
raise ReferenceAudioError(
"Reference Audio VAE must produce latent shape [1, 32, 2, T]"
)
if not bool(torch.isfinite(latent).all().item()):
raise ReferenceAudioError("Reference Audio latent contains NaN or infinity")
return ReferenceAudioAssets(source=source, audio_latent=latent)
def validate_reference_audio_prompts(
prompts: list[str], source: ReferenceAudioSource | None
) -> str:
found: set[int] = set()
for prompt in prompts:
found.update(int(value) for value in _AUDIO_TAG.findall(str(prompt)))
warnings: list[str] = []
active_count = 1 if source is not None else 0
unavailable = sorted(
value for value in found if source is None or value != 1
)
for value in unavailable:
warnings.append(
f"Warning: prompt references unavailable <Audio {value}>; only "
f"{active_count} active reference audio item(s) reached the Sampler. "
"Core-compatible generation will continue; the tag may be ignored "
"or hallucinated."
)
if source is not None and 1 not in found:
warnings.append(
"Reference Audio 1 is connected but the prompt contains no <Audio 1> "
"tag; audio still conditions generation, but an explicit tag is recommended."
)
return "\n".join(warnings)
def combine_reference_audio_identity(
visual_identity_hash: str,
source: ReferenceAudioSource | None,
) -> str:
if source is None:
return str(visual_identity_hash)
return _canonical_hash(
{
"reference_audio_identity_version": 1,
"visual_identity_hash": str(visual_identity_hash),
"reference_audio_hash": source.combined_hash,
}
)
def reference_audio_item() -> dict[str, str]:
return {"type": "audio"}
def reference_audio_block(assets: ReferenceAudioAssets) -> dict[str, Any]:
return {
"kind": "audio",
"ref_audio_t": int(assets.audio_latent.shape[-1]),
"audio_latent": assets.audio_latent,
}
+52 -1
View File
@@ -126,6 +126,16 @@ def automatic_project_key(prompt: Any, unique_id: Any) -> str:
next_stack.add(current_id)
if isinstance(inputs, dict):
for name in sorted(inputs):
if current_id == node_id and name == "reference_audio_vae":
audio_link = inputs.get("reference_audio_1")
if not (
isinstance(audio_link, (list, tuple))
and len(audio_link) == 2
and isinstance(audio_link[0], (str, int))
and isinstance(audio_link[1], int)
and str(audio_link[0]) in prompt
):
continue
value = inputs[name]
if (
isinstance(value, (list, tuple))
@@ -468,6 +478,26 @@ def _video_vae_signature(video_vae: Any, *, required: bool) -> tuple[dict[str, A
return observed, module_safe
def _audio_vae_signature(audio_vae: Any) -> tuple[dict[str, Any], bool]:
first_stage = getattr(audio_vae, "first_stage_model", None)
module_value, module_safe = _module_signature(first_stage)
patcher_value, patcher_safe = _patcher_signature(getattr(audio_vae, "patcher", None))
config = {
"wrapper_type": _qualified(audio_vae),
"first_stage": module_value,
"patcher": patcher_value,
"vae_dtype": str(getattr(audio_vae, "vae_dtype", "unknown")),
"audio_sample_rate": getattr(audio_vae, "audio_sample_rate", 32000),
"latent_channels": getattr(audio_vae, "latent_channels", None),
}
observed, config_safe = _observe(config)
observed["runtime_observation"] = {
"patcher_complete": bool(patcher_safe),
"config_complete": bool(config_safe),
}
return observed, module_safe
def _apply_nonce_contract(
contract: dict[str, Any], *, requested_nonce: int, effective_nonce: int,
) -> dict[str, Any]:
@@ -522,6 +552,8 @@ def build_sampling_contract(
upstream_graph_contract: dict[str, Any] | None = None,
upstream_graph_safe: bool | None = None,
upstream_graph_reasons: list[str] | None = None,
reference_audio_contract: dict[str, Any] | None = None,
reference_audio_vae: Any = None,
) -> tuple[dict[str, Any], bool, list[str]]:
model_value, model_safe = _model_signature(model, model_fingerprint_value)
clip_value, clip_safe = _clip_signature(clip)
@@ -546,6 +578,10 @@ def build_sampling_contract(
else:
video_vae_value, video_vae_safe = None, True
sampler_value, sampler_safe = _sampler_signature(sampler)
if reference_audio_contract is not None:
audio_vae_value, audio_vae_safe = _audio_vae_signature(reference_audio_vae)
else:
audio_vae_value, audio_vae_safe = None, True
if not torch.is_tensor(sigmas) or sigmas.ndim != 1:
raise RunStorageError("Run Storage requires a one-dimensional SIGMAS tensor")
chunks = int(prompt_plan["chunks"])
@@ -567,6 +603,11 @@ def build_sampling_contract(
"runtime": video_vae_value,
"graph_route": routes.get("video_vae"),
}
if reference_audio_contract is not None:
audio_vae_value = {
"runtime": audio_vae_value,
"graph_route": routes.get("reference_audio_vae"),
}
global_contract = {
"sampling_contract_version": SAMPLING_CONTRACT_VERSION,
"conditioning_mode": conditioning_mode,
@@ -591,6 +632,9 @@ def build_sampling_contract(
global_contract["first_frame_hash"] = str(first_frame_hash)
if reference_contract is not None:
global_contract["reference"] = dict(reference_contract)
if reference_audio_contract is not None:
global_contract["reference_audio"] = dict(reference_audio_contract)
global_contract["reference_audio_vae"] = audio_vae_value
lineage_sha256 = _hash({
"global_hash": _hash(global_contract),
"chunk_count": chunks,
@@ -625,8 +669,10 @@ def build_sampling_contract(
reasons.append("CLIP/Qwen encoder contract is not completely observable")
if not video_vae_safe:
reasons.append("Video VAE contract is not completely observable")
if not audio_vae_safe:
reasons.append("Reference Audio VAE contract is not completely observable")
graph_safe = bool(upstream_graph_safe) if graph_authoritative else True
return contract, model_safe and clip_safe and video_vae_safe and sampler_safe and graph_safe, reasons
return contract, model_safe and clip_safe and video_vae_safe and audio_vae_safe and sampler_safe and graph_safe, reasons
def revision_identity(contract: dict[str, Any]) -> tuple[str, str]:
@@ -898,6 +944,8 @@ class RunStorageController:
existing_session: dict[str, Any] | None,
reference_contract: dict[str, Any] | None = None,
conditioning_mode: str | None = None,
reference_audio_contract: dict[str, Any] | None = None,
reference_audio_vae: Any = None,
) -> dict[str, Any] | None:
if existing_session is not None:
raise RunStorageError("Run Storage cannot be combined with an explicit Session")
@@ -909,6 +957,7 @@ class RunStorageController:
require_video_vae=conditioning_mode_uses_video_vae(
str(conditioning_mode)
),
require_reference_audio_vae=reference_audio_contract is not None,
)
contract, safe, reasons = build_sampling_contract(
model=model, model_fingerprint_value=model_fingerprint_value,
@@ -925,6 +974,8 @@ class RunStorageController:
upstream_graph_contract=graph_contract,
upstream_graph_safe=graph_safe,
upstream_graph_reasons=graph_reasons,
reference_audio_contract=reference_audio_contract,
reference_audio_vae=reference_audio_vae,
)
effective_nonce, nonce_decision = self._resolve_effective_nonce(
contract, requested_nonce=int(reroll_nonce), resume_safe=safe
+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:
+22 -2
View File
@@ -91,14 +91,34 @@ def encode_prompt_conditioning(
*,
first_image: torch.Tensor | None,
last_image: torch.Tensor | None,
reference_audio_assets=None,
) -> list:
images = []
if first_image is not None:
images.append(first_image)
if last_image is not None:
images.append(last_image)
tokens = clip.tokenize(str(prompt), images=images)
return clip.encode_from_tokens_scheduled(tokens)
tokenize_options = {"images": images}
if reference_audio_assets is not None:
from ..reference_audio import reference_audio_item
tokenize_options = {
"minimax_ref_items": [
*({"type": "image", "data": image} for image in images),
reference_audio_item(),
]
}
tokens = clip.tokenize(str(prompt), **tokenize_options)
conditioning = clip.encode_from_tokens_scheduled(tokens)
if reference_audio_assets is None:
return conditioning
from ..reference_audio import reference_audio_block
audio_ref = reference_audio_block(reference_audio_assets)
return [
[tensor, {**dict(metadata), "minimax_refs": [dict(audio_ref)]}]
for tensor, metadata in conditioning
]
def attach_keyframes(
+4
View File
@@ -305,6 +305,8 @@ class H3ContinuumSamplerV2:
show_preview=True,
latent_only=False,
reference_assets=None,
reference_audio_source=None,
reference_audio_vae=None,
**clip_prompt_inputs,
):
(
@@ -371,6 +373,8 @@ class H3ContinuumSamplerV2:
initial_state=initial_state,
latent_only=bool(latent_only),
reference_assets=reference_assets,
reference_audio_source=reference_audio_source,
reference_audio_vae=reference_audio_vae,
)
+14 -4
View File
@@ -35,14 +35,23 @@ def _parse_list(script,chunks):
if len(values)<chunks: notes.append(f"repeated the last prompt for {chunks-len(values)} chunk(s)"); values.extend([values[-1]]*(chunks-len(values)))
elif len(values)>chunks: notes.append(f"ignored {len(values)-chunks} extra prompt(s)"); values=values[:chunks]
return values,notes
def _parse_timeline_sections(script):
def _timeline_preamble(script):
body=[]
for line in str(script).splitlines():
if _TIMELINE_HEADER.match(line) or _CHUNK_HEADER.match(line): break
body.append(line)
return "\n".join(body).strip()
def _parse_timeline_sections(script,*,allow_preamble=True):
preamble=_timeline_preamble(script)
sections=[]; current=None; body=[]
def finish():
nonlocal current,body
if current is None:
if any(line.strip() for line in body): raise PromptPlanError("timeline text before the first [0-5s] or [Chunk 1] header is not allowed")
if any(line.strip() for line in body) and not allow_preamble: raise PromptPlanError("timeline text before the first [0-5s] or [Chunk 1] header is not allowed")
body=[]; return
current["prompt"]=_normalize_prompt("\n".join(body),label="timeline section"); sections.append(current); current=None; body=[]
prompt=_normalize_prompt("\n".join(body),label="timeline section")
current["prompt"]=f"{preamble}\n\n{prompt}" if preamble else prompt
sections.append(current); current=None; body=[]
for line in str(script).splitlines():
time_match=_TIMELINE_HEADER.match(line); chunk_match=_CHUNK_HEADER.match(line)
if time_match or chunk_match:
@@ -61,7 +70,7 @@ def _parse_timeline_sections(script):
if not sections: raise PromptPlanError("timeline contains no sections")
return sections
def parse_sparse_prompt_overrides(script):
sections=_parse_timeline_sections(script); overrides={}
sections=_parse_timeline_sections(script,allow_preamble=False); overrides={}
for item in sections:
if item["kind"]!="chunk": raise PromptPlanError("Sparse Clip Overrides only accepts [Clip N] or [Chunk N] sections")
index=int(item["index"])
@@ -80,6 +89,7 @@ def validate_sparse_prompt_overrides(overrides,*,chunks):
return validated
def _parse_timeline(script,chunks,chunk_seconds):
sections=_parse_timeline_sections(script); prompts=[]; notes=[]
if _timeline_preamble(script): notes.append("applied timeline preamble to all chunks")
for chunk_index in range(1,chunks+1):
chunk_sections=[item for item in sections if item["kind"]=="chunk" and item["index"]==chunk_index]
if len(chunk_sections)>1: raise PromptPlanError(f"timeline defines Chunk {chunk_index} more than once")
+22 -8
View File
@@ -67,19 +67,19 @@ def _preserved_prefix(*,session,prompt_hashes,chunks,reroll_from_chunk,width,hei
elif reroll_from_chunk>0: notes.append(f"preserved chunks 1-{len(preserved)}; regenerated from chunk {reroll_from_chunk}")
return preserved,notes
def _conditioning_cache(*,clip,prompts,assets,final_has_last_frame,reference_assets=None):
def _conditioning_cache(*,clip,prompts,assets,final_has_last_frame,reference_assets=None,reference_audio_assets=None):
cache={}; final_index=len(prompts)-1
for index,prompt in enumerate(prompts):
include_last=bool(final_has_last_frame and index==final_index); key=(prompt,include_last)
if key in cache: continue
if reference_assets is not None:
from ..reference import encode_reference_prompt
cache[key]=encode_reference_prompt(clip,prompt,reference_assets)
cache[key]=encode_reference_prompt(clip,prompt,reference_assets,reference_audio_assets=reference_audio_assets)
else:
cache[key]=encode_prompt_conditioning(clip,prompt,first_image=assets.first_image,last_image=assets.last_image if include_last else None)
cache[key]=encode_prompt_conditioning(clip,prompt,first_image=assets.first_image,last_image=assets.last_image if include_last else None,reference_audio_assets=reference_audio_assets)
return cache
def run_sequence(*,model:Any,clip:Any,video_vae:Any,audio_vae:Any,sampler:Any,sigmas:torch.Tensor,first_frame:torch.Tensor|None,last_frame:torch.Tensor|None,prompt_plan:dict[str,Any],width:int,height:int,continuity:str,base_seed:int,audio_continuity:bool,exact_total_duration:bool,diagnostics_mode:str,reroll_from_chunk:int,reroll_nonce:int,strict_compatibility:bool,debug:bool,seam_correction:str=SEAM_CORRECTION_OFF,enable_preview:bool=True,session:dict[str,Any]|None=None,initial_state:dict[str,Any]|None=None,latent_only:bool=False,reference_assets=None):
def run_sequence(*,model:Any,clip:Any,video_vae:Any,audio_vae:Any,sampler:Any,sigmas:torch.Tensor,first_frame:torch.Tensor|None,last_frame:torch.Tensor|None,prompt_plan:dict[str,Any],width:int,height:int,continuity:str,base_seed:int,audio_continuity:bool,exact_total_duration:bool,diagnostics_mode:str,reroll_from_chunk:int,reroll_nonce:int,strict_compatibility:bool,debug:bool,seam_correction:str=SEAM_CORRECTION_OFF,enable_preview:bool=True,session:dict[str,Any]|None=None,initial_state:dict[str,Any]|None=None,latent_only:bool=False,reference_assets=None,reference_audio_source=None,reference_audio_vae=None):
from ..conditioning import detect_conditioning_mode, conditioning_mode_label
from ..run_storage import get_active_run_storage
storage_controller=get_active_run_storage()
@@ -97,15 +97,21 @@ def run_sequence(*,model:Any,clip:Any,video_vae:Any,audio_vae:Any,sampler:Any,si
from ..reference import validate_reference_prompts
if first_frame is not None or last_frame is not None: raise SequenceRuntimeError("Reference images cannot be combined with First Frame or Last Frame in V3.2")
reference_warning=validate_reference_prompts(prompts,reference_assets.count)
from ..reference_audio import (
combine_reference_audio_identity,
validate_reference_audio_prompts,
)
reference_audio_warning=validate_reference_audio_prompts(prompts,reference_audio_source)
decode_estimate_gib=0.0; available_ram_gib=None
if not latent_only: decode_estimate_gib,available_ram_gib=_check_decode_memory_budget(width=width,height=height,chunks=chunks,chunk_seconds=chunk_seconds)
issues=check_comfy_h3_runtime()
if issues and strict_compatibility: raise SequenceRuntimeError("H3 runtime is incompatible: "+"; ".join(issues))
assets=prepare_identity_assets(video_vae,width=width,height=height,first_frame=first_frame,last_frame=last_frame,encode_latents=False)
sequence_identity_hash=reference_assets.combined_hash if reference_assets is not None else assets.identity_hash
visual_identity_hash=reference_assets.combined_hash if reference_assets is not None else assets.identity_hash
sequence_identity_hash=combine_reference_audio_identity(visual_identity_hash,reference_audio_source)
current_model_fingerprint=model_fingerprint(model,extra_wrapper_keys=("h3_continuum_join.apply_model.v1",))
if storage_controller is not None:
stored_session=storage_controller.prepare(model=model,model_fingerprint_value=current_model_fingerprint,clip=clip,video_vae=video_vae,sampler=sampler,sigmas=sigmas,prompt_plan=plan,width=width,height=height,chunk_seconds=chunk_seconds,continuity=continuity,audio_continuity=audio_continuity,base_seed=base_seed,reroll_from_chunk=reroll_from_chunk,reroll_nonce=reroll_nonce,first_frame_hash=assets.first_frame_hash,last_frame_hash=assets.last_frame_hash,identity_hash=sequence_identity_hash,strict_compatibility=strict_compatibility,existing_session=session,reference_contract=reference_assets.contract if reference_assets is not None else None,conditioning_mode=conditioning_mode)
stored_session=storage_controller.prepare(model=model,model_fingerprint_value=current_model_fingerprint,clip=clip,video_vae=video_vae,sampler=sampler,sigmas=sigmas,prompt_plan=plan,width=width,height=height,chunk_seconds=chunk_seconds,continuity=continuity,audio_continuity=audio_continuity,base_seed=base_seed,reroll_from_chunk=reroll_from_chunk,reroll_nonce=reroll_nonce,first_frame_hash=assets.first_frame_hash,last_frame_hash=assets.last_frame_hash,identity_hash=sequence_identity_hash,strict_compatibility=strict_compatibility,existing_session=session,reference_contract=reference_assets.contract if reference_assets is not None else None,conditioning_mode=conditioning_mode,reference_audio_contract=reference_audio_source.contract if reference_audio_source is not None else None,reference_audio_vae=reference_audio_vae)
reroll_nonce=storage_controller.effective_reroll_nonce
if stored_session is not None: session=stored_session
accelerators=accelerator_summary(model)
@@ -114,7 +120,10 @@ def run_sequence(*,model:Any,clip:Any,video_vae:Any,audio_vae:Any,sampler:Any,si
preserved,reuse_notes=_preserved_prefix(session=session,prompt_hashes=prompt_hashes,chunks=chunks,reroll_from_chunk=effective_reroll_from_chunk,width=width,height=height,chunk_seconds=chunk_seconds,identity_hash=sequence_identity_hash)
if reference_assets is not None:
reuse_notes.insert(0,f"Reference conditioning: {reference_assets.count} image(s), size={reference_assets.size_mode}; persistent across all chunks.")
if reference_warning: reuse_notes.append("Warning: "+reference_warning)
if reference_warning: reuse_notes.append(reference_warning)
if reference_audio_source is not None:
reuse_notes.insert(0,"Reference Audio 1 conditioning: persistent across all chunks.")
if reference_audio_warning: reuse_notes.append("Warning: "+reference_audio_warning)
if session is not None:
old_fingerprint=str(session.get("model_fingerprint",""))
if old_fingerprint and old_fingerprint!=current_model_fingerprint: reuse_notes.append("model/accelerator fingerprint differs from the saved session; accepted chunks were kept")
@@ -124,7 +133,11 @@ def run_sequence(*,model:Any,clip:Any,video_vae:Any,audio_vae:Any,sampler:Any,si
if reference_assets is not None:
from ..reference import encode_reference_latents
reference_assets=encode_reference_latents(video_vae,reference_assets)
cache=_conditioning_cache(clip=clip,prompts=prompts,assets=assets,final_has_last_frame=last_frame is not None,reference_assets=reference_assets)
reference_audio_assets=None
if reference_audio_source is not None:
from ..reference_audio import encode_reference_audio
reference_audio_assets=encode_reference_audio(reference_audio_vae,reference_audio_source)
cache=_conditioning_cache(clip=clip,prompts=prompts,assets=assets,final_has_last_frame=last_frame is not None,reference_assets=reference_assets,reference_audio_assets=reference_audio_assets)
entries=preserved[:]; previous_state=None
if entries: previous_state=entry_to_state(entries[-1])
elif initial_state is not None:
@@ -154,6 +167,7 @@ def run_sequence(*,model:Any,clip:Any,video_vae:Any,audio_vae:Any,sampler:Any,si
if latent_only:
last_state=entry_to_state(entries[-1]); parent_id=session.get("session_id") if session is not None else None
settings={"continuity":continuity,"audio_continuity":bool(audio_continuity),"exact_total_duration":False,"prompt_mode":plan["mode"],"conditioning_mode":conditioning_mode,"base_seed":int(base_seed),"reroll_nonce":int(reroll_nonce),"diagnostics_mode":diagnostics_mode,"initial_state_source":initial_state is not None,"latent_first":True,"first_frame_hash":assets.first_frame_hash,"last_frame_hash":assets.last_frame_hash,"reference_contract":reference_assets.contract if reference_assets is not None else None}
if reference_audio_source is not None: settings["reference_audio_contract"]=reference_audio_source.contract
new_session=make_session(chunks=entries,width=width,height=height,chunk_seconds=chunk_seconds,identity_hash=sequence_identity_hash,model_fingerprint_value=current_model_fingerprint,parent_session_id=parent_id,reroll_from_chunk=int(reroll_from_chunk),settings=settings)
report_lines=[f"H3 Continuum V3 {PACKAGE_VERSION}",f"Conditioning mode: {conditioning_mode_label(conditioning_mode)}.",prompt_plan_report(plan),"Decode: external ComfyUI Core VAE nodes; full raw AV chunks retained.",accelerators,"Execution: conditioning precomputed; single call-local MODEL clone per chunk; no internal VAE decode.",*reuse_notes]
if diagnostics_mode!=DIAGNOSTICS_OFF: report_lines.extend(sampling_reports)
+16 -1
View File
@@ -257,6 +257,8 @@ class H3ContinuumSamplerV3:
prompt_overrides=None,
advanced=None,
reference_assets=None,
reference_audio_source=None,
reference_audio_vae=None,
):
if prompt_overrides is not None and not isinstance(prompt_overrides, dict):
raise TypeError(
@@ -327,6 +329,8 @@ class H3ContinuumSamplerV3:
show_preview=advanced_values["show_preview"],
latent_only=True,
reference_assets=reference_assets,
reference_audio_source=reference_audio_source,
reference_audio_vae=reference_audio_vae,
**clip_prompt_inputs,
)
@@ -528,6 +532,8 @@ class H3ContinuumSamplerProduction(H3ContinuumSamplerV3):
"reference_image_1": ("IMAGE",),
"reference_image_2": ("IMAGE",),
"reference_image_3": ("IMAGE",),
"reference_audio_1": ("AUDIO",),
"reference_audio_vae": ("VAE",),
},
"hidden": {
"prompt": "PROMPT",
@@ -569,8 +575,11 @@ class H3ContinuumSamplerProduction(H3ContinuumSamplerV3):
prompt=None,
unique_id=None,
reference_image_3=None,
reference_audio_1=None,
reference_audio_vae=None,
):
from ..reference import prepare_reference_assets
from ..reference_audio import prepare_reference_audio_source
regenerate_from = _regenerate_from_value(
reroll_from_chunk,
chunks=int(chunks),
@@ -583,9 +592,13 @@ class H3ContinuumSamplerProduction(H3ContinuumSamplerV3):
size_mode=reference_size,
reference_image_3=reference_image_3,
)
reference_audio_source = prepare_reference_audio_source(
reference_audio_1,
reference_audio_vae,
)
if reference_assets is not None and (first_frame is not None or last_frame is not None):
raise ValueError(
"V3.2 Reference Images cannot be combined with First Frame or Last Frame"
"Reference Images cannot be combined with First Frame or Last Frame"
)
reference_checkpoint = None
if reference_assets is not None:
@@ -624,6 +637,8 @@ class H3ContinuumSamplerProduction(H3ContinuumSamplerV3):
first_frame=first_frame,
prompt_overrides=prompt_overrides,
reference_assets=reference_assets,
reference_audio_source=reference_audio_source,
reference_audio_vae=reference_audio_vae,
advanced={
"audio_continuity": bool(audio_continuity),
"diagnostics": diagnostics,
+1 -1
View File
@@ -1,6 +1,6 @@
"""Package version and public schema identifiers."""
PACKAGE_VERSION = "3.2.2"
PACKAGE_VERSION = "3.2.4"
STATE_SCHEMA_VERSION = 1
PLAN_SCHEMA_VERSION = 1
PUBLIC_API_VERSION = 3
+146
View File
@@ -0,0 +1,146 @@
import { app } from "../../scripts/app.js";
const NODE_CLASS = "H3ContinuumSamplerProduction";
const PROJECT_WIDGET = "project_id";
const LEGACY_RUN_NAME_WIDGET = "run_name";
const CHUNKS_WIDGET = "chunks";
const REGENERATE_WIDGET = "reroll_from_chunk";
const PROMPT_OVERRIDES_INPUT = "prompt_overrides";
function createProjectId() {
if (globalThis.crypto?.randomUUID) {
return globalThis.crypto.randomUUID();
}
const bytes = new Uint8Array(16);
globalThis.crypto.getRandomValues(bytes);
bytes[6] = (bytes[6] & 0x0f) | 0x40;
bytes[8] = (bytes[8] & 0x3f) | 0x80;
const hex = Array.from(bytes, (value) => value.toString(16).padStart(2, "0")).join("");
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
}
function findWidget(node, name) {
return node.widgets?.find((widget) => widget.name === name);
}
function hidePersistentWidget(widget) {
if (!widget || widget.__h3ContinuumHidden) {
return;
}
widget.__h3ContinuumHidden = true;
widget.hidden = true;
widget.type = "converted-widget";
widget.options ||= {};
widget.options.hidden = true;
widget.computeSize = () => [0, -4];
}
function removeUnusedInput(node, name) {
const index = node.inputs?.findIndex((input) => input.name === name) ?? -1;
if (index < 0) {
return;
}
const input = node.inputs[index];
if (input.link != null) {
app.graph?.removeLink(input.link);
}
node.removeInput(index);
}
function regenerateOptions(chunks) {
const count = Math.max(1, Math.min(16, Number.parseInt(chunks, 10) || 1));
return ["Auto", ...Array.from({ length: count }, (_, index) => `Chunk ${index + 1}`)];
}
function configureRegenerateFrom(node) {
const chunksWidget = findWidget(node, CHUNKS_WIDGET);
const regenerateWidget = findWidget(node, REGENERATE_WIDGET);
if (!chunksWidget || !regenerateWidget) {
return;
}
const refresh = () => {
const values = regenerateOptions(chunksWidget.value);
regenerateWidget.options ||= {};
regenerateWidget.options.values = values;
const numeric = typeof regenerateWidget.value === "number"
? regenerateWidget.value
: Number.parseInt(String(regenerateWidget.value).replace(/^Chunk\s+/, ""), 10);
if (regenerateWidget.value === "Auto" || numeric === 0) {
regenerateWidget.value = "Auto";
} else if (Number.isInteger(numeric) && numeric >= 1 && numeric < values.length) {
regenerateWidget.value = `Chunk ${numeric}`;
} else {
regenerateWidget.value = "Auto";
}
};
if (!chunksWidget.__h3ContinuumRegenerateCallback) {
const previous = chunksWidget.callback;
chunksWidget.callback = function(value, ...args) {
const result = previous?.call(this, value, ...args);
refresh();
return result;
};
chunksWidget.__h3ContinuumRegenerateCallback = true;
}
refresh();
}
function configureNode(node) {
if (node.comfyClass !== NODE_CLASS) {
return null;
}
const projectWidget = findWidget(node, PROJECT_WIDGET);
if (projectWidget && !String(projectWidget.value || "").trim()) {
projectWidget.value = createProjectId();
}
hidePersistentWidget(findWidget(node, LEGACY_RUN_NAME_WIDGET));
hidePersistentWidget(projectWidget);
removeUnusedInput(node, PROMPT_OVERRIDES_INPUT);
configureRegenerateFrom(node);
node.setDirtyCanvas?.(true, true);
return projectWidget;
}
function configureNodeAfterSetup(node) {
configureNode(node);
setTimeout(() => configureNode(node), 0);
setTimeout(() => configureNode(node), 100);
}
app.registerExtension({
name: "H3Continuum.ProjectId",
nodeCreated(node) {
configureNodeAfterSetup(node);
},
loadedGraphNode(node) {
configureNodeAfterSetup(node);
},
afterConfigureGraph() {
for (const node of app.graph?._nodes || []) {
configureNodeAfterSetup(node);
}
},
async beforeQueuePrompt(prompt) {
const seen = new Set();
for (const node of app.graph?._nodes || []) {
const projectWidget = configureNode(node);
if (!projectWidget) {
continue;
}
let projectId = String(projectWidget.value || "").trim();
if (!projectId || seen.has(projectId)) {
projectId = createProjectId();
projectWidget.value = projectId;
}
seen.add(projectId);
const apiNode = prompt.output?.[String(node.id)];
if (apiNode?.inputs) {
apiNode.inputs.project_id = projectId;
}
}
},
});