diff --git a/AGENTS.md b/AGENTS.md index 2612cc7..4a5b8d8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,7 +1,7 @@ # AGENTS.md ## Scope -MiniMax H3 Continuum V3.5.3 for ComfyUI. Treat V3.5.3 as the current maintenance baseline; preserve V3.4 node IDs, public contracts, and saved-workflow loading without letting legacy controls change current behavior. +MiniMax H3 Continuum V3.6.0 for ComfyUI. Treat V3.6 as the current Production baseline; preserve V3.5.3/V3.4 node IDs, public contracts, and saved-workflow loading without letting legacy controls change current behavior. ## Non-negotiable rules - Follow ComfyUI Core behavior for user-facing validation. Continuum-only prompt restrictions, model allowlists, compatibility gates, and policy-based execution stops are prohibited. diff --git a/CHANGELOG.md b/CHANGELOG.md index 196b1b9..1db1f56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## 3.6.0 + +- Added `H3 Continuum Sampler V3.6` with Standard Masked AV continuation. Prior finalized Video/Audio prefixes are preserved inside the next H3 target with Core noise masks instead of being appended as duplicate Reference rows. +- Retained `Compatibility` as an Advanced fallback to the V3.5 `Reference Context` transport. Internal transport identifiers are not exposed in the public UI, and all V3.4/V3.5 node IDs and saved workflows remain loadable. +- Scoped Run Storage identity and Sampling Contract execution semantics by nondefault continuation backend, preventing Reference and Masked chunks from being mixed while preserving legacy Reference revision identity. +- Preserved Long Terminal Merge as one physical sample during resume and `Regenerate From`; logical chunks `[2,3]` are never split or partially reused. +- Extended the shared V2/V3 `chunk_seconds` range to 4–30 seconds with a 5-second default and 0.1-second step. The 5–15 second range remains recommended and validated; longer high-resolution chunks can substantially increase VRAM and runtime. +- GPU-accepted T2VA, I2VA, Reference Image + Reference Audio, Balanced 22f/37T Joint AV, and 3×5-second FL2VA Long Terminal Merge Masked continuation. Protected Video/Audio prefixes finalize bit-exact, and the accepted PIG-3 audio output passed subjective listening. +- Measured the accepted FL2VA Terminal Group 2 path at 8.01% fewer packed rows and a 4.06% lower median Sampling time than Reference Context in the tested paired runs. These are environment-specific measurements, not universal speed guarantees. +- Preserved V3.5 Second Pass, Hi-Res Fix, Conditioning Bridge, disk-backed Assembly, Prompt/CLIP cache, Video Guide optimization, V3.4 compatibility, and existing Audio/Video Seam algorithms. + ## 3.5.3 - Repaired the public Conditioning Bridge workflow's Width/Height input slots and added serialization-integrity checks for every published workflow. diff --git a/MANIFEST.sha256 b/MANIFEST.sha256 index 7d43098..ac77be3 100644 --- a/MANIFEST.sha256 +++ b/MANIFEST.sha256 @@ -1,11 +1,11 @@ dca65fb1393e67f59c6f81f9411e3e745eb8f1097e9a2adf7ffc6f4e3901ca9f __init__.py 4f6feeb2f63a9285b0e76fb2e2618058c7d7c279af1632e1a6ccabcc9ec9a45a .github/workflows/tests.yml 0a2f69d4cec89d440f5d5aa1ec68a7c9a741382d313f80dcddf96d13f70b3e68 .gitignore -46cc7e0f2a5d04d01de4962165b0623966b303839911779c9c31ef9f541fe519 AGENTS.md -6d2fc05374d2a352fda63133d0754d19b532b6663a21e799087ebaa60acb3d9e CHANGELOG.md +a6fdf835e34a6f9abaa55084b2dc9e57a83a92d121c0747922c22d5b95385cfb AGENTS.md +feccb34ac92f60050e6baa7e41043b8e2f395a5960d2800ca46719af1aacbbec CHANGELOG.md e97e47c7585e81d9ec5fd32c0ca0b64699fd4610cd03e9d6575a91c30a10ca4e compatibility.py 4d62508f900af9f93ec320afb900c27cc9a300d1e0c0a94714258498c5ede5fc conditioning.py -71e3df269e226b1ecad597f9831c2a10b2215c8a3783652e9e9f536e99ce46c9 constants.py +64967f4987e3ad9316f3a47f0dcf582eeff39ee0c3485f4184d3532d495534ae constants.py cf255b8a635471229aebadc926acfdcacb65963adbcb9e0f9505d04eada2c6b5 continuation.py f9375629fa1a2c4d3538442f0c3192d7ba2f46fe9544fb2e21f0c144b53d608c docs/AB_TEST_LOG_JA.md c93a3e52e4deabe5ef0db7f34a7605856a543089574ba17227e697e9a2c0139a docs/ARCHITECTURE.md @@ -58,6 +58,7 @@ b8275c8cecde12aee0418cea456d1e7f4b875cbb1bce32f1f3d9e06a44dd0be1 examples/v2_pr a8460ca5092511f6d22da3363331ba8bff4feab01c569e539811049ea1add051 examples/workflows/MiniMax_H3_Continuum_V34.json ea8c245d36909672710bc9f535f37195e48d7151b0cb2217bcaaca5fcc6d02c0 examples/workflows/MiniMax_H3_Continuum_V35.json 9f1a0766b97ead788989fb6eb69a6b36ad236d7a924eea4a88e4a1696e2db6d8 examples/workflows/MiniMax_H3_Continuum_V351_LBH_Conditioning_Bridge.json +1c7f1810f0cdd0bdcee09fe9eb8cb052993dd7343753dc0ec0157e00fe702da3 examples/workflows/MiniMax_H3_Continuum_V36.json e8f41dee2240f1fcc6e8fd12448856513483ff3ae0427b2c554bb351f9ae8047 graph_contract.py 3d14acac341c63207995e2bd45cd407fdb3e2308273b1c90605adfe6f2e0bd8f hardening.py 6abdbc29472c7f9d447085b189fc47b69e110b94ef83192f9689d04000408843 INSTALL_JA.txt @@ -66,21 +67,21 @@ d74073e7ee292ebeba913af4288284f9f197cd91fceed6c62bf6c66b784c7cec install_window 6aa3f5780baa7bb0c0672b5f01a2f77e5f209da93f6373468cb274ea2f643d4b layout_adapter.py c44abbd789091bbead01250dbd5453e60539d2665c69f162335fdbd2936019c2 LICENSE d3e213005670e94dee33a240349a4d245cf9a3b6602099f11ed30cf5a32e2c21 media.py -18bea054b11cc97ba5774b35a9367ddafc3ab9678c824f48f4deb354005fb1ba metadata.ini +a7461b3c697c17a86bbfde6929d7134d94f6f992e560a5c593768c3f20edef6f metadata.ini ef705a476e3f5bbd05559e7a0e7d3dfb9275badef0f8f65fb1a36ce27fbcb537 model_patch.py -420f00c8193d527017720b26d6f7011d69c8f68a157b21c0102246cc98ad3a13 nodes.py -13fc76ef7422d369a915b6e29bab0c76833e25ea7671ab3efcb8287042a8545a PACKAGE_INFO_JA.txt -ce593d6d23f049152181c46c84f7801b29cdceab0106dac6b27f156d8f2cde1c PACKAGE_VALIDATION.txt +069149bbdc9a2d610ce43212d2f57714f22829988e863cd72a3e04095ab93f70 nodes.py +c8d9abac6838de91331e5ca66f9389c6e25cb0af89bcf4014949a4c63c212ae4 PACKAGE_INFO_JA.txt +2e7124f5e90b6ba247b21fdabefd54fc1a1bbf061651b88847b2e4b99b9f2825 PACKAGE_VALIDATION.txt b470819f16fc179654dc1600721a63f0a5a14e777f4c004d574b499da6886ba5 public_api.py -aa95491a3959ad3c2218cb0bb711fe88fc687b726f710473c3bafd783a34202e pyproject.toml +2a26a8f5ae5a5aa2d9da5211a68b1edc8ba17bae137aa6641be7261403875a8b pyproject.toml 94fdc2d545b2d4077a4d70229fd22ba3ccac21d49d1097d2873f76d04e9a3c7a pytest.ini -a6d2f4bb803fe68f99df400cf2bb8d43ad4003af2ae69c67c7a77f0829d404df README_JA.md -a83046936584194eb3df9a534755ec723e95d2a91c9cfce5455effb6a71fac36 README.md +2b4e6fa9a7bb54306ce84ca0be7020604562ca6ad7330e1a68126510f02c7dd6 README_JA.md +aaf8ce2bbc1946488048a79fb82a63dbb8909838acb92227172cd8cc31de62c2 README.md 5d89c366b4f076fa73a2695557e0af749bf95df1dad0d55dbb2fe5b1c2519ad7 reference_audio.py a0266ab4434b8e9844219d2b6dd8a168d198dd8f142775be01a39b81dc196b91 reference_video.py 564f5f2bf29665059845a98b9ca3e9a1309566aab73bcaa96f95fab8251ab06c reference.py 467edb2c188d024c2392aafe7423b3f835e16b10f570da76e2f7dda8a962c1c5 requirements.txt -e02b523b5b1c1272c912c16d547050cc9bb9feb6c348743015bb5d059a4ead06 run_storage.py +30ac248e4675e4fd15284de90d6f6dc6ee68ace2c4d3abe425c906e08cb89708 run_storage.py 6056de6c0a5322a8a51ba5a114538dca2ef67788cd1afba10fedd483b95f6afa state_io.py 3a359a0467725cc292ccb4c86cf0c3d30bb6a114d01f5345792b09ea3d45441d state.py 43ec4023dc06c941e5d7a04db4b8a89fb58d744ceb986f6eb9bf534d4fdcb87b temporal.py @@ -100,28 +101,28 @@ d2a02c120e01d360ddca17a92d5bc53b12c9f0734d06440b3fc2fad2e754e549 tests/test_p23 403a0ff300330ac1f97642bf0681e80b83eec18e8911c03952ddf203ce794e5a tests/test_p46a_reference_video_memory.py 1ae0369943ba2fb13f21ad0cf56ee58621ba09bf20174379595e157a1775c7fd tests/test_public_api.py 892d3e3e022a527652dd995508c8bbb650c370caf9ee66fa3eb1f7fd288bba38 tests/test_public_workflow_integrity.py -da7f883fb0ab8ea740bd2f9b578ad254a093b6778572e5698fc83797b3673022 tests/test_release_metadata.py +403ea9fda204331b64bd6d5a11a880f4b097111851786f322443dd34c15f79b8 tests/test_release_metadata.py d4c53d2c260b635d70fa211029d608f63776e0a56c20253475fa47c58363f8a7 tests/test_state_io.py 98a33c75b33ff0c10a68e04bd856e4e43b3e70b6ae1ea458a2b21b4e4d74f46d tests/test_state.py -58c06925ccf06c4feee19b927b3515c540c0536aa5f3f8d29be35b8e919915a7 tests/test_temporal.py +94160a981a2dd4af998e911580b52f4ecb1b4d00a638b285ba04754de29092f6 tests/test_temporal.py 970e8206c033c60d241732fc86f37018ffad2d66483ba235dd0eb39936ff718e tests/test_timeline_video.py 912661d91c7f11f5fcaf0bd14d7d3ecf5c74c33b1507272f0ae72af6e5bffa6f tests/test_v2_decoder.py -36084a4f37e56786fa82200dad3e13a6a1a1ddde4f4eb5654117a88ef2659b99 tests/test_v2_prompts.py +577b5b731bf001b4b8a3c5524d2db41c7523bacdc66e1fe20d0c74dee16c37b5 tests/test_v2_prompts.py 5dfdd4b108ba7444c0f5f371c3b1e244b5735d23136127b9818fd60738c78b68 tests/test_v2_registration.py 0a520b34b12e1d2556d50480c43318de7eab4221afb96ef4760127c8bc90c890 tests/test_v2_seam.py 74e623120a963cb96b68651b44f47a836ea8449d30ce89d749c71ffad4766d4e tests/test_v2_seeds_motion.py b42bcc0983147462d96c6b71cc4a38e846995dafa6eebefc3ae0d9bb36caf359 tests/test_v2_sequence_orchestration.py 0b5b20a8318862d167f135720e0489b8d4f93406d67c6646e052e35b03dcb876 tests/test_v2_session.py 58438c3ed814adf40cefde098a37cae00ddcb703b7e5548bbbb295e54bed5a6d tests/test_v2_widget_migration.py -f8d585eb4f31bc315b64294213fa25b52ca0d2ba8da2ff02ab571fb1b6db01e4 tests/test_v217_stable_facade.py +745de9fedfe48e4d59078bfeb7badb4b3005878294e406072c9601135facb3fe tests/test_v217_stable_facade.py 78bc478a5e4edda902c80849c911782a99e75c06dfb04127391b6cc5b27b28e1 tests/test_v3_hardening.py eb5b27f8f0d79529c56ef344a5601703642c3cba5388c9768116223e2ed58a36 tests/test_v3_video_seam.py -1f5310587d05eb5058ec94d9985138d25aa22b22fb0dd5c68518f2f2053116a4 tests/test_v31_run_storage.py +b4b6db60c3b95a2773cf0b165b34e6278470ab5fd9d00f13e6e0e529b5f643b4 tests/test_v31_run_storage.py 3af78ab85c8e19dee8d0a98bfd11a2c0e88c30d87256da1f9699c49a19a684e9 tests/test_v32_reference.py 72719bcd6686d84f518d80751e3754b875d34c2aa72e2183dfa05ac9158a9eb0 tests/test_v34_driving_audio.py -8b75c23dccfd1ac302596187f2fbbd1c9b71fddcb5e666aa4f9eedfd8b5b4b93 tests/test_v35_compact_ui_frontend.py +0afe1291a6f24d967a385e1c6c59fe581bdf2b9132f0030a67406cab92a06852 tests/test_v35_compact_ui_frontend.py cf1ca6342a89e4cb02b398b32edbe91b6c1353535383e9f51d459466305a0114 tests/test_v35_conditioning_bridge.py -7c04f6bcdb62ac0faae911cbe4414dff859b0dac79380ec7053b3e3130f434d6 tests/test_v35_context_sampler.py +f41ebbb64a9cab7dd74e97a149b25d8a15681b3a38003ec00b5baf4b6003b905 tests/test_v35_context_sampler.py 1de83989a361cd23af8a38686e27740eafd62299123c71a110dd5c0a337d136e tests/test_v35_hires_fix.py 9ceac8c3c6e4e57ec8b53b48f3b547c204df36a3f6281328aa9ab5ebc2e6a0b6 tests/test_v35_latent_resize.py 59a07f2172014dfdc0a447775324d7cd049f20b823276dfaf9b7b3f79628f5a8 tests/test_v35_pixel_vae_resize.py @@ -131,35 +132,39 @@ cf1ca6342a89e4cb02b398b32edbe91b6c1353535383e9f51d459466305a0114 tests/test_v35 167d19efa7194c4dc52e39c3068d501023891e9a1dfba2ccf52440e7ca0d12fc tests/test_v35_second_pass_sampling.py 63d18643701c7d8be7b45046e6dc76616565572180afa06b7582600bd6c32431 tests/test_v351_reference_audio_ui.py 5003c5f5ce1a4b4c77deb47011431e4a15fe0cecaeb6d689e0d0878567c42f5a tests/test_v351_reference_audio.py +5f70cf8bd5248120ffcbe75ff3a54e23030fa6eb318ab0de6e0b08ee20e25a87 tests/test_v36_chunk_duration.py +bf69d1ac3fc30f963b6fed6cbd661f273593904b03275467427a954fbdc0a03f tests/test_v36_masked_video_prefix.py +04b17a9fdb7d01aab220922a53c2373aa6dd6b0dfee28f298dd37362ee43ed8b tests/test_v36_public_sampler.py 0dbe8a5f71c92f3523942343b40787104c8b96781461ba3ba82934a6bdbe5834 THIRD_PARTY_NOTICES.md f218e1a93c42467c6057c5c1d04d57cc82f6331b97ec9257e4e2dfb9c831876a timeline_video.py e5a84569953ee63b9625f4f2e3195ec368204fddcfc746564cfbd0e8449bb8e9 tools/p20_file_backed_tensor_poc.py -b2d512bccb324e2022de24538ed4de1f3d7cdf3bfc749d8a7cf206cb86d74170 tools/verify_runtime.py +74a027ac89796e2862b84e98c210dde7f58c29f6e283f28a0e8c5336731412d6 tools/verify_runtime.py ffd61f3f31c9b6430e1169007ee906c8f5000eba63ee44e2976ad4f5f1112671 v2/__init__.py 2003902c87bba09cfa143f5a9e4248f3a78c0fb544449a75fd40ba2cacb35655 v2/context_diagnostics.py cde27db19b677e318cc4dfb4235be7a11429c19945f4083052a91fe117e74c82 v2/decoder.py 31012ec48a64c7467ad869c79982b7f8502c1785c33f51ee1b5727ce8b4243fb v2/diagnostics.py 8fe649acb25c36361c042807b828c545d8febf760f9ba0187fbec3e69698064e v2/h3_builder.py aea01a48a8c03a25ed97ea05e5b137f89e388832d1be7d38f2da2be3d1b9830b v2/motion.py -ecc54e49e727bdaa9c2c3d8a31a8c04912a9d66b87d8f519c5512d033ac9c10c v2/nodes.py -3c2145d47924b53f8f6ec50806f1b7113120ac314142d8b7809c4f2064ad6aef v2/prompts.py +b65e97199e230b3ef46231a011896b6d6b9e63aa5a302a4c2e35bc4f969be238 v2/nodes.py +935d27536fa0fb8825ed3b1a9a21a974d19bde1e57a4e7c52f1cdc6803da7d69 v2/prompts.py 4080f1875b958b316e8e76852c4be5527a6de5c71d604e7642d3098478eb4a36 v2/sampling.py 2fd811794c4cc0f2ce050250b80484876454926b9f20fce6af3a97d728e5acdf v2/seam_guard.py be0d8585fa57e0ccd6d02577bbc7299629e5bfe20e186747f571fccc98b67d7e v2/seam_types.py 12cfcc0c71ca087fe39a5ce2922959a62b2bb311bfe664f05c4480affce03708 v2/seeds.py -81f3438f01e8619b696d7c669a1025f3edab77085ee337e778afe10816b1ddd3 v2/sequence.py +5f0830991cd9e59f4cf005daf8bc0071311b7f2ff9061d5f161000df8160e295 v2/sequence.py 13213e7709fd02bb810af3c18e4cd7d010f8cdfb121a4b99866a9f2333331089 v2/session_io.py 3ea23dbce6fcd217b6e81235855479b9b16fed7a21693cf156f9014555c4fe13 v2/session.py 78c830cdf49034c6e3b2cd3da5914d5cfc5638eb63ec6dbd1bab13c50d6d4caf v3/__init__.py b3dc61503d35d9ef0a0dc7fed1c9b2fdc00fcb2072d4e39f64ae0826f9ec7dca v3/assembly_v35.py 7815230e0a9540bc2edeaf818e940b7a1fdd817fd217ba8a4f9cb21aaf6a308e v3/assembly.py 3f62fdb35e804f42d7cbf0828b4e87e69a2b99246c3f7467fe4fa698f1d803c9 v3/conditioning_bridge_nodes.py -9d152ca205b223dd2dca7c3084a8104656c3922592ab5a383d2be58e2161beb8 v3/driving_nodes.py +65efe427278ef95b084ad7dfad8d3a05314ce123e3c2d79489d43979b39f02d7 v3/driving_nodes.py 6cc7ed74666084c55beb9075304e92a9defafd81b9c6678239ca3859a08cddd7 v3/file_backed_buffer.py 039f03431c341aa0229f749699fd92272c77097e00b08649aded8328dfd83970 v3/hires_fix_nodes.py 0858487e2b8c0060a856273ffc65d23165b2f253d183f506e27e419aea0da561 v3/latent_resize_nodes.py +5b8a54e67a608e757a505abc712effb33312636e3bb235835a485a506e80eeee v3/masked_continuation.py 85477badd85281cfb77582fdd5b34228a9f6b68376f1b7743af2ca7d4b55aa36 v3/memory_attribution.py -baac3d52d5d8f96b77ebb505e270c0c63c39b3758dcca26795d375d2c813bad7 v3/nodes.py +84321562a347c72bfdef2bbebae8b680cb4202d2a47d15b8d275950a309a8d4a v3/nodes.py b7c4a35a5e73f528492bc6946b97b687c412f1d3f5f976c19d45c6dc20288c9a v3/pixel_vae_resize.py 34ea38c03b6322288d88fc8595e3655a7a7afddb51709142a954eb7349f71ac2 v3/plan.py 10eaab14eb8a70dea3345bf8bb20069d78ec5464aef5542a9a80f1ccfdeeb9b0 v3/refine_context.py @@ -168,6 +173,6 @@ da5edf3b4392c41e12ef73a0cd21799be42a327b18bd5a6989447b75163dcab1 v3/second_pass 23a412ce55797cbe6ea19c4379053855ff21bca233e3c373577225b761cc03d0 v3/second_pass.py 4178dcfa442abdb06ce276e05bd7bcbaa6da28469ba5e57d3da3c663de4e4a9d v3/video_seam_v35.py 2f07ace1462644f0bee553827b3571535de4d0c2d9ef847bd9e0ca73a4eed5cb v3/video_seam.py -070b70636a92548ec75250fa75dae59f66fb72771cd4f70dc6dcfa619dd0d39e version.py -96b2f9aa1d20677433c46d225b8da26ab5379e4f0419e6d5e091a5c821898bb3 web/project_id.js +4bf43091d9a5cf15afe7bf80368b65d23454c3d80713c76fa1180bd2c96179e9 version.py +8eaaacd469c333d83bed0c83997014f256b2ca70fc2ba620c6a4a5648544b34e web/project_id.js 0cf8d49bcb71b30437dc893f6218dc4cfb1cd244b647e4fbc2861dea2271a33a web/reference_audio_ui.js diff --git a/PACKAGE_INFO_JA.txt b/PACKAGE_INFO_JA.txt index 526a9a1..4455520 100644 --- a/PACKAGE_INFO_JA.txt +++ b/PACKAGE_INFO_JA.txt @@ -1,7 +1,15 @@ -ComfyUI-H3-Continuum V3.5.3 +ComfyUI-H3-Continuum V3.6.0 MiniMax H3の5秒ChunkをAV latent contextで継続し、長尺映像として組み立てるComfyUIカスタムノードです。 +V3.6.0: +- H3 Continuum Sampler V3.6を追加 +- 標準Continuationは前ChunkのVideo/Audio latentを次Target内でNoise Mask保護するMasked AV方式 +- AdvancedのCompatibilityで従来V3.5 Reference Contextへ切替可能 +- Run Storage identityをbackend別に分離し、Terminal Mergeのlogical [2,3]はphysical group単位で再利用/再生成 +- chunk_seconds上限を30秒へ拡張(5~15秒を推奨・検証済み範囲として維持) +- V3.5.3、V3.4 Node ID、保存済みWorkflow、Second Pass、Hi-Res Fix、Assemblyを維持 + V3.5.3: - 公開Conditioning Bridge WorkflowのWidth/Height接続を修正 - 公開V3.4/V3.5 Workflowの孤立link IDを清掃し、全配布Workflowのserialization整合性テストを追加 diff --git a/PACKAGE_VALIDATION.txt b/PACKAGE_VALIDATION.txt index 9b60b0c..e504a89 100644 --- a/PACKAGE_VALIDATION.txt +++ b/PACKAGE_VALIDATION.txt @@ -1,6 +1,6 @@ -ComfyUI-H3-Continuum V3.5.3 package validation +ComfyUI-H3-Continuum V3.6.0 package validation -Status: V3.5.3 distribution-integrity maintenance hotfix. V3.5.2 generation behavior and optimization contracts are unchanged. Stable V3.5 paths, Conditioning Bridge, Reference Audio, Prompt/CLIP cache reuse, and Video Guide memory optimization remain validated. Seed widgets use standard ComfyUI behavior. Integrated Hi-Res Fix remains Experimental. +Status: V3.6 Production release. Standard continuation uses Masked AV; Advanced Compatibility retains the V3.5 Reference Context route. Run Storage revisions are backend-scoped, Terminal Merge remains physical-group atomic, and all V3.5.3/V3.4 public node IDs and saved-workflow contracts remain available. Integrated Hi-Res Fix remains Experimental. Required automated checks: - python -m compileall -q . @@ -8,6 +8,12 @@ Required automated checks: - python tools/verify_runtime.py --comfy-root Validated runtime paths include: +- H3 Continuum Sampler V3.6 Standard / Compatibility backend mapping without exposing internal transport identifiers +- Masked AV protected Video/Audio prefix bit-exact finalization +- Run Storage Save, Auto Resume, and Regenerate From with backend-scoped revisions and atomic Terminal Merge reuse +- Reference Image and Reference Audio retention in every Masked physical group +- 3x5 FL2VA Long Terminal Merge Masked GPU acceptance and PIG-3 subjective Audio PASS +- Shared 4.0-30.0 second chunk duration range; 5-15 seconds remains the recommended and validated range - V3.5 refine-context contract and Advanced Second Pass Bridge - Conditioning Bridge MODEL / CONDITIONING alignment per physical group without CONDITIONING-entry flattening - Permanent Python-defined Reference Audio sockets, workflow save/reload widget alignment, and conditioning retention @@ -30,7 +36,7 @@ Validated runtime paths include: - Audio Seam Auto - Video Seam Auto guarded transient and micro-flash correction -Latest verified automated result: 495 passed. +Latest verified automated result: 527 passed. Hi-Res Fix and Auto 2 remain experimental. Main 3x5 2x is not accepted on the tested RTX 5060 Ti 16 GiB because the terminal 77T Second Pass group exceeded VRAM; longer Reference/Hybrid acceptance remains pending. diff --git a/PROJECT_STATE.md b/PROJECT_STATE.md index 88e726f..7b9ead6 100644 --- a/PROJECT_STATE.md +++ b/PROJECT_STATE.md @@ -10,7 +10,104 @@ - E2-8A Contract, E2-8B1 CPU/static validation, E2-8B2 external LBH GPU PoC, and E2-8C Second Pass GPU acceptance are formally PASS. The E2-8C CPU baseline is `260 passed`. - External LATENT nodes may discard custom dictionary metadata. Identically shaped group reordering therefore cannot be cryptographically detected; count, position, T, geometry, and audio-shape checks are enforced. -Updated: 2026-08-26 +Updated: 2026-08-27 + +## V3.6.0 public release implementation (2026-08-27) + +- Added the new public `H3ContinuumSamplerV36` / `H3 Continuum Sampler V3.6` without replacing or redirecting V3.5.3/V3.4 nodes. Its final required widget is `Continuation Backend` with only `Standard` and `Compatibility`; internal transport identifiers are not exposed. +- `Standard` selects accepted Masked AV when Audio Continuity is ON and accepted Masked Video when it is OFF. `Compatibility` selects the original Reference Context route. Existing V3.5.3 remains on Reference Context with its prior schema and widget sequence. +- Added `examples/workflows/MiniMax_H3_Continuum_V36.json` as the recommended template, retaining the V3.5 template unchanged. Version/package metadata and English/Japanese release documentation are updated to 3.6.0; V3.5 Second Pass, Hi-Res Fix, Conditioning Bridge, V3.5 Assembly, and older workflows remain available. +- The public-node GPU Smoke used `H3ContinuumSamplerV36` directly through the normal API, not the private diagnostic node: Standard backend, 2x5-second I2VA + Reference Image + Reference Audio, 384x384, four steps, Audio Continuity ON, Audio Seam Auto. Prompt `1cff2ce7-6587-4d71-903d-b04bb304fdd5` completed successfully in `65.21s`; the report confirms a 22f/37T masked AV target prefix on chunk 2. +- Smoke output is `D:\output\video\comfy_video\video\V36_Release_Smoke_Reference_AV_Standard_00001_.mp4`: finite 384x384, 240 frames, 24 fps, 10.000-second video, and 32 kHz stereo 10.000-second audio. Evidence is `D:\Codex\_test_results\ComfyUI-H3-Continuum\v360-release-smoke\20260827_172835`. +- Source focused release validation is `81 passed`; final full source validation is `527 passed` with only the known `pynvml` FutureWarning. V3.6.0 WAN runtime verifier, JavaScript syntax, changed-file `py_compile`, the 178-entry Manifest, README link validation, and source/runtime SHA-256 equality for 12 Production files all pass. The live API queue is empty and the V3.6 backend remains running. +- Accepted snapshots are `pre-v360-public-release-accepted-20260827_171442` (212 Git-visible source files) and `pre-v360-public-runtime-wan-20260827_172531` (the five runtime files changed for public registration/version/UI). Final repository validation is complete; commit/push/release are the remaining publication actions. + +## V3.6 Production Integration Gate (2026-08-27) + +- PIG-0 through PIG-5 are complete. The Masked AV backend and V3.6 public/default promotion are **PASS**. During the gate, published/default V3.5.3 remained `reference_context_v1` and no public schema changed; the separately authorized V3.6 UI/version implementation is recorded above. V3.5.3 and V3.4 behavior remains unchanged. +- Run Storage now scopes only nondefault continuation transports. `reference_context_v1` retains its exact legacy identity/revision behavior, while `masked_av_prefix_22_v1` records `continuation_transport` in both the identity and Sampling Contract. Reference and Masked chunks therefore cannot be mixed. +- The integration gate also found and fixed a pre-existing resume defect: temporary Run Storage Sessions did not restore Terminal Merge `execution_semantics`, so an apparently valid prefix was discarded before Sampling. Resume Sessions now carry the stored execution semantics, and the reported reuse count is synchronized after atomic terminal-pair pruning. +- Real-cache PIG-2 PASS evidence is under `D:\Codex\_test_results\ComfyUI-H3-Continuum\v36-production-integration\v36_pig2_masked_20260827_164303`. Initial Save used `0 reused / 3 generated`; Auto Resume used `3 / 0` with zero Sampling calls; Regenerate From Chunk 2 and Chunk 3 each used `1 / 2` and exactly one `77T Video / 433T Audio` terminal physical Sampling call. Neither request reused or sampled only one logical half of the terminal pair. +- PIG-1 CPU coverage proves that Reference Image and standalone Reference Audio remain present exactly once in every normal and Terminal physical group under Masked AV, with no old continuation Reference block. PIG-3 then completed a representative 2x5-second I2VA + Reference Image + Reference Audio GPU run at 384x384 / 4 steps. Both physical groups contained image/audio references, protected Video/Audio prefixes finalized bit-exact, and the final output is finite 240 frames / 24 fps / 10.000 seconds with 10.000-second stereo audio. +- PIG-3 evidence is `D:\Codex\_test_results\ComfyUI-H3-Continuum\v36-production-integration\pig3-reference-masked`; output video is `D:\output\video\comfy_video\video\V36_PIG3_Reference_Image_Audio_Masked_AV_00001_.mp4`. At the retained 124-frame boundary with existing Audio Seam Auto, the sample jump is `0.004261`, below the local median (`0.005129`) and only `0.0876x` the local p99; PCM is finite. This representative numeric gate is PASS, but prior R2 seeds show mixed Seam-Auto improvement, so no universal click-removal claim is made without listening/generalization. +- PIG-5 policy is fixed: V3.6 uses Masked AV as the standard continuation backend and retains Reference Context only as an Advanced compatibility fallback. Raw transport implementation names are not exposed in the UI. Run Storage identity remains transport-scoped, Terminal Merge regeneration remains atomic per physical group, and Audio Seam Auto remains an independently evaluated post-Sampling feature. This gate preceded the separately recorded V3.6 public UI/default implementation above. +- The accepted PIG-3 output passed subjective listening: no click, dropout, unnatural stereo positioning, or other audible boundary defect was reported. PIG-5 and V3.6 public-promotion eligibility are therefore **PASS** without reopening the completed structural, cache, Reference, Terminal Merge, or Audio Seam numeric gates. +- Final validation is `61 passed` focused and `521 passed` full pytest with only the known `pynvml` FutureWarning. Changed-file `py_compile`, V3.5.3 WAN runtime verification, source/runtime SHA-256 equality for `run_storage.py`, `v2/sequence.py`, and the diagnostic node, `git diff --check`, and empty API queue all pass. +- Accepted pre-change snapshots are `pre-v36-production-integration-pig0-accepted-20260827_161517` and `pre-v36-production-integration-pig2-diagnostic-accepted-20260827_162943`. Commit/push were not performed, and the ComfyUI_WAN backend remains running. + +## V3.6-R2 FL2VA Long Terminal Merge multi-seed GPU gate (2026-08-27) + +- The shortened final gate is **PASS for the private GPU research path**. Published/default V3.5.3 remains `reference_context_v1`; no public node/schema, saved-workflow contract, V3.4 behavior, Sampling implementation, Assembly, Seam, or Run Storage behavior changed. +- Accepted evidence consists of Seed `238985343135606` full Gate A, Seed `238985343135607` full `reference_context_v1` versus `masked_av_prefix_22_v1` comparison plus cache-only Audio Seam OFF derivatives, and Seed `238985343135608` Masked AV structure/practical acceptance. The redundant Seed 608 Reference run was intentionally omitted. +- Every measured run retained 3 logical chunks and 2 physical groups. Group 1 is `124f / Video 37T / Audio 207T`; Terminal Group 2 is logical `[2,3]`, `paired_timeline_v1`, `terminal_merged=true`, trim `22f`, `260f / Video 77T / Audio 433T`. Physical seeds were `15439951268068580545`, `4181078118376080811`, and `6961917749643595863` for Seeds 606–608. Final outputs are finite `640x640`, `360f`, `24fps`, `15.000s`, with 15.000-second audio. +- Seed 606 and 607 Group 1 Video/Audio hashes are identical between Reference and Masked routes. For all three Masked runs, Core raw protected-prefix drift was at most `2.384185791015625e-07` Video and `5.960464477539063e-08` Audio; scoped final restore produced bit-exact 7T Video and 37T Audio prefixes with SHA-256 equality and maximum difference `0`. Generated regions were not restored. +- Terminal Group 2 PackedLayout was `35,865` rows for Reference and `32,991` for Masked, removing exactly `2,874` Reference rows (`8.01%`). CUDA-synchronized Group 2 Sampling was `574.134 -> 529.933s` for Seed 606 and `560.782 -> 544.413s` for Seed 607. Both paired comparisons favor Masked; paired percentage median is `5.31%`. Reference/Masked time medians are `567.458s` and `544.413s`, respectively (`4.06%` lower by median comparison). Seed 608 Masked was `549.704s`. +- Across the five main runs, monitored process peak RSS median was `9.674 GiB`. Maximum observed whole-device usage was `15.646 GiB`; this is an order-sensitive device-used monitor, not only Continuum allocation. Terminal-group CUDA allocator peak was about `4.06 GiB` for Reference versus `3.80 GiB` for Masked. No OOM, NaN/Inf, or retained-GPU-prefix regression occurred. +- Contact sheets covering nominal 5/10/15-second positions and actual retained boundaries `124f/243f` show no obvious flash, pose collapse, direction reversal, or temporal break in Seeds 606–608. Decoded audio is finite, exactly 15 seconds, and has no >=200 ms dropout below -50 dB. Existing Audio Seam Auto strongly improved Seed 606 Masked jumps (`0.035014 -> 0.002018` at 124f; `0.004495 -> 0.003130` at 243f), but Seed 607 was mixed (`0.059640 -> 0.133805` at 124f; `0.021297 -> 0.019704` at 243f). Therefore no universal click-removal claim is made from numerical jump alone. +- Final validation is `516 passed` with only the known `pynvml` FutureWarning, after rerunning with a fresh writable basetemp because the inherited global pytest temp root denied access. V3.5.3 WAN runtime verification, source/runtime SHA-256 for seven synchronized Production/diagnostic files, `git diff --check`, and empty API queue pass. The backend remains running as requested. +- **Production promotion: HOLD.** FL2VA/Terminal Merge structure, multi-seed execution, integrity, and performance are accepted, but Reference conditioning variants, Run Storage/resume identity, public UI/default-policy decisions, and broader audible Audio Seam acceptance remain outside this gate. Evidence: `D:\Codex\_test_results\ComfyUI-H3-Continuum\v36-fl2va-combined-20260826\gate-a` and `...\r2-short`. Pre-change snapshot: `pre-v36-r2-short-gate-20260827_000840`. Commit/push were not performed. + +## V3.6 shared chunk-duration range (2026-08-27) + +- V3 Production, V3.4/V3.5 inherited schemas, the V2 compatibility sampler/facade, and Prompt Plan Preview now share `chunk_seconds`: default `5.0`, minimum `4.0`, maximum `30.0`, step `0.1`. +- One `chunk_seconds` value still applies to every logical chunk. Per-chunk variable durations were not added; Assembly, Timeline, Continuation, and Run Storage retain the shared-duration contract and existing workflow inputs remain compatible. +- `5–15s` remains the recommended and validated range. `15–30s` is usable rather than hidden/experimental, with a shared tooltip warning that high resolution can substantially increase VRAM use and processing time. +- Prompt Plan creation and validation accept `30.0` and reject values above it. Timeline mapping was verified for `[0-30s]` / `[30-60s]`. Temporal extension tests now cover the complete `4.0–30.0s` UI range and preserve the existing native H3 `17k+5` grid. +- The only remaining `max: 15.0` is the separate legacy V1 `H3ContinuumJoin.extend_seconds` control; it is not `chunk_seconds`, is not used by the V2/V3 Production path, and was intentionally left unchanged. +- CPU/static acceptance is PASS: focused duration and inherited-schema validation `89 passed`; canonical full pytest `516 passed`; changed-file `py_compile`, `git diff --check`, runtime verifier, source/WAN SHA-256, live API schema, and empty queue all pass. ComfyUI_WAN was restarted with Sage Attention and `--disable-pinned-memory` and remains running. +- A validation-only GPU launch used one T2VA chunk, `chunk_seconds=30.0`, `384x384`, one Sampling step, and fixed seed `238985343135609`. API prompt `9e665f85-b32f-4b17-9734-219fb284e087` was accepted with no node errors and entered H3 model initialization/Sampling without duration, shape, Prompt Plan, immediate OOM, or NaN/Inf errors. Per user scope, it was interrupted after `31.87s` rather than decoded or saved; this is an execution-entry smoke PASS, not a completed 30-second quality/performance acceptance. Queue returned to `0/0`. +- The previously prepared FL2VA joint multi-seed run was cancelled at the user's request. Only its one-step cache warm-up completed; the first measured run was interrupted before node execution and is not acceptance evidence. +- Accepted snapshots are `pre-v36-chunk-duration-30-source-20260826_234716` (209 Git-visible source files, zero missing/mismatch) and `pre-v36-chunk-duration-30-wan-runtime-20260826_235423` (four exact runtime files). Commit/push were not performed. + +## V3.6-R2-2 Balanced 22f / 37T Joint AV GPU gate (2026-08-26) + +- R2-2 is **PASS as a one-seed GPU structure/performance gate with the existing Audio Seam Auto path**, not a Production promotion. The accepted pair used T2VA 2x5 seconds, 640x640, Balanced 22, Audio Continuity ON, fixed seed `238985343135605`, Prompt/CLIP cache HIT, CUDA synchronization, Sage Attention, `--disable-pinned-memory`, Exact Duration ON, and no First/Last/Reference/Video Guide/Run Storage/Spectrum/Sol/Video Seam. +- Added only the private `masked_av_prefix_22_v1` research transport. It preserves the existing Balanced contract: Video prefix `22f = 7T = 0.916667s`, Audio prefix `37T = 0.925s`, an intentional mask-boundary asymmetry of `1/120s = 8.333ms`, target `141f / Video 42T / Audio 235T`, trim `22f`, and net new `119f`. Public V3.5.3/V3.4 schemas and defaults remain unchanged. +- Masked finalization is exact: source Video tail and finalized target Video prefix are bit-exact with max diff `0`; the same holds for the Audio 37T tail/prefix. Core raw output before the scoped restore differed by at most `2.384185791015625e-07` for Video and `5.960464477539063e-08` for Audio. Only the protected prefix regions are restored; generated regions remain sampler-owned. +- Reference continuation used `20,205` packed rows (`2,800` video-reference rows plus `74` audio-reference rows); Masked AV used `17,331` rows with no reference block or old Spectrum interop hint. The `2,874`-row reduction is `14.22%`. Synchronized continuation Sampling was `226.373s -> 206.437s`, an `8.81%` reduction; whole API time was `435.907s -> 420.752s`, a `3.48%` reduction. This is one-seed evidence, not a universal performance claim. +- Both routes produced finite `640x640`, `240f`, `24fps`, `10.000s` outputs. Eight-frame boundary contact sheets show no obvious pose snap, direction reversal, camera collapse, NaN/Inf, or masked-prefix visual regression. +- With Audio Seam OFF, Reference boundary jump was `0.082725`; Masked AV was worse at `0.268163` (`7.57x` its local p99 and the `99.9989` file-wide percentile). Reassembling the same cached Masked latents with existing Audio Seam Auto took `7.10s` without Sampling and reduced the jump to `0.029944` (about `88.83%` lower, `0.86x` local p99, `94.31` percentile). RMS ratio also moved `1.12196 -> 0.97724`. R2 adds no new Audio Seam algorithm; raw Seam-OFF 22f/37T is not accepted as click-free. +- Evidence root: `D:\Codex\_test_results\ComfyUI-H3-Continuum\v36-r2-gate2-20260826`; accepted MP4s and the cached Audio-Seam-Auto derivative are under `D:\output\video\comfy_video\video`. Focused tests are `24 passed`; final full pytest is `510 passed`; changed-file `py_compile`, `git diff --check`, source/runtime SHA-256, runtime verifier, and empty queue all pass. Production remains **HOLD** pending multi-seed/audio listening generalization, Reference/FL2VA/Terminal Merge/Run Storage integration, public UI decisions, and final Production acceptance. + +## V3.6-R2-0 Joint AV masked-prefix CPU/static gate (2026-08-26) + +- R2-0 is implemented as a private research transport, `masked_av_prefix_39_v1`; the public/default V3.5.3 transport remains `reference_context_v1`. No public widget, Node ID, saved-workflow schema, `v2/sampling.py`, seed, Plan, trim, Decode, Assembly, Seam, Run Storage, or V3.4 contract changed. +- The exact-duration research case uses Strong 39-frame Continuity. A 39-frame video tail maps to 12 video latent slots, and the same 1.625-second duration maps to 65 audio latent ticks. The next physical target is 158 frames / video `47T` / audio `263T`, trims 39 frames, and retains 119 new frames. +- The target copies the prior finalized video tail into video `[0:12]` and audio tail into audio `[0:65]`. Full masks preserve those prefixes with zero and generate only video `[12:47]` / audio `[65:263]` with one. Old Context Reference conditioning and the Spectrum reference-context hint are not emitted. The original First Image remains attached only to chunk 1. +- After Sampling, Continuum restores only the protected video and audio prefixes from the normalized pre-sampling target. CPU regressions require bit-exact video/audio prefix equality and prove that generated video/audio regions are not restored or overwritten. +- The 39f and 65T durations are equal, but the native H3 audio grid can retain a signed source phase offset. The validated 124-frame source is `+1/3` audio tick (about `+8.33 ms`) and a 158-frame target is `-1/3` tick; this is recorded explicitly rather than described as zero-phase alignment. +- CPU/static R2-0 is **PASS**: focused masked/temporal validation `21 passed`, canonical full pytest `507 passed`, and changed-file `py_compile` pass with only the known `pynvml` FutureWarning. GPU R2-1 (`Reference Context 39f` versus `Masked AV Prefix 39f`), audio-boundary measurements, runtime synchronization, and Production promotion remain pending. +- Accepted pre-change snapshots are `pre-v36-r2-0-joint-av-source-accepted-20260826_203022` (571 files, SHA-256 mismatch 0, source revision `67a0d80117bd8332d2768d093dff343001c87d60`) and `pre-v36-r2-0-joint-av-wan-runtime-accepted-20260826_203022` (three exact runtime files). Commit/push were not performed. + +## V3.6-R2-1 39f / 65T Joint AV GPU structure gate (2026-08-26) + +- R2-1 is **PASS as a GPU structure/interoperability gate**. It is not a Production promotion. The accepted pair used T2VA 2x5 seconds, 640x640, Strong 39, Audio Continuity ON, the same fixed prompt/seed `238985343135604`, Prompt/CLIP cache HIT, CUDA synchronization around each Sampling call, `--disable-pinned-memory`, Sage Attention, and no First/Last/Reference/Video Guide/Run Storage/Spectrum/Sol/Video Seam. Reference ran before Masked after one excluded warm-up. +- `reference_context_v1` emitted Core's combined `video_audio` Reference block. Its continuation PackedLayout was `24,317` rows: target text `61`, audio `526`, video `18,800`, plus `4,800 ref_img` and `130 ref_audio` rows. `masked_av_prefix_39_v1` emitted no old refs/interop and used `19,387` rows: the identical target rows only. The measured reduction is exactly `4,930` rows / `20.27%` relative to Reference. +- CUDA-synchronized Chunk 2 host/Sampling time was `332.460s` for Reference and `241.888s` for Masked (`27.24%` lower). API wall time was `556.058s` versus `465.925s` (`16.21%` lower). This one-seed Gate is an explanatory performance signal, not a generalized speed claim. +- Masked target construction and masks passed on GPU: Video `[0:12]=0`, generated Video `[12:47]=1`, Audio `[0:65]=0`, generated Audio `[65:263]=1`; source tails matched both target prefixes. Core raw integration differed by at most `2.384185791015625e-07` for Video and `5.960464477539063e-08` for Audio. The finalized physical-group prefixes are bit-exact by SHA-256 and maximum difference `0` for both streams; generated regions are not restored. +- Both outputs are finite `640x640`, 240 frames, 24 fps, and 10.000 seconds. Boundary contact sheets at frames `112,118,123,124,125,130,136,148,160` show no gross snap, collapse, persistent artifact, or identity/background discontinuity in either route. +- With Audio Seam OFF, the exact decoded boundary sample is the global maximum single-sample jump for both routes: Reference `0.352289`, Masked `0.287521`. Masked is better but the raw hard boundary is not accepted as intrinsically click-free. The same cached Masked AV latents reassembled with the existing Audio Seam Auto in `7.23s` without re-running Sampling; boundary jump fell to `0.005774` (about `98.0%` lower and only the `37.4` percentile of file-wide sample differences), while DC jump fell `0.002789 -> 0.001103`. Therefore the existing Production seam path resolves the observed hard cut; R2 adds no new Audio Seam algorithm. +- Chunk 2 allocator peak was lower for Masked (`2,407,722,872` allocated / `2,785,017,856` reserved bytes) than Reference (`2,950,494,614` / `3,590,324,224`). Whole-process/device monitor peaks are order-sensitive and are not accepted as a memory claim from this one pair. +- Evidence root: `D:\Codex\_test_results\ComfyUI-H3-Continuum\v36-r2-gate1-20260826`; accepted MP4s are `V36_R2_Gate1_reference_39f_seed238985343135604_00001_.mp4`, `V36_R2_Gate1_masked_av_39f_65t_seed238985343135604_00001_.mp4`, and the cached Audio-Seam-Auto derivative under `D:\output\video\comfy_video\video`. The backend remains running. R2-2 22f / 37T, multi-seed/audio-quality generalization, References, Terminal Merge, Run Storage, public UI, and Production promotion remain pending. + +## V3.6-R1 masked video-prefix continuation PoC (2026-08-26) + +- V3.6-R1 is a private experimental continuation transport only. The published V3.5.3 path remains `reference_context_v1`; no public widget, Production Node ID, saved-workflow schema, V3.4 contract, Sampling implementation, seed derivation, Plan, trim, Decode, Assembly, Seam, or Run Storage contract was changed. +- `masked_video_prefix_v1` copies the previous chunk's normalized 22-frame / 7T video tail into the next 42T video target, applies a full video mask with prefix `0` and generated region `1`, leaves the 235T audio target empty with an all-`1` mask, emits neither the old `minimax_refs` video context nor the Spectrum reference-context hint, and retains the existing 141-frame physical / 22-frame trim / 119-frame net contract. +- Core v0.34.0 honors the zero-mask prefix during model calls, but its raw final integrated float32 sampler output differed from the input prefix by up to `2.38418579101562e-07`. Continuum therefore restores only the protected target prefix after Sampling. The finalized physical latent is bit-exact (`torch.equal`, maximum absolute difference `0`, and SHA-256 match); generated video and audio regions are not overwritten. +- CPU/static acceptance is PASS: focused validation `8 passed`; canonical full pytest `500 passed` with only the known `pynvml` FutureWarning; changed-file `py_compile` and `git diff --check` pass. +- GPU Gate 1 and Gate 2 ran three fixed-seed A/B pairs through the normal ComfyUI_WAN API at `127.0.0.1:8188`: 2x5-second T2VA, 640x640, 20 steps, Balanced 22, Audio Continuity OFF, Run Storage OFF, no First/Last/Reference/Video Guide, Spectrum/Sol OFF, Seam OFF, and Sage Attention enabled globally. Every run preserved two physical samples (`124f` then `141f`, trim `22`, net `119`), matching derived seeds and chunk-1 video/audio hashes. All six outputs are finite 640x640 / 240-frame / 24 fps / 10.000-second MP4s. +- All masked runs report prefix exactness, zero/one video mask regions, all-one audio mask, empty second-group `minimax_refs`, and no old interop hint. API elapsed A/B pairs were `432.67/412.73`, `409.98/386.09`, and `408.62/386.56` seconds; these single ordered pairs are diagnostic observations, not an accepted speed claim. +- The initial 2x5 T2VA contact-sheet review found no clear pose snap, direction reversal, persistent artifact, or temporal collapse in either transport, but also no consistent visual superiority. The later 3x5 Strong Motion I2VA Stress Gate adds a positive signal without yet justifying a public/default replacement. +- Before the formal I2VA gate, diagnostics found that the private masked branch reapplied the original I2VA First Image on continuation chunks while `reference_context_v1` correctly removed it under `POLICY_REPLACE`. Those preliminary runs are invalid and excluded. The private branch now attaches the First Image only to chunk 1, so the accepted A/B differs only in continuation transport. +- Formal Stress Gate conditions were 3x5-second I2VA, 640x640, Balanced 22, three fixed seeds, Audio Continuity/Run Storage/Spectrum/Sol/Seam OFF, Prompt/CLIP cache HIT, `--disable-pinned-memory`, and alternating order `R->M`, `M->R`, `R->M`. All six normal runs are finite 640x640 / 360-frame / 24 fps / 15.000-second MP4s. +- Masked continuation was faster for all three seeds. API reductions were `6.185%`, `7.491%`, and `5.544%` (paired median `6.185%`). Continuation Sampling reductions were `9.471%`, `12.029%`, and `8.309%` (paired median `9.471%`; reference `466.424s`, masked `426.798s`). A separate CUDA-synchronized seed pair still reduced continuation Sampling from `464.97s` to `437.10s` (`5.995%`), proving that the signal is not only asynchronous host timing. +- Actual Core packed layouts explain the result: continuation `reference_context_v1` is `20,569` rows (`2,800` `ref_img` rows), while `masked_video_prefix_v1` is `17,769` rows with no `cond` or `ref_img` rows. This is `2,800` fewer rows / `13.61%` below the reference layout. Peak process RSS and observed device memory remained comparable; no memory regression was accepted or claimed. +- Every masked boundary retained the finalized 7T prefix bit-exact by SHA-256 and maximum difference `0`. Boundary contact sheets found no gross snap, direction reversal, persistent artifact, or collapse. At the second boundary, automated optical-flow jerk and absolute luma/saturation drift were lower for Masked in all three seeds; flow-magnitude continuity was mixed, so this is an improvement signal rather than proof of universal visual superiority. +- R1 Stress Gate is therefore **PASS**, while Production promotion remains **HOLD**. It opened the separately specified R2 Audio-prefix research gate; the later R2-0 CPU/static result is recorded above. Feathering, References, Terminal Merge, public UI, Run Storage integration, and GPU R2 acceptance remain unimplemented V3.6 research. +- Stress evidence: `D:\Codex\_test_results\ComfyUI-H3-Continuum\v36-r1-stress-gate-20260826\normal_fair` and `sync_fair`; `analysis.json` and `contact_sheets` contain the aggregate metrics and boundary frames. Invalid pre-fairness runs under the sibling `normal` directory are retained only as diagnostic history and must not be cited. Accepted Stress snapshots are `pre-v36-r1-stress-gate-source-accepted-20260826_174839`, `pre-v36-r1-stress-gate-wan-diagnostics-accepted-20260826_174839`, and `pre-v36-r1-stress-i2va-fairness-wan-runtime-20260826_182905`. +- Final validation after the Stress Gate is `500 passed`; changed-file `py_compile`, V3.5.3 runtime verification, `git diff --check`, source/runtime SHA-256 for four R1 Production files plus the diagnostic node, and empty API queue all pass. The ComfyUI_WAN backend intentionally remains running after acceptance. +- Reusable private A/B workflow: `D:\Codex\_test_workflows\ComfyUI-H3-Continuum\MiniMax_H3_Continuum_V36_R1_MaskedPrefix_AB.json` (22 nodes, 24 links, three annotated groups, SHA-256 `0964D55DDE1671E0BB0CA04FD3DD1F0AF82A4173FB9E6D9CE75900FC9B6981CE`). It is a simplified derivative of the user-supplied V3.5 workflow and requires the ComfyUI_WAN-only diagnostic node; it is not a public template. ## V3.5.3 maintenance hotfix (2026-08-26) @@ -21,7 +118,7 @@ Updated: 2026-08-26 - Added regressions for all eight public workflow graphs and the Hybrid warning numbers. Focused validation is `30 passed`; canonical full pytest is `495 passed`, and the source/runtime V3.5.3 verifier passes native PackedLayout, Fixed 3x5 planning, and complete node registration. - The release Manifest now contains 173 files and verifies every recorded SHA-256, including the new public-workflow integrity regression. - Production files `reference.py`, `version.py`, and `metadata.ini` are synchronized to ComfyUI_W with exact SHA-256 equality. ComfyUI_WAN is excluded because that secondary runtime is an incomplete older copy and must not be partially relabeled as V3.5.3. -- Accepted snapshots are `pre-v353-maintenance-hotfix-source-accepted-20260826_030732` (199 tracked files, revision `70cbbcd`) and `pre-v353-maintenance-hotfix-comfyui-w-accepted-20260826_030731` (14 present target files). Commit and push have not been performed. +- Accepted snapshots are `pre-v353-maintenance-hotfix-source-accepted-20260826_030732` (199 tracked files, revision `70cbbcd`) and `pre-v353-maintenance-hotfix-comfyui-w-accepted-20260826_030731` (14 present target files). The maintenance release was published as commit `67a0d80117bd8332d2768d093dff343001c87d60`. ## V3.5.2 final release gate (2026-08-26) @@ -142,7 +239,7 @@ Updated: 2026-08-26 ## Baseline -- Release-candidate baseline: V3.5.3 maintenance hotfix (published baseline remains V3.5.2 until commit/push) +- Published baseline: V3.5.3 maintenance hotfix (`67a0d80117bd8332d2768d093dff343001c87d60`) - Authoritative working repository: `D:\Codex\_git_push_work\ComfyUI-H3-Continuum` - Primary tested runtime: `D:\StabilityMatrix\Data\Packages\ComfyUI_W\custom_nodes\ComfyUI-H3-Continuum` - Secondary runtime: `D:\StabilityMatrix\Data\Packages\ComfyUI_WAN\custom_nodes\ComfyUI-H3-Continuum` diff --git a/README.md b/README.md index b88e9ea..87008f1 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,28 @@ -# ComfyUI-H3-Continuum 3.5.3 +# ComfyUI-H3-Continuum 3.6.0 Long-form MiniMax H3 video generation for ComfyUI with Continuum-aware Second Pass refinement, optional Hi-Res Fix, low-memory disk-backed assembly, restartable chunks, persistent references, and optional Spectrum interoperability. +## V3.6 Masked AV Continuation + +V3.6 adds **H3 Continuum Sampler V3.6**. Its Standard continuation backend places the previous finalized Video and Audio latent prefixes directly inside the next H3 target and protects them with Core noise masks. Unlike the V3.5 Reference Context route, it does not append the same prior frames as a separate Reference block, reducing the packed sequence processed by H3. + +| Continuation Backend | Purpose | +|---|---| +| `Standard` | Recommended V3.6 path. Preserves prior Video/Audio in the next target; when Audio Continuity is off, only Video is preserved. | +| `Compatibility` | Advanced fallback using the accepted V3.5 Reference Context behavior. | + +Internal transport identifiers are not exposed in the UI. Run Storage keeps Standard and Compatibility revisions separate, and `Regenerate From` treats the Long Terminal Merge logical pair `[2,3]` as one atomic physical sample. + +### Accepted behavior + +- T2VA, I2VA, Reference Image + Reference Audio, Balanced 22-frame Joint AV, and 3×5-second FL2VA Long Terminal Merge GPU gates passed. +- Protected Video and Audio prefixes finalize bit-exact; generated regions remain owned by the sampler. +- The accepted Reference Image + Reference Audio output passed subjective audio listening with no reported click, dropout, or stereo-positioning defect. +- In the tested FL2VA Terminal Group 2 pairs, Standard removed 2,874 packed rows (`8.01%`) and reduced median Sampling time by `4.06%` versus Compatibility. Performance varies by model, hardware, and workflow. +- `chunk_seconds` now accepts 4.0–30.0 seconds with a 5.0-second default and 0.1-second step. The 5–15 second range remains recommended and validated; longer high-resolution chunks can substantially increase VRAM use and runtime. + +V3.5.3, V3.5, and V3.4 Node IDs and saved workflows remain registered. V3.5.3 continues to use its original Reference Context behavior and is not silently redirected to the V3.6 backend. + ## V3.5.3 Maintenance Hotfix V3.5.3 is a distribution-integrity maintenance release. It repairs the public Conditioning Bridge workflow's Width/Height links, removes stale orphan link IDs from the published V3.4/V3.5 templates, corrects Hybrid `` warning numbering, and repairs one legacy PNG for strict image decoders. @@ -35,7 +56,7 @@ Prompt/CLIP figures measure only the conditioning subphase, not total generation The measured Sage-only production baselines on the tested RTX 5060 Ti 16 GB / 64 GB system were 168.069 seconds for 1×5-second 576×576 T2VA and 379.765 seconds for 3×5-second 640×640 FL2VA Long Terminal Merge. These are configuration-specific baselines, not universal speed guarantees. Sampling remained the dominant cost; Continuum Assemble + Seam stayed below 1%. -> **V3.5.3 is the current maintenance release.** V3.5.2 remains the accepted Stabilization & Optimization baseline. V3.4 node IDs, backend socket keys, and saved-workflow loading remain intentionally supported. Sampling, Conditioning, Terminal Merge, Assembly, Seam, Run Storage, and standard ComfyUI seed behavior are unchanged. The withdrawn experimental Last Queued Seed override is not included. +> **V3.6.0 is the current release.** V3.5.3 remains the maintenance/compatibility baseline, and V3.5.2 remains the accepted Stabilization & Optimization baseline. Older Node IDs, backend socket keys, and saved-workflow loading remain intentionally supported. The withdrawn experimental Last Queued Seed override is not included. ## V3.5.1 Reference Audio & Compatibility Update @@ -218,12 +239,13 @@ This is a usability and reliability decision, not a claim that the experimental ## Example workflows -- [V3.5 recommended template](examples/workflows/MiniMax_H3_Continuum_V35.json) +- [V3.6 recommended template](examples/workflows/MiniMax_H3_Continuum_V36.json) +- [V3.5 compatibility template](examples/workflows/MiniMax_H3_Continuum_V35.json) - [V3.5.1 LBH + Conditioning Bridge connection example](examples/workflows/MiniMax_H3_Continuum_V351_LBH_Conditioning_Bridge.json) - [V3.4 standard](examples/workflows/MiniMax_H3_Continuum_V34.json) - [V3.4 Turbo](examples/workflows/MiniMax_H3_Continuum_V34_turbo.json) -The V3.5 template is the recommended starting point. Hi-Res Fix is disabled by default, the V3.5 Assemble backend is set to Auto, and First Frame, Last Frame, and Reference Images 1-3 share one megapixel control. `Video Guide Size` controls the frame batch used by `Video Guide Frames`; the video loader remains responsible for decoding and frame-rate conversion. Advanced users can bypass or rearrange the optional sections as needed. +The V3.6 template is the recommended starting point. It selects the Standard continuation backend; Hi-Res Fix is disabled by default, the V3.5 Assemble backend remains Auto, and First Frame, Last Frame, and Reference Images 1-3 share one megapixel control. `Video Guide Size` controls the frame batch used by `Video Guide Frames`; the video loader remains responsible for decoding and frame-rate conversion. The V3.5 template remains unchanged for compatibility. The V3.4 templates remain valid for saved-workflow compatibility. @@ -393,6 +415,12 @@ Visible controls: - Reference Size - Video Guide Size +`chunk_seconds` uses one shared duration for every chunk. The default is 5.0 +seconds; 5–15 seconds remains the recommended and validated range. Durations up +to 30.0 seconds are supported, but values above 15 seconds can substantially +increase VRAM use and processing time, especially at high resolution. Per-chunk +variable durations are not supported. + ### H3 Continuum Assemble + Seam V3.4 Inputs: images, audio, assembly_plan, and driving_audio. @@ -485,6 +513,7 @@ The time ranges should normally match the configured `chunk_seconds`. - `chunk_seconds = 5` → `[0-5s]`, `[5-10s]`, `[10-15s]` ... - `chunk_seconds = 10` → `[0-10s]`, `[10-20s]`, `[20-30s]` ... - `chunk_seconds = 15` → `[0-15s]`, `[15-30s]`, `[30-45s]` ... +- `chunk_seconds = 30` → `[0-30s]`, `[30-60s]`, `[60-90s]` ... #### Global preamble and per-chunk prompting @@ -607,7 +636,7 @@ Use a 24 fps source for `Video Guide Frames`. `Load Video (Upload)` may accept f ## Current validation status -The V3.5.3 maintenance gate passes `495` automated tests, including all published-workflow link integrity and Hybrid public-picture warning regressions. Source/runtime registration verification, native PackedLayout, Fixed 3x5 prompt planning, JavaScript UI harnesses, release metadata consistency, Prompt/CLIP MISS-to-HIT output equality, and Video Guide bit-exact GPU A/B acceptance remain valid. Earlier representative GPU acceptance also covers the V3.5 Conditioning Bridge path, Reference Audio/Image retention, Second Pass/Hi-Res paths, and accepted 3x5 FL2VA Long Terminal Merge latents through Core Video/Audio VAE Decode and Assemble V3.5 Auto. +The V3.6 release gate includes the complete PIG-0 through PIG-5 Production Integration acceptance: backend-scoped Run Storage, real-cache Save/Resume/Regenerate From, atomic Terminal Merge reuse, Reference Image/Audio retention, bit-exact protected prefixes, GPU workflow output, numeric Audio Seam analysis, and subjective Audio PASS. Final automated validation is `527 passed`; the complete package checklist is recorded in `PACKAGE_VALIDATION.txt`. Source/runtime registration, native PackedLayout, Fixed 3x5 prompt planning, JavaScript UI harnesses, Prompt/CLIP cache equality, Video Guide bit-exact A/B, V3.5 Second Pass/Hi-Res, and V3.5.3 distribution-integrity checks remain covered. V3.4 compatibility paths have been exercised locally with: diff --git a/README_JA.md b/README_JA.md index 285bfed..7ebc856 100644 --- a/README_JA.md +++ b/README_JA.md @@ -1,7 +1,28 @@ -# ComfyUI-H3-Continuum 3.5.3 +# ComfyUI-H3-Continuum 3.6.0 MiniMax H3を複数チャンクで連続生成し、直前チャンク末尾の**映像latent / 音声latentを直接**次チャンクへ継承するComfyUIカスタムノードです。チャンク間でVideo/Audio VAEのDecode→Encodeは行いません。 +## V3.6 Masked AV Continuation + +V3.6では`H3 Continuum Sampler V3.6`を追加しました。標準backendは、前Chunkで確定したVideo/Audio latent prefixを次のH3 Target内へ直接配置し、CoreのNoise Maskで保持します。V3.5のReference Context方式のように、同じ過去フレームを別Reference blockとして追加しないため、H3が処理するpacked sequenceを短縮できます。 + +| Continuation Backend | 用途 | +|---|---| +| `Standard` | 推奨V3.6経路。次Target内でVideo/Audioを保持します。Audio Continuity OFF時はVideoだけを保持します。 | +| `Compatibility` | 受入済みV3.5 Reference Context動作へ戻すAdvanced fallbackです。 | + +内部transport識別子はUIへ表示しません。Run Storage revisionはStandard/Compatibilityで分離し、`Regenerate From`でもLong Terminal Mergeのlogical `[2,3]`を1つのphysical sampleとして再利用・再生成します。 + +### 受入結果 + +- T2VA、I2VA、Reference Image+Reference Audio、Balanced 22-frame Joint AV、3×5秒FL2VA Long Terminal MergeのGPU GateをPASS。 +- 保護Video/Audio prefixは最終的にbit-exact。生成領域はSamplerの出力を維持します。 +- Reference Image+Reference Audio代表出力は実聴PASSで、click、dropout、定位異常の報告なし。 +- 実測したFL2VA Terminal Group 2では、StandardがCompatibilityよりpacked rowsを2,874行(`8.01%`)削減し、Sampling中央値を`4.06%`短縮。速度はmodel、hardware、workflowで変わります。 +- `chunk_seconds`は4.0~30.0秒、初期値5.0秒、step 0.1です。5~15秒を推奨・検証済み範囲として維持し、長時間・高解像度ChunkはVRAMと処理時間が大きく増える場合があります。 + +V3.5.3、V3.5、V3.4のNode IDと保存済みWorkflowは維持します。V3.5.3は従来Reference Contextのままで、V3.6標準backendへ暗黙に切り替えません。 + ## V3.5.3 Maintenance Hotfix V3.5.3は配布整合性だけを修正するメンテナンス版です。公開Conditioning Bridge WorkflowのWidth/Height接続、V3.4/V3.5テンプレート内の孤立link ID、Hybridの``警告番号、厳密な画像decoderで読めなかった旧PNG 1件を修正しました。 @@ -35,7 +56,7 @@ Prompt/CLIPの数値はconditioning区間だけで、総生成時間ではあり RTX 5060 Ti 16 GB/RAM 64 GBの検証環境で測定したSage-only Production baselineは、576×576 T2VA 1×5秒が168.069秒、640×640 FL2VA Long Terminal Merge 3×5秒が379.765秒です。環境・設定固有の測定値であり、すべての環境に対する速度保証ではありません。Samplingが最大コストで、Continuum Assemble + Seamは1%未満でした。 -**V3.5.3が現在のメンテナンス版です。** V3.5.2は受入済みStabilization & Optimization baselineとして維持します。V3.4 Node ID、backend socket key、保存済みWorkflow読込は維持します。Sampling、Conditioning、Terminal Merge、Assembly、Seam、Run Storage、ComfyUI標準Seed動作は変更していません。撤回済みの実験的Last Queued Seed overrideは含まれていません。 +**V3.6.0が現在の公開版です。** V3.5.3はmaintenance/compatibility baseline、V3.5.2は受入済みStabilization & Optimization baselineとして維持します。旧Node ID、backend socket key、保存済みWorkflow読込は維持します。撤回済みの実験的Last Queued Seed overrideは含まれていません。 ## V3.5.1 Reference Audio/互換性更新 @@ -156,10 +177,11 @@ Hi-Res Fixを接続しなければV3.4 Sampling経路は変わりません。強 ## 推奨テンプレートワークフロー -- [V3.5推奨テンプレート](examples/workflows/MiniMax_H3_Continuum_V35.json) +- [V3.6推奨テンプレート](examples/workflows/MiniMax_H3_Continuum_V36.json) +- [V3.5互換テンプレート](examples/workflows/MiniMax_H3_Continuum_V35.json) - [V3.5.1 LBH+Conditioning Bridge接続例](examples/workflows/MiniMax_H3_Continuum_V351_LBH_Conditioning_Bridge.json) -V3.5テンプレートはHi-Res Fixが初期OFF、AssembleのBuffer BackendがAutoです。First Frame、Last Frame、Reference Image 1~3は1つのmegapixel設定を共有します。`Video Guide Size`は`Video Guide Frames`に使うframe batchを調整し、decodeとframe-rate変換はVideo loader側で行います。用途に応じて不要な補助経路を外したり、Advanced Second Pass経路へ組み替えたりできます。 +V3.6テンプレートはContinuation BackendがStandard、Hi-Res Fixが初期OFF、AssembleのBuffer BackendがAutoです。First Frame、Last Frame、Reference Image 1~3は1つのmegapixel設定を共有します。`Video Guide Size`は`Video Guide Frames`に使うframe batchを調整し、decodeとframe-rate変換はVideo loader側で行います。V3.5テンプレートは互換用として変更せず維持します。 ## V3.4互換 @@ -256,7 +278,7 @@ ZIPを展開して、`ComfyUI-H3-Continuum`フォルダーを`ComfyUI/custom_nod ## 検査 -V3.5.3 maintenance gateは全`495 passed`で、全公開Workflowのlink整合性とHybrid公開Picture番号の警告回帰を含みます。source/runtime登録検証、PackedLayout、Fixed 3×5 Prompt Plan、JavaScript UI harness、release metadata、Prompt/CLIP MISS→HIT出力一致、Video Guide bit-exact GPU A/Bも引き続き有効です。以前の代表GPU受入にはConditioning Bridge、Reference Audio/Image保持、Second Pass/Hi-Res経路、3×5秒FL2VA Long Terminal MergeからCore Video/Audio VAE Decode、Assemble V3.5 Autoまでを含みます。 +V3.6 release gateはPIG-0~PIG-5を完了し、backend別Run Storage、実cache Save/Resume/Regenerate From、Terminal Mergeのatomic再利用、Reference Image/Audio保持、保護prefix bit-exact、GPU Workflow、Audio Seam数値検証、実聴Audio PASSを含みます。最終自動検証は`527 passed`で、完全なpackage checklistは`PACKAGE_VALIDATION.txt`へ記録しています。source/runtime登録、PackedLayout、Fixed 3×5 Prompt Plan、JavaScript UI harness、Prompt/CLIP cache一致、Video Guide bit-exact A/B、V3.5 Second Pass/Hi-Res、V3.5.3配布整合性の回帰も維持します。 Main Hi-Res Fixの3×5秒2xは、RTX 5060 Ti 16 GiBで37T groupの1152×1152 Second Pass完了後、Terminal Mergeの77T group最初の推論時にCUDA OOMとなり未受入です。Reference/Hybrid固有の1×5秒Second Passは受入済みですが、長尺Reference/Hybridは未確認です。Disk-backedが保証する低メモリ範囲はContinuum Assemblyであり、Core Decodeや下流ノードが別の全量copyを作る可能性は残ります。 diff --git a/WORKLOG.md b/WORKLOG.md index e88b019..8625ed4 100644 --- a/WORKLOG.md +++ b/WORKLOG.md @@ -1,5 +1,107 @@ # Work Log +## 2026-08-27 - V3.6.0 public release implementation and GPU smoke + +- Added `H3 Continuum Sampler V3.6` as a new public Node ID while preserving V3.5.3/V3.4 nodes and widget sequences. Public backend choices are only `Standard` and `Compatibility`: Standard maps to Masked AV or Masked Video according to Audio Continuity, while Compatibility maps to the original Reference Context path. Internal transport names remain private. +- Updated package/version metadata, CHANGELOG, package validation/info, README English/Japanese, compact frontend handling, runtime verifier registration, and a copied V3.6 recommended workflow. The V3.5 workflow remains unchanged. Added public-node/backend/schema/workflow regressions. +- Synchronized only `nodes.py`, `version.py`, `metadata.ini`, `v3/driving_nodes.py`, and `web/project_id.js` to ComfyUI_WAN after snapshot `pre-v360-public-runtime-wan-20260827_172531`; all five hashes matched. Restarted the same Sage + `--disable-pinned-memory` backend and confirmed V3.6 registration with `Standard` default. +- Normal API GPU Smoke using the public node completed in `65.21s`: 2x5-second I2VA + Reference Image + Reference Audio, 384x384, four steps, Standard backend, Audio Seam Auto. Output `V36_Release_Smoke_Reference_AV_Standard_00001_.mp4` is 240f / 24fps / 10.000s with 32 kHz stereo 10.000s audio; the report confirms Masked AV on continuation chunk 2. Evidence: `D:\Codex\_test_results\ComfyUI-H3-Continuum\v360-release-smoke\20260827_172835`. +- Focused release validation is `81 passed`; final full source pytest is `527 passed`; V3.6.0 runtime verifier, JavaScript syntax, changed-file `py_compile`, the regenerated 178-entry Manifest, README link validation, source/runtime SHA-256 equality for 12 Production files, `git diff --check`, and empty API queue all pass. Commit/push/release are the remaining publication actions; the backend remains running. + +## 2026-08-27 - V3.6 PIG-5 subjective audio acceptance + +- User completed subjective listening of `V36_PIG3_Reference_Image_Audio_Masked_AV_00001_.mp4` and reported **Audio PASS**. No click, dropout, unnatural stereo positioning, or other audible boundary defect was reported. +- PIG-0 through PIG-5 and V3.6 public-promotion eligibility are now formally PASS. This records the gate result only: published V3.5.3, public UI/defaults, version metadata, node schemas, runtime files, and workflows were not changed in this step. +- Pre-change documentation snapshot: `pre-pig5-audio-pass-20260827_171054`. Commit/push were not performed. + +## 2026-08-27 - V3.6 PIG-5 policy freeze + +- User approved the final Production policy: Masked AV is the standard V3.6 continuation backend; Reference Context remains an Advanced compatibility fallback; raw transport names stay internal; Run Storage identity stays transport-scoped; Terminal Merge regeneration remains atomic per physical group; and Audio Seam Auto continues as an independent evaluation path. +- Public promotion remains HOLD only for subjective listening of the accepted PIG-3 output. A clean result for clicks, dropouts, stereo-positioning anomalies, and other audible boundary defects is sufficient to promote V3.6 without reopening PIG-0 through PIG-4. No UI, runtime, node schema, Sampling, Run Storage, or public default was changed in this policy-recording step. +- Pre-change documentation snapshot: `pre-pig5-policy-freeze-20260827_170808`. Commit/push were not performed. + +## 2026-08-27 - V3.6 Production Integration Gate PIG-0 through PIG-4 + +- Preserved published/default V3.5.3, every accumulated V3.6 change, and all unrelated working-tree edits. Accepted exact snapshots are `pre-v36-production-integration-pig0-accepted-20260827_161517` and `pre-v36-production-integration-pig2-diagnostic-accepted-20260827_162943`; the standard full snapshot stopped only on the known inaccessible `.pytest_cache` before edits. +- Added nondefault `continuation_transport` scoping to Run Storage identity, Sampling Contract execution semantics, and generated Session settings while leaving the default `reference_context_v1` revision identity bit-for-bit compatible. Added normal/Terminal Reference Image + Reference Audio CPU regressions and transport/session/terminal identity tests. +- PIG-2 real-cache testing exposed that Run Storage's temporary resume Session omitted stored `flf_execution`, causing all preserved chunks to be discarded. `run_storage.py` now restores execution semantics into the resume Session, and `v2/sequence.py` synchronizes the reuse count after atomic Terminal-pair pruning. The accepted rerun produced `0/3`, `3/0`, `1/2`, and `1/2` reused/generated counts for Save, Auto Resume, Regenerate From Chunk 2, and Chunk 3; the two regeneration requests each made exactly one Terminal physical Sampling call and never split logical `[2,3]`. +- PIG-3 completed 2x5-second I2VA + Reference Image + Reference Audio through Masked AV at 384x384 / 4 steps. Every physical group retained both Reference kinds, protected Video/Audio prefixes were bit-exact after finalization, and the output is finite 240f / 24fps / 10.000s with 10.000s stereo audio. Existing Audio Seam Auto produced a benign retained-boundary jump (`0.004261`, `0.0876x` local p99); subjective listening remains a separate user check. +- Evidence roots are `D:\Codex\_test_results\ComfyUI-H3-Continuum\v36-production-integration\v36_pig2_masked_20260827_164303` and `...\pig3-reference-masked`. Production integration is PASS; public/default promotion remains HOLD pending explicit UI/default-policy approval and subjective Audio Seam listening. No public UI was added, commit/push were not performed, and the backend remains running. +- Final validation: PIG-focused `61 passed`; canonical full pytest `521 passed`; changed-file `py_compile`, V3.5.3 WAN runtime verifier, three source/runtime SHA-256 comparisons, `git diff --check`, and empty API queue PASS. Only the known `pynvml` FutureWarning remains. + +## 2026-08-27 - V3.6-R2 shortened FL2VA Long Terminal Merge final GPU gate + +- Preserved published/default V3.5.3 and every accumulated uncommitted V3.6 change. Snapshot `pre-v36-r2-short-gate-20260827_000840` contains the exact runner/docs changed for this gate. Added only `--phase r2-short` scheduling to the private gate runner: Seed 607 full Reference/Masked comparison with cache-only Seam OFF, followed by Seed 608 Masked-only acceptance. +- Combined the existing complete Seed 606 Gate A with the shortened runs. All accepted executions preserve 3 logical chunks, 2 physical groups, Group 2 logical `[2,3]`, `paired_timeline_v1`, terminal seed/trim, and `260f / 77T Video / 433T Audio`. Every main MP4 is finite 640x640, 360 frames, 24 fps, and exactly 15 seconds with 15-second audio. +- Seed 607 Reference/Masked Group 1 Video and Audio SHA-256 values match. Seeds 606–608 Masked finalization restores only protected 7T Video and 37T Audio prefixes to bit-exact equality; raw Core drift remains limited to one-float-scale deltas and generated regions remain sampler-owned. +- Terminal PackedLayout is `35,865 -> 32,991` rows, a `2,874`-row / `8.01%` reduction. Synchronized Group 2 Sampling pairs are `574.134 -> 529.933s` and `560.782 -> 544.413s`; both favor Masked. Paired percentage median is `5.31%`; method medians are `567.458s` Reference and `544.413s` Masked (`4.06%` lower). Seed 608 Masked completed in `549.704s` Group 2 / `801.006s` API wall time. +- Five-run monitored peak RSS median is `9.674 GiB`; maximum observed device use is `15.646 GiB`. Terminal CUDA allocator peak is approximately `4.06 GiB` Reference versus `3.80 GiB` Masked. These whole-process/device values are environment- and order-sensitive; no broad memory guarantee is inferred. +- Inspected Seed 606–608 boundary sheets at nominal 5/10/15-second positions and actual 124f/243f retained boundaries. No obvious flash, collapse, direction reversal, or temporal discontinuity was found. Audio analysis found finite 15-second streams and no >=200 ms -50 dB dropout. Audio Seam Auto materially improved Seed 606 Masked, while Seed 607's 124f instantaneous jump increased despite no dropout or structural failure; the report therefore records mixed numerical seam behavior rather than claiming universal improvement. +- Final checks: canonical full pytest `516 passed` with only the known `pynvml` warning; the first attempt's 98 setup errors were solely the inherited inaccessible Windows pytest temp root and disappeared with a new writable basetemp. WAN runtime verifier, source/runtime SHA-256 for `constants.py`, `v2/nodes.py`, `v2/prompts.py`, `v2/sequence.py`, `v3/nodes.py`, `v3/masked_continuation.py`, and the diagnostic node, `git diff --check`, and empty queue pass. +- Gate result: **PASS**. Production promotion: **HOLD** pending Reference variants, Run Storage/resume identity, public UI/default decisions, and broader audible Audio Seam acceptance. Evidence roots are `D:\Codex\_test_results\ComfyUI-H3-Continuum\v36-fl2va-combined-20260826\gate-a` and `...\r2-short`. Backend PID 15888 remains running per request. Commit/push were not performed. + +## 2026-08-27 - V3.6 shared chunk-duration maximum 30 seconds + +- Preserved all uncommitted V3.6 R1/R2/FL2VA work and changed only the shared duration range, Prompt Plan validation, documentation, and focused regressions. No per-chunk variable-duration feature, Sampling, Conditioning, `17k+5` temporal math, Assembly, Seam, Run Storage, or saved-workflow socket contract changed. +- Added shared constants for default `5.0`, minimum `4.0`, maximum `30.0`, step `0.1`, and one tooltip. Applied them to all V2/V3 Production-compatible sampler schemas and Prompt Plan Preview. Values above 15 seconds are supported with a high-resolution VRAM/runtime warning; `5–15s` remains the recommended/validated range. +- Prompt Plan creation and connected-plan validation now accept `30.0`, reject `30.1`, and correctly map a two-chunk `[0-30s]` / `[30-60s]` Timeline. Temporal regression covers every tenth from `4.0` through `30.0` for 5/22/39-frame contexts and requires native `17k+5` output shapes. +- The separate legacy V1 `H3ContinuumJoin.extend_seconds` maximum remains 15 seconds by design; the audit found no remaining 15-second cap on `chunk_seconds`. +- Source snapshot `pre-v36-chunk-duration-30-source-20260826_234716` verifies all 209 Git-visible files. Runtime snapshot `pre-v36-chunk-duration-30-wan-runtime-20260826_235423` verifies the four synchronized files. Source/runtime pre-change differences in `constants.py` and `v2/prompts.py` were EOL-only. +- Validation: focused inherited-schema/prompt/temporal suite `89 passed`; final full pytest `516 passed`; changed-file `py_compile`, `git diff --check`, V3.5.3 runtime verifier, source/WAN SHA-256, live API schemas for seven V2/V3 node IDs, and empty queue PASS. The restarted WAN backend uses Sage Attention plus `--disable-pinned-memory` and is intentionally left running. Commit/push were not performed. +- Per the reduced GPU scope, submitted one T2VA `1x30s`, `384x384`, one-step validation prompt. API returned prompt ID `9e665f85-b32f-4b17-9734-219fb284e087` with `node_errors={}`; H3 model initialization/Sampling began without immediate duration/shape/Prompt Plan/OOM error. Interrupted intentionally after `31.87s`; no Decode/Save or 30-second output-quality claim was made. Queue returned empty. +- Cancelled the FL2VA joint multi-seed continuation gate at user request. Its cache warm-up completed, but the first measured condition was interrupted before execution and is excluded from results. + +## 2026-08-26 - V3.6-R2-2 Balanced 22f / 37T Joint AV GPU gate + +- Preserved the public/default V3.5.3 `reference_context_v1` route and all accumulated R1/R2 work. Added only private `masked_av_prefix_22_v1` handling and diagnostic tooling; no public node/schema, V3.4 behavior, `v2/sampling.py`, seed, Plan, trim, Decode, Assembly, Seam, Run Storage, or saved-workflow contract changed. +- Pre-change exact-file snapshots are `pre-v36-r2-2-balanced-av-source-files-20260826_214033` (9 files, zero mismatch) and `pre-v36-r2-2-balanced-av-wan-runtime-files-20260826_214033` (3 files, zero mismatch) under `D:\Codex\_snapshots\ComfyUI-H3-Continuum`. The initial runtime snapshot copy omitted subdirectories and was corrected before any edit; only the verified snapshot is accepted. +- CPU/static validation established the Balanced target `141f / 42T / 235T`, Video prefix `22f / 7T`, Audio prefix `37T`, trim `22f`, net `119f`, and the `8.333ms` Video/Audio mask-boundary asymmetry. Focused result is `24 passed`; pre-GPU full result is `510 passed` with only known warnings. +- Synchronized only `v2/sequence.py`, `v3/masked_continuation.py`, and private diagnostic `nodes.py` to ComfyUI_WAN with SHA-256 equality. Restarted ComfyUI v0.34.0 with Sage Attention and `--disable-pinned-memory`; node registration and empty queue passed. +- One-seed A/B used T2VA 2x5, 640x640, Balanced 22, Audio Continuity ON, fixed seed `238985343135605`, Prompt/CLIP cache HIT, CUDA synchronization, and Exact Duration ON. Reference packed layout was `20,205` rows; Masked AV was `17,331`, eliminating `2,874` reference rows (`14.22%`). Continuation Sampling was `226.373s -> 206.437s` (`8.81%` lower) and API wall time `435.907s -> 420.752s` (`3.48%` lower). One-seed timing is not generalized. +- Masked source/target Video 7T and Audio 37T prefixes match bit-exactly after scoped final restore. Core raw prefix deltas were only `2.384185791015625e-07` Video and `5.960464477539063e-08` Audio. Both outputs are finite `640x640 / 240f / 24fps / 10.000s`; boundary contact sheets show no obvious visual regression. +- Seam-OFF decoded audio is not intrinsically accepted: Reference jump `0.082725`, Masked jump `0.268163`. Existing Audio Seam Auto reassembled the cached Masked latents in `7.10s`, did not rerun Sampling, and reduced the jump to `0.029944` (`88.83%` lower and below local p99). No new Audio Seam code was added. +- R2-2 status: GPU structure/performance gate **PASS with existing Audio Seam Auto**, raw Seam-OFF audio documented, Production **HOLD**. Final full pytest is `510 passed`; changed-file `py_compile`, `git diff --check`, source/runtime SHA-256, V3.5.3 runtime verifier, and empty queue pass. Evidence is under `D:\Codex\_test_results\ComfyUI-H3-Continuum\v36-r2-gate2-20260826`. Backend remains running; commit/push were not performed. + +## 2026-08-26 - V3.6-R2-1 39f / 65T Joint AV GPU structure gate + +- Synchronized only `v2/sequence.py`, `v3/masked_continuation.py`, and the private diagnostic `nodes.py` to ComfyUI_WAN after the accepted R2-0 runtime snapshot. All three source/runtime SHA-256 hashes match. Restarted the same ComfyUI v0.34.0 backend with Sage Attention and `--disable-pinned-memory`; the backend is intentionally left running. +- Added reusable `tools/v36_r2_gpu_gate_runner.py`. It removes the I2VA First Image, fixes T2VA 2x5 / 640x640 / Strong 39 / Audio Continuity ON / one seed, excludes optional conditioning and Run Storage, warms Prompt/CLIP once, and measures Reference then Masked with CUDA synchronization. A validation-only stop found Core reports the 39f AV Reference as combined kind `video_audio`; the completed Reference generation remained valid and Masked resumed without repeating it. +- Reference continuation used `24,317` PackedLayout rows (`4,800 ref_img`, `130 ref_audio`); Masked used `19,387` with no Reference rows. The exact reduction is `4,930` rows / `20.27%`. Synchronized Chunk 2 time was `332.460 -> 241.888s` (`27.24%` lower); API wall was `556.058 -> 465.925s` (`16.21%` lower). This is one-seed structural evidence, not a universal performance claim. +- GPU evidence confirmed source-tail/target-prefix equality, Video mask `0:12` protected and `12:47` generated, Audio mask `0:65` protected and `65:263` generated, no old refs/interop, and final Video/Audio Prefix SHA-256 equality. Core raw maximum deltas were `2.384185791015625e-07` Video and `5.960464477539063e-08` Audio; final restored deltas are zero. No generated region is restored. +- Both primary MP4s are finite 640x640 / 240 frames / 24 fps / 10.000 seconds. Nine-frame boundary contact sheets show no gross visual snap, collapse, persistent artifact, or scene discontinuity. +- Added `tools/v36_r2_audio_boundary_analyze.py`. With Audio Seam OFF, the exact 124-frame cumulative boundary is the maximum decoded single-sample jump in both files: Reference `0.352289`, Masked `0.287521`. Masked has smaller DC/RMS/Peak discontinuities but the native hard cut is not described as click-free. +- Added a cache-only Audio Seam Auto probe. It reassembled the accepted Masked latents in `7.23s` without Sampling; boundary jump became `0.005774` (about `98.0%` lower), global rank fell from maximum to `37.4` percentile, and DC jump became `0.001103`. Existing Audio Seam Auto therefore handles the observed cut; no new seam algorithm was added. +- R2-1 status: GPU structure/interoperability **PASS**, raw Seam-OFF audio cut documented, existing Audio-Seam-Auto path PASS, Production still HOLD. R2-2 22f / 37T and broader acceptance remain pending. Evidence is under `D:\Codex\_test_results\ComfyUI-H3-Continuum\v36-r2-gate1-20260826`; commit/push were not performed. + +## 2026-08-26 - V3.6-R2-0 Joint AV masked-prefix CPU/static gate + +- Preserved all uncommitted V3.6-R1 work and kept V3.5.3 public/default behavior frozen. Added only the private `masked_av_prefix_39_v1` research transport; no public node/schema, `v2/sampling.py`, V3.4, seed, Plan, trim, Decode, Assembly, Seam, or Run Storage contract changed. +- Generalized `v3/masked_continuation.py` so R1 still protects only 22f / 7T video, while R2-0 copies and masks both a 39f / 12T video tail and a duration-matched 65T audio tail. Sampling-finalization restore is limited to the two protected prefixes; generated video and audio regions remain sampler-owned. +- Added a Strong-39-only sequence branch using a 158-frame physical target (`47T` video / `263T` audio), 39-frame trim, and 119-frame net output. It emits neither old Context Reference rows nor the old Spectrum interop hint and does not reapply the initial I2VA First Image after chunk 1. +- Extended the private WAN diagnostic wrapper to capture audio-prefix hashes/equality, audio mask regions, source-tail matching, native audio-grid offset, and final physical-group AV prefix pairs. It remains diagnostic-only and is not a public V3.5.3 node contract. +- Added CPU regressions for exact shapes, zero/one masks, source/target immutability, invalid audio shapes/NaN, protected-prefix restoration, generated-region preservation, First Image isolation, absence of old refs/interop, and the integrated two-chunk sequence path. +- The 39f video window and 65 audio ticks are both 1.625 seconds, but native H3 source/target audio-grid phase is not silently assumed to be zero: 124f / 207T is `+1/3` tick and 158f / 263T is `-1/3` tick. +- Validation: changed-file `py_compile` PASS; focused masked/temporal tests `21 passed`; full pytest `507 passed`; only the known `pynvml` FutureWarning remains. GPU R2-1 and runtime synchronization were deliberately not started in this CPU/static gate. +- Accepted snapshots: `pre-v36-r2-0-joint-av-source-accepted-20260826_203022` and `pre-v36-r2-0-joint-av-wan-runtime-accepted-20260826_203022`. Commit/push were not performed; the existing WAN backend was not stopped. + +## 2026-08-26 - V3.6-R1 masked video-prefix continuation PoC + +- Kept V3.5.3 `reference_context_v1` as the public/default continuation transport and added only a private V3.6-R1 switch for testing. No public widget or Production node was added; V3.4, public V3.5.3 schemas, Sampling implementation, seeds, Plan, trim, Decode, Assembly, Seam, and Run Storage remain unchanged. +- Added `v3/masked_continuation.py` for 22-frame / 7T video-prefix target construction and mask creation. The masked route copies the video tail into the next 42T target, uses video mask `0` for the seven protected slots and `1` afterward, keeps the 235T audio target empty with an all-one mask, and omits both old Context Reference conditioning and its Spectrum interop hint. +- Found that Core v0.34.0 preserved the prefix inside denoising but the raw final float32 integration introduced a maximum difference of `2.38418579101562e-07`. Added a narrowly scoped post-Sampling restore of the protected prefix only. Finalized prefix equality is exact by `torch.equal`, max difference, and SHA-256; no generated video/audio region is restored. +- Added dedicated CPU regressions, a test-runtime diagnostic node, and `tools/v36_r1_api_runner.py`. Focused validation is `8 passed`; full pytest is `500 passed`; `py_compile` and `git diff --check` pass. Synced only the changed Production/diagnostic files to ComfyUI_WAN and verified source/runtime SHA-256 equality. +- After user-authorized queue clear/interrupt, completed three normal-API A/B pairs at 640x640 / 2x5-second T2VA / 20 steps / Balanced 22. Audio Continuity, Run Storage, Spectrum, Sol, Seam, First/Last, References, and Video Guide were off; Sage Attention was enabled by the server. Every masked run passed 7T prefix exactness, mask/shape/seed/finite checks, empty second-group refs, and absent old interop. All six outputs are 240 frames at 24 fps / 10.000 seconds. +- Contact sheets at frames 112, 118, 122, 123, 124, 125, 128, 136, and 148 show no gross boundary snap, direction reversal, persistent artifact, or collapse for either route. The masked route did not show a consistent visual advantage over the accepted reference-context route across the three seeds. Decision: R1 structure PASS; visual improvement unproven; do not promote it as the Production default. +- Evidence roots: `v36-r1-gate1-postrestore-20260826`, `v36-r1-gate2-seed238985343135587`, `v36-r1-gate2-seed238985343135588`, and `v36-r1-boundary-sheets-20260826` under `D:\Codex\_test_results\ComfyUI-H3-Continuum`. Output MP4s remain under `D:\output\video\comfy_video\video` with `V36_R1_*` names. Commit/push were not performed. +- Derived a simplified, annotated A/B workflow from `MiniMax_H3_Continuum_V35 (3).json`: `D:\Codex\_test_workflows\ComfyUI-H3-Continuum\MiniMax_H3_Continuum_V36_R1_MaskedPrefix_AB.json`. Removed disconnected external AddGuide/Noise Mask/AV split-concat nodes and all non-R1 features; retained the exact Model/SIGMAS/diagnostic Sampler/Core Decode/Assembly/Save route. Static graph validation found 22 unique nodes, 24 reciprocal/type-correct links, three groups, zero errors, registered diagnostic type, and default `masked_video_prefix_v1`. Companion explanation is `V36_R1_WORKFLOW_GUIDE.md`; no GPU generation was rerun for workflow serialization. +- Ran the formal R1 Stress Gate as 3x5-second Strong Motion I2VA at 640x640, Balanced 22, three fixed seeds, Prompt/CLIP cache HIT, Audio Continuity/Run Storage/Spectrum/Sol/Seam OFF, and `--disable-pinned-memory`. The order alternated `Reference -> Masked`, `Masked -> Reference`, `Reference -> Masked`. +- Diagnostics caught an A/B fairness defect before acceptance: the private masked branch reapplied the original First Image on chunks 2/3 while the reference branch removed it. Interrupted/excluded those preliminary runs, restricted First Image to chunk 1 in `masked_video_prefix_v1`, and added CPU coverage. Public V3.5.3 behavior was not changed. +- The accepted normal API pairs were `719.800/675.284s`, `693.449/641.506s`, and `711.800/672.341s` for Reference/Masked. Masked API time was lower by `6.185%`, `7.491%`, and `5.544%`; continuation Sampling was lower by `9.471%`, `12.029%`, and `8.309%`, with paired medians `6.185%` and `9.471%` respectively. +- Added real Core `PackedLayout` capture to the diagnostic node. Reference continuation uses `20,569` rows including `2,800 ref_img` rows; Masked uses `17,769` rows and no continuation `cond`/`ref_img` rows. A CUDA-synchronized pair confirmed continuation Sampling `464.97 -> 437.10s` (`5.995%` faster), so the signal is not a host-asynchrony artifact. +- All six accepted videos are 640x640, 360 frames, 24 fps, and 15.000 seconds. Every masked finalized prefix is bit-exact at both boundaries. Contact sheets show no gross snap, reversal, persistent artifact, or collapse. At the second boundary Masked had lower optical-flow jerk and lower absolute luma/saturation drift for all three seeds; flow-magnitude continuity remained mixed, so the quality result is promising but not universal proof. +- Stress evidence is under `D:\Codex\_test_results\ComfyUI-H3-Continuum\v36-r1-stress-gate-20260826\normal_fair` and `sync_fair`. The sibling `normal` runs are pre-fairness diagnostics and explicitly invalid for acceptance. Added reusable `tools/v36_r1_stress_gate_runner.py` and `tools/v36_r1_stress_gate_analyze.py`. +- Final validation: focused masked-prefix regression `5 passed`; canonical full pytest `500 passed`; changed-file `py_compile`, V3.5.3 runtime verifier, `git diff --check`, source/WAN hashes, and empty queue PASS. R1 Stress Gate is PASS; Production remains HOLD pending separately scoped R2/Reference/Terminal/Run Storage work. The WAN backend was intentionally left running per user instruction. Commit/push were not performed. + ## 2026-08-26 - V3.5.3 distribution-integrity maintenance hotfix - Kept published V3.5.2 generation and optimization behavior frozen; no Sampling, Conditioning payload, Terminal Merge, Assembly, Seam, Run Storage, Prompt/CLIP cache, Video Guide, V3.4, node, or socket contract was changed. diff --git a/constants.py b/constants.py index 1ef7ab9..11fa426 100644 --- a/constants.py +++ b/constants.py @@ -8,6 +8,17 @@ AUDIO_LATENT_FPS = 40.0 FRAME_RESCALE = AUDIO_LATENT_FPS / FPS FRAME_PER_TOKEN = (1, 4, 4, 4, 4) +CHUNK_SECONDS_DEFAULT = 5.0 +CHUNK_SECONDS_MIN = 4.0 +CHUNK_SECONDS_MAX = 30.0 +CHUNK_SECONDS_STEP = 0.1 +CHUNK_SECONDS_TOOLTIP = ( + "Target duration shared by every chunk. 5–15 seconds is the recommended " + "and validated range. Values above 15 seconds are supported, but VRAM " + "use and processing time can increase substantially, especially at high " + "resolution." +) + STATE_MAGIC = "H3_CONTINUUM_STATE" PLAN_MAGIC = "H3_CONTINUUM_PLAN" SESSION_MAGIC = "H3_CONTINUUM_SESSION" diff --git a/examples/workflows/MiniMax_H3_Continuum_V36.json b/examples/workflows/MiniMax_H3_Continuum_V36.json new file mode 100644 index 0000000..1687ba2 --- /dev/null +++ b/examples/workflows/MiniMax_H3_Continuum_V36.json @@ -0,0 +1,3236 @@ +{ + "id": "ea97ab35-fa5e-41ed-84c4-781469b073c7", + "revision": 0, + "last_node_id": 311, + "last_link_id": 322, + "nodes": [ + { + "id": 136, + "type": "VAELoader", + "pos": [ + -770, + 1300 + ], + "size": [ + 530, + 60 + ], + "flags": {}, + "order": 0, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "VAE", + "type": "VAE", + "links": [ + 102, + 295 + ] + } + ], + "title": "Audio VAE", + "properties": { + "cnr_id": "comfy-core", + "ver": "0.30.0", + "Node name for S&R": "VAELoader", + "models": [ + { + "name": "minimax_h3_audio_vae_fp32.safetensors", + "url": "https://huggingface.co/Comfy-Org/MiniMax-H3/resolve/main/vae/minimax_h3_audio_vae_fp32.safetensors", + "directory": "vae" + } + ] + }, + "widgets_values": [ + "minimax_h3_audio_vae_fp32.safetensors" + ], + "widgets_values_named": { + "vae_name": "minimax_h3_audio_vae_fp32.safetensors" + } + }, + { + "id": 256, + "type": "ResolutionSelector", + "pos": [ + -470, + 2030 + ], + "size": [ + 290, + 160 + ], + "flags": {}, + "order": 1, + "mode": 0, + "showAdvanced": false, + "inputs": [], + "outputs": [ + { + "name": "width", + "type": "INT", + "links": [ + 145 + ] + }, + { + "name": "height", + "type": "INT", + "links": [ + 146 + ] + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.30.0", + "Node name for S&R": "ResolutionSelector" + }, + "widgets_values": [ + "1:1 (Square)", + 0.6, + 32 + ], + "widgets_values_named": { + "aspect_ratio": "1:1 (Square)", + "megapixels": 0.6, + "multiple": 32 + }, + "color": "#432", + "bgcolor": "#653" + }, + { + "id": 147, + "type": "UNETLoader", + "pos": [ + -770, + 870 + ], + "size": [ + 530, + 90 + ], + "flags": {}, + "order": 2, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "MODEL", + "type": "MODEL", + "links": [ + 124 + ] + } + ], + "title": "H3 Model", + "properties": { + "cnr_id": "comfy-core", + "ver": "0.30.0", + "Node name for S&R": "UNETLoader", + "models": [ + { + "name": "minimax_h3_fl2va_pruned_int8_convrot.safetensors", + "url": "https://huggingface.co/Comfy-Org/MiniMax-H3/resolve/main/diffusion_models/minimax_h3_fl2va_pruned_int8_convrot.safetensors", + "directory": "diffusion_models" + } + ] + }, + "widgets_values": [ + "minimax\\minimax_h3_fl2va_pruned_int8_convrot.safetensors", + "default" + ], + "widgets_values_named": { + "unet_name": "minimax\\minimax_h3_fl2va_pruned_int8_convrot.safetensors", + "weight_dtype": "default" + } + }, + { + "id": 266, + "type": "LoadAudio", + "pos": [ + 350, + 2240 + ], + "size": [ + 290, + 140 + ], + "flags": {}, + "order": 3, + "mode": 4, + "inputs": [], + "outputs": [ + { + "name": "AUDIO", + "type": "AUDIO", + "links": [ + 215 + ] + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.33.1", + "Node name for S&R": "LoadAudio" + }, + "widgets_values": [ + "audio_ace_step_00003_.mp3", + null, + null + ], + "widgets_values_named": { + "audio": "audio_ace_step_00003_.mp3", + "upload": null + } + }, + { + "id": 285, + "type": "Fast Groups Bypasser (rgthree)", + "pos": [ + 710, + 2230 + ], + "size": [ + 280, + 90 + ], + "flags": {}, + "order": 4, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "OPT_CONNECTION", + "type": "*", + "links": null + } + ], + "properties": { + "matchColors": "", + "matchTitle": "video audio", + "showNav": false, + "showAllGraphs": true, + "sort": "position", + "customSortAlphabet": "", + "toggleRestriction": "default" + }, + "color": "#2a363b", + "bgcolor": "#3f5159" + }, + { + "id": 142, + "type": "CLIPLoader", + "pos": [ + -770, + 1010 + ], + "size": [ + 530, + 110 + ], + "flags": {}, + "order": 5, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "CLIP", + "type": "CLIP", + "links": [ + 264, + 283 + ] + } + ], + "title": "MiniMax H3 Text Encoder", + "properties": { + "cnr_id": "comfy-core", + "ver": "0.30.0", + "Node name for S&R": "CLIPLoader", + "models": [ + { + "name": "qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors", + "url": "https://huggingface.co/Comfy-Org/MiniMax-H3/resolve/main/text_encoders/qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors", + "directory": "text_encoders" + } + ] + }, + "widgets_values": [ + "qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors", + "minimax", + "default" + ], + "widgets_values_named": { + "clip_name": "qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors", + "type": "minimax", + "device": "default" + } + }, + { + "id": 286, + "type": "Power Lora Loader (rgthree)", + "pos": [ + -760, + 1450 + ], + "size": [ + 520, + 240 + ], + "flags": {}, + "order": 31, + "mode": 0, + "inputs": [ + { + "dir": 3, + "name": "model", + "type": "MODEL", + "link": 305 + }, + { + "dir": 3, + "name": "clip", + "type": "CLIP", + "link": null + } + ], + "outputs": [ + { + "dir": 4, + "name": "MODEL", + "shape": 3, + "type": "MODEL", + "links": [ + 216 + ] + }, + { + "dir": 4, + "name": "CLIP", + "shape": 3, + "type": "CLIP", + "links": null + } + ], + "properties": { + "cnr_id": "rgthree-comfy", + "ver": "1.0.2607232129", + "Show Strengths": "Single Strength", + "Match": "" + }, + "widgets_values": [ + {}, + { + "type": "PowerLoraLoaderHeaderWidget" + }, + { + "on": false, + "lora": "minimax\\minimax_h3_fl2v_lightx2v_turbo_8step_v1.0_resized_avg_rank_24_bf16.safetensors", + "strength": 1, + "strengthTwo": null + }, + { + "on": false, + "lora": "minimax\\minimax_h3_fl2v_lightx2v_turbo_4step_v1.0_768p_resized_avg_rank_31_bf16.safetensors", + "strength": 1, + "strengthTwo": null + }, + { + "on": false, + "lora": "minimax\\minimax_h3_fl2v_turbo_4step_v1.0_768p_comfyui_bf16.safetensors", + "strength": 1, + "strengthTwo": null + }, + {}, + "" + ], + "widgets_values_named": { + "divider": {}, + "PowerLoraLoaderHeaderWidget": { + "type": "PowerLoraLoaderHeaderWidget" + }, + "lora_1": { + "on": false, + "lora": "minimax\\minimax_h3_fl2v_lightx2v_turbo_8step_v1.0_resized_avg_rank_24_bf16.safetensors", + "strength": 1, + "strengthTwo": null + }, + "lora_2": { + "on": false, + "lora": "minimax\\minimax_h3_fl2v_lightx2v_turbo_4step_v1.0_768p_resized_avg_rank_31_bf16.safetensors", + "strength": 1, + "strengthTwo": null + }, + "lora_3": { + "on": false, + "lora": "minimax\\minimax_h3_fl2v_turbo_4step_v1.0_768p_comfyui_bf16.safetensors", + "strength": 1, + "strengthTwo": null + }, + "➕ Add Lora": "" + } + }, + { + "id": 153, + "type": "BasicScheduler", + "pos": [ + -150, + 930 + ], + "size": [ + 320, + 110 + ], + "flags": {}, + "order": 35, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 15 + } + ], + "outputs": [ + { + "name": "SIGMAS", + "type": "SIGMAS", + "links": [ + 286 + ] + } + ], + "title": "Scheduler", + "properties": { + "cnr_id": "comfy-core", + "ver": "0.30.0", + "Node name for S&R": "BasicScheduler" + }, + "widgets_values": [ + "simple", + 20, + 1 + ], + "widgets_values_named": { + "scheduler": "simple", + "steps": 20, + "denoise": 1 + }, + "color": "#432", + "bgcolor": "#653" + }, + { + "id": 255, + "type": "Any Switch (rgthree)", + "pos": [ + -710, + 1800 + ], + "size": [ + 270, + 110 + ], + "flags": { + "collapsed": true + }, + "order": 32, + "mode": 0, + "inputs": [ + { + "dir": 3, + "name": "any_01", + "type": "INT", + "link": 143 + }, + { + "dir": 3, + "name": "any_02", + "type": "INT", + "link": 145 + }, + { + "dir": 3, + "name": "any_03", + "type": "INT", + "link": null + }, + { + "dir": 3, + "name": "any_04", + "type": "INT", + "link": null + }, + { + "name": "any_05", + "type": "INT", + "link": null + } + ], + "outputs": [ + { + "dir": 4, + "label": "INT", + "name": "*", + "shape": 3, + "type": "INT", + "links": [ + 296 + ] + } + ], + "properties": { + "cnr_id": "rgthree-comfy", + "ver": "1.0.2607232129" + } + }, + { + "id": 254, + "type": "Any Switch (rgthree)", + "pos": [ + -460, + 1810 + ], + "size": [ + 190, + 160 + ], + "flags": { + "collapsed": true + }, + "order": 33, + "mode": 0, + "inputs": [ + { + "dir": 3, + "name": "any_01", + "type": "INT", + "link": 144 + }, + { + "dir": 3, + "name": "any_02", + "type": "INT", + "link": 146 + }, + { + "dir": 3, + "name": "any_03", + "type": "INT", + "link": null + }, + { + "dir": 3, + "name": "any_04", + "type": "INT", + "link": null + }, + { + "name": "any_05", + "type": "INT", + "link": null + } + ], + "outputs": [ + { + "dir": 4, + "label": "INT", + "name": "*", + "shape": 3, + "type": "INT", + "links": [ + 297 + ] + } + ], + "properties": { + "cnr_id": "rgthree-comfy", + "ver": "1.0.2607232129" + } + }, + { + "id": 120, + "type": "GetImageSize", + "pos": [ + -2820, + 1780 + ], + "size": [ + 220, + 140 + ], + "flags": { + "collapsed": true + }, + "order": 29, + "mode": 0, + "inputs": [ + { + "name": "image", + "type": "IMAGE", + "link": 2 + } + ], + "outputs": [ + { + "name": "width", + "type": "INT", + "links": [ + 143 + ] + }, + { + "name": "height", + "type": "INT", + "links": [ + 144 + ] + }, + { + "name": "batch_size", + "type": "INT", + "links": null + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.30.0", + "Node name for S&R": "GetImageSize" + }, + "widgets_values": [], + "widgets_values_named": {} + }, + { + "id": 114, + "type": "LoadImage", + "pos": [ + -3180, + 880 + ], + "size": [ + 740, + 840 + ], + "flags": {}, + "order": 6, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 1 + ] + }, + { + "name": "MASK", + "type": "MASK", + "links": null + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.30.0", + "Node name for S&R": "LoadImage" + }, + "widgets_values": [ + "exec-eddfdf1c-ae6c-491d-9909-0b1edb176c30.png", + "image" + ], + "widgets_values_named": { + "image": "exec-eddfdf1c-ae6c-491d-9909-0b1edb176c30.png", + "upload": "image" + } + }, + { + "id": 290, + "type": "LoadImage", + "pos": [ + -2360, + 900 + ], + "size": [ + 460, + 760 + ], + "flags": {}, + "order": 7, + "mode": 4, + "inputs": [], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 255 + ] + }, + { + "name": "MASK", + "type": "MASK", + "links": null + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.30.0", + "Node name for S&R": "LoadImage" + }, + "widgets_values": [ + "exec-758fca62-818a-446e-a279-829cc126d899.png", + "image" + ], + "widgets_values_named": { + "image": "exec-758fca62-818a-446e-a279-829cc126d899.png", + "upload": "image" + } + }, + { + "id": 260, + "type": "MarkdownNote", + "pos": [ + -3660, + 880 + ], + "size": [ + 440, + 510 + ], + "flags": {}, + "order": 8, + "mode": 0, + "inputs": [], + "outputs": [], + "title": "Note: Model Links", + "properties": {}, + "widgets_values": [ + "## Model Links\n\n**vae**\n\n- [minimax_h3_video_vae_fp16.safetensors](https://huggingface.co/Comfy-Org/MiniMax-H3/resolve/main/vae/minimax_h3_video_vae_fp16.safetensors)\n- [minimax_h3_audio_vae_fp32.safetensors](https://huggingface.co/Comfy-Org/MiniMax-H3/resolve/main/vae/minimax_h3_audio_vae_fp32.safetensors)\n\n**diffusion_models**\n\n- [minimax_h3_fl2va_pruned_int8_convrot.safetensors](https://huggingface.co/Comfy-Org/MiniMax-H3/resolve/main/diffusion_models/minimax_h3_fl2va_pruned_int8_convrot.safetensors)\n\n- [minimax_h3_ref2va_pruned_int8_convrot.safetensors](https://huggingface.co/Comfy-Org/MiniMax-H3/resolve/main/diffusion_models/minimax_h3_ref2va_pruned_int8_convrot.safetensors)\n\n**text_encoders**\n\n- [qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors](https://huggingface.co/Comfy-Org/MiniMax-H3/resolve/main/text_encoders/qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors)\n\n\n## Model Storage Location\n\n```\n📂 ComfyUI/\n├── 📂 models/\n│ ├── 📂 vae/\n│ │ ├── minimax_h3_video_vae_fp16.safetensors\n│ │ └── minimax_h3_audio_vae_fp32.safetensors\n│ ├── 📂 diffusion_models/\n│ │ └── minimax_h3_fl2va_pruned_int8_convrot.safetensors\n│ └── 📂 text_encoders/\n│ └── qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors\n```\n\n## Report Issue\n\nNote: Please update ComfyUI first ([guide](https://docs.comfy.org/installation/update_comfyui)) and prepare required models. Desktop/Cloud updates follow stable releases, so some nightly-supported models may not be available yet.\n\n- Cannot run / runtime errors: [ComfyUI/issues](https://github.com/comfyanonymous/ComfyUI/issues)\n- UI / frontend issues: [ComfyUI_frontend/issues](https://github.com/Comfy-Org/ComfyUI_frontend/issues)\n- Workflow issues: [workflow_templates/issues](https://github.com/Comfy-Org/workflow_templates/issues)\n" + ], + "widgets_values_named": { + "text": "## Model Links\n\n**vae**\n\n- [minimax_h3_video_vae_fp16.safetensors](https://huggingface.co/Comfy-Org/MiniMax-H3/resolve/main/vae/minimax_h3_video_vae_fp16.safetensors)\n- [minimax_h3_audio_vae_fp32.safetensors](https://huggingface.co/Comfy-Org/MiniMax-H3/resolve/main/vae/minimax_h3_audio_vae_fp32.safetensors)\n\n**diffusion_models**\n\n- [minimax_h3_fl2va_pruned_int8_convrot.safetensors](https://huggingface.co/Comfy-Org/MiniMax-H3/resolve/main/diffusion_models/minimax_h3_fl2va_pruned_int8_convrot.safetensors)\n\n- [minimax_h3_ref2va_pruned_int8_convrot.safetensors](https://huggingface.co/Comfy-Org/MiniMax-H3/resolve/main/diffusion_models/minimax_h3_ref2va_pruned_int8_convrot.safetensors)\n\n**text_encoders**\n\n- [qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors](https://huggingface.co/Comfy-Org/MiniMax-H3/resolve/main/text_encoders/qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors)\n\n\n## Model Storage Location\n\n```\n📂 ComfyUI/\n├── 📂 models/\n│ ├── 📂 vae/\n│ │ ├── minimax_h3_video_vae_fp16.safetensors\n│ │ └── minimax_h3_audio_vae_fp32.safetensors\n│ ├── 📂 diffusion_models/\n│ │ └── minimax_h3_fl2va_pruned_int8_convrot.safetensors\n│ └── 📂 text_encoders/\n│ └── qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors\n```\n\n## Report Issue\n\nNote: Please update ComfyUI first ([guide](https://docs.comfy.org/installation/update_comfyui)) and prepare required models. Desktop/Cloud updates follow stable releases, so some nightly-supported models may not be available yet.\n\n- Cannot run / runtime errors: [ComfyUI/issues](https://github.com/comfyanonymous/ComfyUI/issues)\n- UI / frontend issues: [ComfyUI_frontend/issues](https://github.com/Comfy-Org/ComfyUI_frontend/issues)\n- Workflow issues: [workflow_templates/issues](https://github.com/Comfy-Org/workflow_templates/issues)\n" + }, + "color": "#222", + "bgcolor": "#000" + }, + { + "id": 261, + "type": "MarkdownNote", + "pos": [ + -3660, + 1440 + ], + "size": [ + 440, + 420 + ], + "flags": { + "collapsed": false + }, + "order": 9, + "mode": 0, + "inputs": [], + "outputs": [], + "title": "Note: MiniMax H3", + "properties": {}, + "widgets_values": [ + "## MiniMax H3\n\n[MiniMax H3](https://www.minimax.io/blog/minimax-h3) is MiniMax's general-purpose, omni-modal generation model. It jointly understands text, image, video, and audio, and generates video with **native stereo audio**: voice, sound effects, and music are modeled jointly in a single forward pass, not layered on afterward. Output is up to 2K resolution, 24fps, and up to about 15 seconds.\n\n## About this workflow\n\nThis template runs the **Image to Video** task (`MiniMaxH3ImageToVideo` node), which covers both:\n\n- **t2va** (text-to-video), when no images are connected\n- **fl2va** (first/last-frame image-to-video), when `first_frame` and/or `last_frame` are connected\n\n**Key inputs**\n\n- **first_frame / last_frame**: optional keyframes; the model generates the motion between them\n- **prompt**: describe the shots, motion, and the accompanying audio (dialogue, SFX, music) in one block\n- **width / height**: set via Resolution Selector. H3's native canvas is a 768px short edge, capped at 768x1344 pixels, rounded to a multiple of 32\n- **duration (seconds)**: converted to a valid frame `length` by the Math Expression node, snapping up to the model's 17-frame-per-block (17k+5) grid at 24fps" + ], + "widgets_values_named": { + "text": "## MiniMax H3\n\n[MiniMax H3](https://www.minimax.io/blog/minimax-h3) is MiniMax's general-purpose, omni-modal generation model. It jointly understands text, image, video, and audio, and generates video with **native stereo audio**: voice, sound effects, and music are modeled jointly in a single forward pass, not layered on afterward. Output is up to 2K resolution, 24fps, and up to about 15 seconds.\n\n## About this workflow\n\nThis template runs the **Image to Video** task (`MiniMaxH3ImageToVideo` node), which covers both:\n\n- **t2va** (text-to-video), when no images are connected\n- **fl2va** (first/last-frame image-to-video), when `first_frame` and/or `last_frame` are connected\n\n**Key inputs**\n\n- **first_frame / last_frame**: optional keyframes; the model generates the motion between them\n- **prompt**: describe the shots, motion, and the accompanying audio (dialogue, SFX, music) in one block\n- **width / height**: set via Resolution Selector. H3's native canvas is a 768px short edge, capped at 768x1344 pixels, rounded to a multiple of 32\n- **duration (seconds)**: converted to a valid frame `length` by the Math Expression node, snapping up to the model's 17-frame-per-block (17k+5) grid at 24fps" + }, + "color": "#222", + "bgcolor": "#000" + }, + { + "id": 262, + "type": "Fast Groups Bypasser (rgthree)", + "pos": [ + -2900, + 730 + ], + "size": [ + 280, + 90 + ], + "flags": {}, + "order": 10, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "OPT_CONNECTION", + "type": "*", + "links": null + } + ], + "properties": { + "matchColors": "", + "matchTitle": "first frame", + "showNav": false, + "showAllGraphs": true, + "sort": "position", + "customSortAlphabet": "", + "toggleRestriction": "default" + }, + "color": "#2a363b", + "bgcolor": "#3f5159" + }, + { + "id": 228, + "type": "CreateVideo", + "pos": [ + 1050, + 1340 + ], + "size": [ + 290, + 110 + ], + "flags": { + "collapsed": false + }, + "order": 44, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 298 + }, + { + "name": "audio", + "shape": 7, + "type": "AUDIO", + "link": 299 + } + ], + "outputs": [ + { + "name": "VIDEO", + "type": "VIDEO", + "links": [ + 108 + ] + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.31.0", + "Node name for S&R": "CreateVideo" + }, + "widgets_values": [ + 24, + 8 + ], + "widgets_values_named": { + "fps": 24, + "bit_depth": 8 + } + }, + { + "id": 183, + "type": "easy cleanGpuUsed", + "pos": [ + 1070, + 1540 + ], + "size": [ + 200, + 30 + ], + "flags": { + "collapsed": false + }, + "order": 46, + "mode": 0, + "inputs": [ + { + "name": "anything", + "type": "*", + "link": 108 + } + ], + "outputs": [ + { + "name": "output", + "type": "*", + "links": [ + 31 + ] + } + ], + "properties": { + "cnr_id": "comfyui-easy-use", + "ver": "1.3.6", + "Node name for S&R": "easy cleanGpuUsed" + }, + "color": "#2a363b", + "bgcolor": "#3f5159" + }, + { + "id": 250, + "type": "PreviewAny", + "pos": [ + 1910, + 2250 + ], + "size": [ + 480, + 630 + ], + "flags": { + "collapsed": false + }, + "order": 45, + "mode": 0, + "inputs": [ + { + "name": "source", + "type": "*", + "link": 300 + } + ], + "outputs": [ + { + "name": "STRING", + "type": "STRING", + "links": null + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.32.0", + "Node name for S&R": "PreviewAny" + }, + "widgets_values": [], + "widgets_values_named": {} + }, + { + "id": 139, + "type": "KSamplerSelect", + "pos": [ + -130, + 1110 + ], + "size": [ + 260, + 60 + ], + "flags": {}, + "order": 11, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "SAMPLER", + "type": "SAMPLER", + "links": [ + 265, + 285 + ] + } + ], + "title": "Sampler", + "properties": { + "cnr_id": "comfy-core", + "ver": "0.30.0", + "Node name for S&R": "KSamplerSelect" + }, + "widgets_values": [ + "res_multistep" + ], + "widgets_values_named": { + "sampler_name": "res_multistep" + }, + "color": "#432", + "bgcolor": "#653" + }, + { + "id": 284, + "type": "ComfySwitchNode", + "pos": [ + 350, + 2080 + ], + "size": [ + 270, + 80 + ], + "flags": {}, + "order": 27, + "mode": 4, + "inputs": [ + { + "name": "on_false", + "type": "AUDIO", + "link": 215 + }, + { + "name": "on_true", + "type": "AUDIO", + "link": 214 + } + ], + "outputs": [ + { + "name": "output", + "type": "AUDIO", + "links": [ + 294 + ] + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.33.0", + "Node name for S&R": "ComfySwitchNode" + }, + "widgets_values": [ + true + ], + "widgets_values_named": { + "switch": true + } + }, + { + "id": 150, + "type": "SpectrumApplyMiniMaxH3", + "pos": [ + -170, + 1270 + ], + "size": [ + 340, + 640 + ], + "flags": {}, + "order": 34, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 216 + } + ], + "outputs": [ + { + "name": "model", + "type": "MODEL", + "links": [ + 15, + 239, + 263, + 282 + ] + } + ], + "title": "Spectrum", + "properties": { + "cnr_id": "comfyui-spectrum-minimax-h3", + "ver": "9395bf98fc60a04c5f588de7b2bb33516a0b622f", + "Node name for S&R": "SpectrumApplyMiniMaxH3" + }, + "widgets_values": [ + false, + 0.5, + 1, + 0.1, + 2, + 0.75, + 1, + 1, + 8, + false, + "system_ram", + true, + false, + false, + true, + 0, + "system_ram", + "off", + 0.65, + false, + false, + "coordinate_rls", + "hard_clip", + 0.4, + "no_attenuation" + ], + "widgets_values_named": { + "enabled": false, + "blend_weight": 0.5, + "degree": 1, + "ridge_lambda": 0.1, + "window_size": 2, + "flex_window": 0.75, + "warmup_steps": 1, + "tail_actual_steps": 1, + "max_history": 8, + "debug": false, + "history_storage": "system_ram", + "bootstrap_first_forecast": true, + "anchor_residual_feedback": false, + "selective_rollback_correction": false, + "offline_smoothing_replay": true, + "audio_blend_weight": 0, + "offline_archive_storage": "system_ram", + "model_aware_mode": "off", + "model_aware_risk_threshold": 0.65, + "model_aware_trust_shrinkage": false, + "model_aware_replay_generic_correction": false, + "generic_correction_mode": "coordinate_rls", + "generic_correction_limiter": "hard_clip", + "generic_correction_limit": 0.4, + "generic_correction_attenuation": "no_attenuation" + } + }, + { + "id": 298, + "type": "Fast Groups Bypasser (rgthree)", + "pos": [ + -2260, + 740 + ], + "size": [ + 280, + 90 + ], + "flags": {}, + "order": 12, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "OPT_CONNECTION", + "type": "*", + "links": null + } + ], + "properties": { + "matchColors": "", + "matchTitle": "last frame", + "showNav": false, + "showAllGraphs": true, + "sort": "position", + "customSortAlphabet": "", + "toggleRestriction": "default" + }, + "color": "#2a363b", + "bgcolor": "#3f5159" + }, + { + "id": 227, + "type": "VAEDecodeAudio", + "pos": [ + 1100, + 1230 + ], + "size": [ + 190, + 50 + ], + "flags": { + "collapsed": false + }, + "order": 41, + "mode": 0, + "inputs": [ + { + "name": "samples", + "type": "LATENT", + "link": 271 + }, + { + "name": "vae", + "type": "VAE", + "link": 102 + } + ], + "outputs": [ + { + "name": "AUDIO", + "type": "AUDIO", + "links": [ + 302 + ] + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.30.0", + "Node name for S&R": "VAEDecodeAudio" + } + }, + { + "id": 226, + "type": "VAEDecode", + "pos": [ + 1090, + 1090 + ], + "size": [ + 200, + 50 + ], + "flags": { + "collapsed": false + }, + "order": 40, + "mode": 0, + "inputs": [ + { + "name": "samples", + "type": "LATENT", + "link": 270 + }, + { + "name": "vae", + "type": "VAE", + "link": 103 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 301 + ] + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.30.0", + "Node name for S&R": "VAEDecode" + } + }, + { + "id": 302, + "type": "H3ContinuumHiResFixV35", + "pos": [ + 610, + 1070 + ], + "size": [ + 340, + 460 + ], + "flags": {}, + "order": 39, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 263 + }, + { + "name": "clip", + "type": "CLIP", + "link": 264 + }, + { + "name": "sampler", + "type": "SAMPLER", + "link": 265 + }, + { + "name": "sigmas", + "type": "SIGMAS", + "link": 266 + }, + { + "name": "video_latents", + "type": "LATENT", + "link": 277 + }, + { + "name": "audio_latents", + "type": "LATENT", + "link": 278 + }, + { + "name": "assembly_plan", + "type": "H3_CONTINUUM_ASSEMBLY_PLAN", + "link": 279 + }, + { + "name": "refine_context", + "shape": 7, + "type": "H3_CONTINUUM_REFINE_CONTEXT", + "link": 307 + }, + { + "name": "video_vae", + "shape": 7, + "type": "VAE", + "link": 308 + } + ], + "outputs": [ + { + "name": "video_latents", + "shape": 6, + "type": "LATENT", + "links": [ + 270 + ] + }, + { + "name": "audio_latents", + "shape": 6, + "type": "LATENT", + "links": [ + 271 + ] + }, + { + "name": "updated_assembly_plan", + "type": "H3_CONTINUUM_ASSEMBLY_PLAN", + "links": [ + 303 + ] + }, + { + "name": "status", + "type": "STRING", + "links": [ + 276 + ] + } + ], + "properties": { + "Node name for S&R": "H3ContinuumHiResFixV35" + }, + "widgets_values": [ + false, + "lanczos", + 2, + 42, + "fixed" + ], + "widgets_values_named": { + "enabled": false, + "upscale_method": "lanczos", + "scale_by": 2, + "refine_seed": 42, + "control_after_generate": "fixed" + }, + "color": "#232", + "bgcolor": "#353" + }, + { + "id": 249, + "type": "PreviewAny", + "pos": [ + 1070, + 2190 + ], + "size": [ + 790, + 650 + ], + "flags": { + "collapsed": false + }, + "order": 38, + "mode": 0, + "inputs": [ + { + "name": "source", + "type": "*", + "link": 280 + } + ], + "outputs": [ + { + "name": "STRING", + "type": "STRING", + "links": null + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.32.0", + "Node name for S&R": "PreviewAny" + }, + "widgets_values": [], + "widgets_values_named": {} + }, + { + "id": 304, + "type": "PreviewAny", + "pos": [ + 1080, + 2930 + ], + "size": [ + 790, + 420 + ], + "flags": { + "collapsed": false + }, + "order": 42, + "mode": 0, + "inputs": [ + { + "name": "source", + "type": "*", + "link": 276 + } + ], + "outputs": [ + { + "name": "STRING", + "type": "STRING", + "links": null + } + ], + "title": "Hi-Res Fix status — NATIVE AUTO 576→768", + "properties": { + "cnr_id": "comfy-core", + "ver": "0.32.0", + "Node name for S&R": "PreviewAny" + }, + "widgets_values": [], + "widgets_values_named": {} + }, + { + "id": 307, + "type": "MiniMaxChunkFeedForward", + "pos": [ + 170, + 660 + ], + "size": [ + 320, + 90 + ], + "flags": {}, + "order": 28, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 306 + } + ], + "outputs": [ + { + "name": "model", + "type": "MODEL", + "links": [ + 305 + ] + } + ], + "properties": { + "cnr_id": "comfyui-kjnodes", + "ver": "1.5.0", + "Node name for S&R": "MiniMaxChunkFeedForward" + }, + "widgets_values": [ + 2, + 4096 + ], + "widgets_values_named": { + "chunks": 2, + "seq_threshold": 4096 + } + }, + { + "id": 240, + "type": "MiniMaxH3MemoryEfficientSageAttentionPatch", + "pos": [ + -230, + 670 + ], + "size": [ + 330, + 30 + ], + "flags": {}, + "order": 21, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 124 + } + ], + "outputs": [ + { + "name": "model", + "type": "MODEL", + "links": [ + 306 + ] + } + ], + "properties": { + "cnr_id": "comfyui-kjnodes", + "ver": "1.5.0", + "Node name for S&R": "MiniMaxH3MemoryEfficientSageAttentionPatch" + } + }, + { + "id": 135, + "type": "VAELoader", + "pos": [ + -770, + 1170 + ], + "size": [ + 530, + 60 + ], + "flags": {}, + "order": 13, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "VAE", + "type": "VAE", + "links": [ + 103, + 284, + 308 + ] + } + ], + "title": "Video VAE", + "properties": { + "cnr_id": "comfy-core", + "ver": "0.30.0", + "Node name for S&R": "VAELoader", + "models": [ + { + "name": "minimax_h3_video_vae_fp16.safetensors", + "url": "https://huggingface.co/Comfy-Org/MiniMax-H3/resolve/main/vae/minimax_h3_video_vae_fp16.safetensors", + "directory": "vae" + } + ] + }, + "widgets_values": [ + "minimax_h3_video_vae_fp16.safetensors" + ], + "widgets_values_named": { + "vae_name": "minimax_h3_video_vae_fp16.safetensors" + } + }, + { + "id": 295, + "type": "ImageScaleToTotalPixels", + "pos": [ + -2290, + 1810 + ], + "size": [ + 280, + 110 + ], + "flags": { + "collapsed": false + }, + "order": 22, + "mode": 4, + "showAdvanced": true, + "inputs": [ + { + "name": "image", + "type": "IMAGE", + "link": 255 + }, + { + "name": "megapixels", + "type": "FLOAT", + "widget": { + "name": "megapixels" + }, + "link": 257 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 289 + ] + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.30.0", + "Node name for S&R": "ImageScaleToTotalPixels" + }, + "widgets_values": [ + "area", + 0.3, + 32 + ], + "widgets_values_named": { + "upscale_method": "area", + "megapixels": 0.3, + "resolution_steps": 32 + }, + "color": "#432", + "bgcolor": "#653" + }, + { + "id": 119, + "type": "ImageScaleToTotalPixels", + "pos": [ + -3170, + 1780 + ], + "size": [ + 280, + 110 + ], + "flags": { + "collapsed": true + }, + "order": 23, + "mode": 0, + "showAdvanced": true, + "inputs": [ + { + "name": "image", + "type": "IMAGE", + "link": 1 + }, + { + "name": "megapixels", + "type": "FLOAT", + "widget": { + "name": "megapixels" + }, + "link": 258 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 2, + 21 + ] + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.30.0", + "Node name for S&R": "ImageScaleToTotalPixels" + }, + "widgets_values": [ + "area", + 0.3, + 32 + ], + "widgets_values_named": { + "upscale_method": "area", + "megapixels": 0.3, + "resolution_steps": 32 + }, + "color": "#432", + "bgcolor": "#653" + }, + { + "id": 264, + "type": "LoadImage", + "pos": [ + -1090, + 2070 + ], + "size": [ + 540, + 520 + ], + "flags": {}, + "order": 14, + "mode": 4, + "inputs": [], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 315 + ] + }, + { + "name": "MASK", + "type": "MASK", + "links": null + } + ], + "title": "Reference 2", + "properties": { + "cnr_id": "comfy-core", + "ver": "0.30.0", + "Node name for S&R": "LoadImage" + }, + "widgets_values": [ + "exec-f4d320af-42a8-4912-ad5d-d41461584f06.png", + "image" + ], + "widgets_values_named": { + "image": "exec-f4d320af-42a8-4912-ad5d-d41461584f06.png", + "upload": "image" + } + }, + { + "id": 257, + "type": "LoadImage", + "pos": [ + -1670, + 2060 + ], + "size": [ + 540, + 520 + ], + "flags": {}, + "order": 15, + "mode": 4, + "inputs": [], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 316 + ] + }, + { + "name": "MASK", + "type": "MASK", + "links": null + } + ], + "title": "Reference 2", + "properties": { + "cnr_id": "comfy-core", + "ver": "0.30.0", + "Node name for S&R": "LoadImage" + }, + "widgets_values": [ + "exec-a07e2530-4d97-4af7-b18e-02075c30082b - Copy.png", + "image" + ], + "widgets_values_named": { + "image": "exec-a07e2530-4d97-4af7-b18e-02075c30082b - Copy.png", + "upload": "image" + } + }, + { + "id": 258, + "type": "LoadImage", + "pos": [ + -2240, + 2070 + ], + "size": [ + 540, + 520 + ], + "flags": {}, + "order": 16, + "mode": 4, + "inputs": [], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 317 + ] + }, + { + "name": "MASK", + "type": "MASK", + "links": null + } + ], + "title": "Reference 1", + "properties": { + "cnr_id": "comfy-core", + "ver": "0.30.0", + "Node name for S&R": "LoadImage" + }, + "widgets_values": [ + "exec-05b19965-8744-452a-b823-11bd8983034a.png", + "image" + ], + "widgets_values_named": { + "image": "exec-05b19965-8744-452a-b823-11bd8983034a.png", + "upload": "image" + } + }, + { + "id": 182, + "type": "easy cleanGpuUsed", + "pos": [ + -2740, + 1820 + ], + "size": [ + 170, + 30 + ], + "flags": { + "collapsed": false + }, + "order": 30, + "mode": 0, + "inputs": [ + { + "name": "anything", + "type": "*", + "link": 21 + } + ], + "outputs": [ + { + "name": "output", + "type": "*", + "links": [ + 288 + ] + } + ], + "properties": { + "cnr_id": "comfyui-easy-use", + "ver": "1.3.6", + "Node name for S&R": "easy cleanGpuUsed" + }, + "color": "#2a363b", + "bgcolor": "#3f5159" + }, + { + "id": 259, + "type": "Fast Groups Bypasser (rgthree)", + "pos": [ + -460, + 2260 + ], + "size": [ + 280, + 80 + ], + "flags": {}, + "order": 17, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "OPT_CONNECTION", + "type": "*", + "links": null + } + ], + "properties": { + "matchColors": "", + "matchTitle": "Reference image", + "showNav": false, + "showAllGraphs": true, + "sort": "position", + "customSortAlphabet": "", + "toggleRestriction": "default" + }, + "color": "#2a363b", + "bgcolor": "#3f5159" + }, + { + "id": 292, + "type": "BasicScheduler", + "pos": [ + 650, + 870 + ], + "size": [ + 270, + 110 + ], + "flags": {}, + "order": 36, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 239 + } + ], + "outputs": [ + { + "name": "SIGMAS", + "type": "SIGMAS", + "links": [ + 266 + ] + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.33.3", + "Node name for S&R": "BasicScheduler" + }, + "widgets_values": [ + "simple", + 10, + 0.35 + ], + "widgets_values_named": { + "scheduler": "simple", + "steps": 10, + "denoise": 0.35 + } + }, + { + "id": 191, + "type": "SaveVideo", + "pos": [ + 1430, + 810 + ], + "size": [ + 940, + 1038 + ], + "flags": { + "collapsed": false + }, + "order": 47, + "mode": 0, + "inputs": [ + { + "name": "video", + "type": "VIDEO", + "link": 31 + } + ], + "outputs": [ + { + "name": "video", + "type": "VIDEO", + "links": null + } + ], + "title": "Save 3x5s Video", + "properties": { + "cnr_id": "comfy-core", + "ver": "0.30.0", + "Node name for S&R": "SaveVideo" + }, + "widgets_values": [ + "video/MiniMax_H3", + "auto", + "auto" + ], + "widgets_values_named": { + "filename_prefix": "video/MiniMax_H3", + "format": "auto", + "codec": "auto" + } + }, + { + "id": 297, + "type": "PrimitiveFloat", + "pos": [ + -2980, + 2250 + ], + "size": [ + 270, + 60 + ], + "flags": {}, + "order": 18, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "FLOAT", + "type": "FLOAT", + "links": [ + 257, + 258, + 309, + 310, + 311 + ] + } + ], + "title": "megapixels", + "properties": { + "cnr_id": "comfy-core", + "ver": "0.33.3", + "Node name for S&R": "PrimitiveFloat" + }, + "widgets_values": [ + 0.3 + ], + "widgets_values_named": { + "value": 0.3 + }, + "color": "#432", + "bgcolor": "#653" + }, + { + "id": 310, + "type": "ImageScaleToTotalPixels", + "pos": [ + -970, + 2670 + ], + "size": [ + 280, + 110 + ], + "flags": { + "collapsed": true + }, + "order": 26, + "mode": 4, + "showAdvanced": true, + "inputs": [ + { + "name": "image", + "type": "IMAGE", + "link": 315 + }, + { + "name": "megapixels", + "type": "FLOAT", + "widget": { + "name": "megapixels" + }, + "link": 311 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 318 + ] + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.30.0", + "Node name for S&R": "ImageScaleToTotalPixels" + }, + "widgets_values": [ + "area", + 0.3, + 32 + ], + "widgets_values_named": { + "upscale_method": "area", + "megapixels": 0.3, + "resolution_steps": 32 + }, + "color": "#432", + "bgcolor": "#653" + }, + { + "id": 309, + "type": "ImageScaleToTotalPixels", + "pos": [ + -1490, + 2660 + ], + "size": [ + 280, + 110 + ], + "flags": { + "collapsed": true + }, + "order": 25, + "mode": 4, + "showAdvanced": true, + "inputs": [ + { + "name": "image", + "type": "IMAGE", + "link": 316 + }, + { + "name": "megapixels", + "type": "FLOAT", + "widget": { + "name": "megapixels" + }, + "link": 310 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 320 + ] + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.30.0", + "Node name for S&R": "ImageScaleToTotalPixels" + }, + "widgets_values": [ + "area", + 0.3, + 32 + ], + "widgets_values_named": { + "upscale_method": "area", + "megapixels": 0.3, + "resolution_steps": 32 + }, + "color": "#432", + "bgcolor": "#653" + }, + { + "id": 308, + "type": "ImageScaleToTotalPixels", + "pos": [ + -2100, + 2660 + ], + "size": [ + 280, + 110 + ], + "flags": { + "collapsed": true + }, + "order": 24, + "mode": 4, + "showAdvanced": true, + "inputs": [ + { + "name": "image", + "type": "IMAGE", + "link": 317 + }, + { + "name": "megapixels", + "type": "FLOAT", + "widget": { + "name": "megapixels" + }, + "link": 309 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 321 + ] + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.30.0", + "Node name for S&R": "ImageScaleToTotalPixels" + }, + "widgets_values": [ + "area", + 0.3, + 32 + ], + "widgets_values_named": { + "upscale_method": "area", + "megapixels": 0.3, + "resolution_steps": 32 + }, + "color": "#432", + "bgcolor": "#653" + }, + { + "id": 281, + "type": "VHS_LoadVideo", + "pos": [ + -120, + 2100 + ], + "size": [ + 430, + 734 + ], + "flags": {}, + "order": 19, + "mode": 4, + "inputs": [ + { + "name": "meta_batch", + "shape": 7, + "type": "VHS_BatchManager", + "link": null + }, + { + "name": "vae", + "shape": 7, + "type": "VAE", + "link": null + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 322 + ] + }, + { + "name": "frame_count", + "type": "INT", + "links": null + }, + { + "name": "audio", + "type": "AUDIO", + "links": [ + 214 + ] + }, + { + "name": "video_info", + "type": "VHS_VIDEOINFO", + "links": null + } + ], + "properties": { + "cnr_id": "comfyui-videohelpersuite", + "ver": "1.7.9", + "Node name for S&R": "VHS_LoadVideo" + }, + "widgets_values": { + "video": "MiniMax_H3_Continuum_V31_00103_.mp4", + "force_rate": 0, + "custom_width": 0, + "custom_height": 0, + "frame_load_cap": 0, + "skip_first_frames": 0, + "select_every_nth": 1, + "format": "AnimateDiff", + "videopreview": { + "hidden": false, + "paused": false, + "params": { + "filename": "MiniMax_H3_Continuum_V31_00103_.mp4", + "type": "input", + "format": "video/mp4", + "force_rate": 0, + "custom_width": 0, + "custom_height": 0, + "frame_load_cap": 0, + "skip_first_frames": 0, + "select_every_nth": 1 + } + } + }, + "widgets_values_named": { + "video": "MiniMax_H3_Continuum_V31_00103_.mp4", + "force_rate": 0, + "custom_width": 0, + "custom_height": 0, + "frame_load_cap": 0, + "skip_first_frames": 0, + "select_every_nth": 1, + "format": "AnimateDiff", + "choose video to upload": null, + "videopreview": { + "hidden": false, + "paused": false, + "params": { + "filename": "MiniMax_H3_Continuum_V31_00103_.mp4", + "type": "input", + "format": "video/mp4", + "force_rate": 0, + "custom_width": 0, + "custom_height": 0, + "frame_load_cap": 0, + "skip_first_frames": 0, + "select_every_nth": 1 + } + } + } + }, + { + "id": 306, + "type": "H3ContinuumAssembleSeamV35", + "pos": [ + 1010, + 800 + ], + "size": [ + 360, + 220 + ], + "flags": {}, + "order": 43, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 301 + }, + { + "name": "audio", + "type": "AUDIO", + "link": 302 + }, + { + "name": "assembly_plan", + "type": "H3_CONTINUUM_ASSEMBLY_PLAN", + "link": 303 + }, + { + "name": "driving_audio", + "shape": 7, + "type": "AUDIO", + "link": 304 + } + ], + "outputs": [ + { + "name": "images", + "type": "IMAGE", + "links": [ + 298 + ] + }, + { + "name": "audio", + "type": "AUDIO", + "links": [ + 299 + ] + }, + { + "name": "report", + "type": "STRING", + "links": [ + 300 + ] + } + ], + "properties": { + "Node name for S&R": "H3ContinuumAssembleSeamV35" + }, + "widgets_values": [ + true, + "Auto", + "Auto", + "Auto", + "Detailed Report" + ], + "widgets_values_named": { + "exact_total_duration": true, + "audio_seam": "Auto", + "video_seam": "Auto", + "buffer_backend": "Auto", + "diagnostics": "Detailed Report" + }, + "color": "#232", + "bgcolor": "#353" + }, + { + "id": 305, + "type": "H3ContinuumSamplerV36", + "pos": [ + 230, + 930 + ], + "size": [ + 300, + 800 + ], + "flags": {}, + "order": 37, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 282 + }, + { + "name": "clip", + "type": "CLIP", + "link": 283 + }, + { + "name": "video_vae", + "type": "VAE", + "link": 284 + }, + { + "name": "sampler", + "type": "SAMPLER", + "link": 285 + }, + { + "name": "sigmas", + "type": "SIGMAS", + "link": 286 + }, + { + "label": "Sequence Prompt", + "name": "sequence_prompt", + "type": "STRING", + "link": 287 + }, + { + "name": "first_frame", + "shape": 7, + "type": "IMAGE", + "link": 288 + }, + { + "name": "last_frame", + "shape": 7, + "type": "IMAGE", + "link": 289 + }, + { + "name": "reference_image_1", + "shape": 7, + "type": "IMAGE", + "link": 321 + }, + { + "name": "reference_image_2", + "shape": 7, + "type": "IMAGE", + "link": 320 + }, + { + "name": "reference_image_3", + "shape": 7, + "type": "IMAGE", + "link": 318 + }, + { + "label": "Video Reference", + "name": "reference_video_1", + "shape": 7, + "type": "IMAGE", + "link": 322 + }, + { + "name": "driving_audio", + "shape": 7, + "type": "AUDIO", + "link": 294 + }, + { + "name": "audio_vae", + "shape": 7, + "type": "VAE", + "link": 295 + }, + { + "name": "width", + "type": "INT", + "widget": { + "name": "width" + }, + "link": 296 + }, + { + "name": "height", + "type": "INT", + "widget": { + "name": "height" + }, + "link": 297 + } + ], + "outputs": [ + { + "name": "video_latents", + "shape": 6, + "type": "LATENT", + "links": [ + 277 + ] + }, + { + "name": "audio_latents", + "shape": 6, + "type": "LATENT", + "links": [ + 278 + ] + }, + { + "name": "assembly_plan", + "type": "H3_CONTINUUM_ASSEMBLY_PLAN", + "links": [ + 279 + ] + }, + { + "name": "status", + "type": "STRING", + "links": [ + 280 + ] + }, + { + "name": "driving_audio", + "type": "AUDIO", + "links": [ + 304 + ] + }, + { + "name": "refine_context", + "type": "H3_CONTINUUM_REFINE_CONTEXT", + "links": [ + 307 + ] + } + ], + "properties": { + "Node name for S&R": "H3ContinuumSamplerV36" + }, + "widgets_values": [ + "Auto", + 1, + 5, + 1344, + 768, + "Balanced — 22 frames", + 1025049120664532, + "randomize", + true, + "Detailed Report", + "Auto", + 0, + false, + true, + true, + "Off", + "", + "Match Output", + "d1c61168-c72e-44d1-9b78-1c9adb4eba0e", + "Efficient - 0.4 MP", + "Standard" + ], + "widgets_values_named": { + "prompt_mode": "Auto", + "chunks": 1, + "chunk_seconds": 5, + "width": 1344, + "height": 768, + "continuity": "Balanced — 22 frames", + "base_seed": 1025049120664532, + "control_after_generate": "randomize", + "audio_continuity": true, + "diagnostics": "Detailed Report", + "reroll_from_chunk": "Auto", + "reroll_nonce": 0, + "strict_compatibility": false, + "debug": true, + "show_preview": true, + "run_storage": "Off", + "run_name": "", + "reference_size": "Match Output", + "project_id": "d1c61168-c72e-44d1-9b78-1c9adb4eba0e", + "video_reference_size": "Efficient - 0.4 MP", + "continuation_backend": "Standard" + }, + "color": "#232", + "bgcolor": "#353" + }, + { + "id": 188, + "type": "PrimitiveStringMultiline", + "pos": [ + -1810, + 860 + ], + "size": [ + 1010, + 1030 + ], + "flags": {}, + "order": 20, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "STRING", + "type": "STRING", + "links": [ + 287 + ] + } + ], + "properties": { + "cnr_id": "comfy-core", + "ver": "0.31.0", + "Node name for S&R": "PrimitiveStringMultiline" + }, + "widgets_values": [ + "" + ], + "widgets_values_named": { + "value": "" + } + } + ], + "links": [ + [ + 1, + 114, + 0, + 119, + 0, + "IMAGE" + ], + [ + 2, + 119, + 0, + 120, + 0, + "IMAGE" + ], + [ + 15, + 150, + 0, + 153, + 0, + "MODEL" + ], + [ + 21, + 119, + 0, + 182, + 0, + "IMAGE" + ], + [ + 31, + 183, + 0, + 191, + 0, + "VIDEO" + ], + [ + 102, + 136, + 0, + 227, + 1, + "VAE" + ], + [ + 103, + 135, + 0, + 226, + 1, + "VAE" + ], + [ + 108, + 228, + 0, + 183, + 0, + "VIDEO" + ], + [ + 124, + 147, + 0, + 240, + 0, + "MODEL" + ], + [ + 143, + 120, + 0, + 255, + 0, + "INT" + ], + [ + 144, + 120, + 1, + 254, + 0, + "INT" + ], + [ + 145, + 256, + 0, + 255, + 1, + "INT" + ], + [ + 146, + 256, + 1, + 254, + 1, + "INT" + ], + [ + 214, + 281, + 2, + 284, + 1, + "AUDIO" + ], + [ + 215, + 266, + 0, + 284, + 0, + "AUDIO" + ], + [ + 216, + 286, + 0, + 150, + 0, + "MODEL" + ], + [ + 239, + 150, + 0, + 292, + 0, + "MODEL" + ], + [ + 255, + 290, + 0, + 295, + 0, + "IMAGE" + ], + [ + 257, + 297, + 0, + 295, + 1, + "FLOAT" + ], + [ + 258, + 297, + 0, + 119, + 1, + "FLOAT" + ], + [ + 263, + 150, + 0, + 302, + 0, + "MODEL" + ], + [ + 264, + 142, + 0, + 302, + 1, + "CLIP" + ], + [ + 265, + 139, + 0, + 302, + 2, + "SAMPLER" + ], + [ + 266, + 292, + 0, + 302, + 3, + "SIGMAS" + ], + [ + 270, + 302, + 0, + 226, + 0, + "LATENT" + ], + [ + 271, + 302, + 1, + 227, + 0, + "LATENT" + ], + [ + 276, + 302, + 3, + 304, + 0, + "STRING" + ], + [ + 277, + 305, + 0, + 302, + 4, + "LATENT" + ], + [ + 278, + 305, + 1, + 302, + 5, + "LATENT" + ], + [ + 279, + 305, + 2, + 302, + 6, + "H3_CONTINUUM_ASSEMBLY_PLAN" + ], + [ + 280, + 305, + 3, + 249, + 0, + "STRING" + ], + [ + 282, + 150, + 0, + 305, + 0, + "MODEL" + ], + [ + 283, + 142, + 0, + 305, + 1, + "CLIP" + ], + [ + 284, + 135, + 0, + 305, + 2, + "VAE" + ], + [ + 285, + 139, + 0, + 305, + 3, + "SAMPLER" + ], + [ + 286, + 153, + 0, + 305, + 4, + "SIGMAS" + ], + [ + 287, + 188, + 0, + 305, + 5, + "STRING" + ], + [ + 288, + 182, + 0, + 305, + 6, + "IMAGE" + ], + [ + 289, + 295, + 0, + 305, + 7, + "IMAGE" + ], + [ + 294, + 284, + 0, + 305, + 12, + "AUDIO" + ], + [ + 295, + 136, + 0, + 305, + 13, + "VAE" + ], + [ + 296, + 255, + 0, + 305, + 14, + "INT" + ], + [ + 297, + 254, + 0, + 305, + 15, + "INT" + ], + [ + 298, + 306, + 0, + 228, + 0, + "IMAGE" + ], + [ + 299, + 306, + 1, + 228, + 1, + "AUDIO" + ], + [ + 300, + 306, + 2, + 250, + 0, + "STRING" + ], + [ + 301, + 226, + 0, + 306, + 0, + "IMAGE" + ], + [ + 302, + 227, + 0, + 306, + 1, + "AUDIO" + ], + [ + 303, + 302, + 2, + 306, + 2, + "H3_CONTINUUM_ASSEMBLY_PLAN" + ], + [ + 304, + 305, + 4, + 306, + 3, + "AUDIO" + ], + [ + 305, + 307, + 0, + 286, + 0, + "MODEL" + ], + [ + 306, + 240, + 0, + 307, + 0, + "MODEL" + ], + [ + 307, + 305, + 5, + 302, + 7, + "H3_CONTINUUM_REFINE_CONTEXT" + ], + [ + 308, + 135, + 0, + 302, + 8, + "VAE" + ], + [ + 309, + 297, + 0, + 308, + 1, + "FLOAT" + ], + [ + 310, + 297, + 0, + 309, + 1, + "FLOAT" + ], + [ + 311, + 297, + 0, + 310, + 1, + "FLOAT" + ], + [ + 315, + 264, + 0, + 310, + 0, + "IMAGE" + ], + [ + 316, + 257, + 0, + 309, + 0, + "IMAGE" + ], + [ + 317, + 258, + 0, + 308, + 0, + "IMAGE" + ], + [ + 318, + 310, + 0, + 305, + 10, + "IMAGE" + ], + [ + 320, + 309, + 0, + 305, + 9, + "IMAGE" + ], + [ + 321, + 308, + 0, + 305, + 8, + "IMAGE" + ], + [ + 322, + 281, + 0, + 305, + 11, + "IMAGE" + ] + ], + "groups": [ + { + "id": 1, + "title": "Shared H3 Models and Accelerators", + "bounding": [ + -1850, + 760, + 2410, + 1180 + ], + "color": "#3f789e", + "flags": {} + }, + { + "id": 2, + "title": "first frame", + "bounding": [ + -3180, + 810, + 760, + 1130 + ], + "color": "#3f789e", + "flags": {} + }, + { + "id": 3, + "title": "Reference image", + "bounding": [ + -2260, + 1990, + 1750, + 740 + ], + "color": "#3f789e", + "flags": {} + }, + { + "id": 4, + "title": "video audio", + "bounding": [ + -140, + 2000, + 830, + 830 + ], + "color": "#3f789e", + "flags": {} + }, + { + "id": 6, + "title": "last frame", + "bounding": [ + -2380, + 820, + 500, + 1120 + ], + "color": "#3f789e", + "flags": {} + }, + { + "id": 7, + "title": "H3 Continuum Second Pass", + "bounding": [ + 580, + 760, + 390, + 1190 + ], + "color": "#3f789e", + "flags": {} + } + ], + "config": {}, + "extra": { + "frontendVersion": "1.49.6", + "VHS_latentpreview": false, + "VHS_latentpreviewrate": 0, + "ds": { + "scale": 0.46650738020973403, + "offset": [ + 2427.315185198168, + -587.2022768864995 + ] + }, + "VHS_MetadataImage": false, + "VHS_KeepIntermediate": true, + "reroutes": [ + { + "id": 1, + "pos": [ + -2310, + 2654 + ], + "linkIds": [ + 309, + 310, + 311 + ] + } + ], + "linkExtensions": [ + { + "id": 309, + "parentId": 1 + }, + { + "id": 310, + "parentId": 1 + }, + { + "id": 311, + "parentId": 1 + } + ] + }, + "version": 0.4 +} diff --git a/metadata.ini b/metadata.ini index 2ea7e1e..939ed23 100644 --- a/metadata.ini +++ b/metadata.ini @@ -1,4 +1,4 @@ [project] name = H3 Continuum -version = 3.5.3 -description = Native MiniMax H3 continuation with Second Pass, experimental Hi-Res Fix, and disk-backed assembly. +version = 3.6.0 +description = Native MiniMax H3 masked AV continuation, Second Pass, and disk-backed assembly. diff --git a/nodes.py b/nodes.py index 945e625..f4706eb 100644 --- a/nodes.py +++ b/nodes.py @@ -422,6 +422,7 @@ NODE_DISPLAY_NAME_MAPPINGS.update(V35_HIRES_FIX_NODE_DISPLAY_NAME_MAPPINGS) _primary_node_ids = { "H3ContinuumSamplerV34", "H3ContinuumSamplerV35", + "H3ContinuumSamplerV36", "H3ContinuumAssembleSeamV34", "H3ContinuumAssembleSeamV35", "H3ContinuumHiResFixV35", diff --git a/pyproject.toml b/pyproject.toml index bb2650d..a2a6a34 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "comfyui-h3-continuum" -version = "3.5.3" +version = "3.6.0" description = "Integrated N-chunk continuation for ComfyUI native MiniMax H3 video and audio" readme = "README.md" requires-python = ">=3.10" diff --git a/run_storage.py b/run_storage.py index e4adf3e..20fbb70 100644 --- a/run_storage.py +++ b/run_storage.py @@ -856,6 +856,25 @@ def _entry_metadata(entry: dict[str, Any]) -> dict[str, Any]: } +def _resume_session_settings( + *, + contract: dict[str, Any], + revision_id: str, + first_frame_hash: str, + last_frame_hash: str, +) -> dict[str, Any]: + settings = { + "run_storage_validated_prefix": True, + "revision_id": str(revision_id), + "first_frame_hash": str(first_frame_hash), + "last_frame_hash": str(last_frame_hash), + } + settings.update( + dict((contract.get("global") or {}).get("execution_semantics") or {}) + ) + return settings + + class RunStorageController: def __init__(self, run_name: str): self.run_name = sanitize_run_name(run_name) @@ -1129,17 +1148,18 @@ class RunStorageController: self._write_project() if not best_entries: return None + session_settings = _resume_session_settings( + contract=contract, + revision_id=self.revision_id, + first_frame_hash=first_frame_hash, + last_frame_hash=last_frame_hash, + ) return make_session( chunks=best_entries, width=int(width), height=int(height), chunk_seconds=float(chunk_seconds), identity_hash=str(identity_hash), model_fingerprint_value=str(model_fingerprint_value), parent_session_id=None, reroll_from_chunk=0, - settings={ - "run_storage_validated_prefix": True, - "revision_id": self.revision_id, - "first_frame_hash": str(first_frame_hash), - "last_frame_hash": str(last_frame_hash), - }, + settings=session_settings, ) def commit_chunk(self, entry: dict[str, Any], *, position: int) -> None: diff --git a/tests/test_release_metadata.py b/tests/test_release_metadata.py index e8257fc..d710574 100644 --- a/tests/test_release_metadata.py +++ b/tests/test_release_metadata.py @@ -6,7 +6,7 @@ import tomllib ROOT = Path(__file__).resolve().parents[1] -EXPECTED_VERSION = "3.5.3" +EXPECTED_VERSION = "3.6.0" def test_v35_release_metadata_is_consistent(): diff --git a/tests/test_temporal.py b/tests/test_temporal.py index 54c7832..b95b7e4 100644 --- a/tests/test_temporal.py +++ b/tests/test_temporal.py @@ -75,7 +75,7 @@ def test_dynamic_state_capacity_for_short_extensions(): def test_extension_shapes_remain_valid_across_ui_range(): for context in (5, 22, 39): - for tenths in range(5, 151): + for tenths in range(40, 301): shape = make_extension_shape(context, tenths / 10.0) assert shape.total_frames % 17 == 5 assert shape.net_new_frames >= 5 diff --git a/tests/test_v217_stable_facade.py b/tests/test_v217_stable_facade.py index 9f3e65e..9d158ca 100644 --- a/tests/test_v217_stable_facade.py +++ b/tests/test_v217_stable_facade.py @@ -145,4 +145,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.5.3"' in version_source + assert 'PACKAGE_VERSION = "3.6.0"' in version_source diff --git a/tests/test_v2_prompts.py b/tests/test_v2_prompts.py index 6b6a8f6..5689327 100644 --- a/tests/test_v2_prompts.py +++ b/tests/test_v2_prompts.py @@ -169,6 +169,39 @@ def test_native_h3_chunk_duration_rejects_sub_four_seconds(): make_prompt_plan(mode=PROMPT_MODE_FIXED, script="x", chunks=1, chunk_seconds=3.9) +def test_chunk_duration_accepts_thirty_seconds_and_rejects_above_limit(): + plan = make_prompt_plan( + mode=PROMPT_MODE_FIXED, + script="x", + chunks=1, + chunk_seconds=30.0, + ) + assert plan["chunk_seconds"] == 30.0 + assert validate_prompt_plan(plan) is plan + + invalid_plan = dict(plan, chunk_seconds=30.1) + with pytest.raises(PromptPlanError, match="30.0"): + validate_prompt_plan(invalid_plan) + + with pytest.raises(PromptPlanError, match="30.0"): + make_prompt_plan( + mode=PROMPT_MODE_FIXED, + script="x", + chunks=1, + chunk_seconds=30.1, + ) + + +def test_thirty_second_timeline_maps_one_section_to_each_chunk(): + plan = make_prompt_plan( + mode=PROMPT_MODE_TIMELINE, + script="[0-30s]\nfirst\n[30-60s]\nsecond", + chunks=2, + chunk_seconds=30.0, + ) + assert plan["prompts"] == ["first", "second"] + + def test_external_prompt_overrides_only_the_connected_clip_and_rehashes_it(): plan = make_prompt_plan(mode=PROMPT_MODE_LIST, script="first\n---\nsecond\n---\nthird", chunks=3, chunk_seconds=5) updated = apply_prompt_overrides(plan, [None, "external second", None]) diff --git a/tests/test_v31_run_storage.py b/tests/test_v31_run_storage.py index 73e25b6..1b3d8ee 100644 --- a/tests/test_v31_run_storage.py +++ b/tests/test_v31_run_storage.py @@ -10,6 +10,7 @@ import ctypes from ComfyUI_H3_Continuum_Join.run_storage import ( RunStorageController, + _resume_session_settings, _apply_nonce_contract, _fsync_file, _pid_exists_windows, @@ -407,6 +408,64 @@ def test_terminal_seed_v2_revision_is_scoped_and_distinct(): assert revision_identity(old_contract) != revision_identity(new_contract) +def test_nondefault_continuation_transport_scopes_revision_identity(): + common = { + "model": _Model(), + "clip": _Clip(), + "video_vae": _VideoVAE(), + "sampler": _Sampler(), + } + default_contract, default_safe, default_reasons = _sampling_contract(**common) + explicit_reference, reference_safe, reference_reasons = _sampling_contract( + **common, + execution_semantics=None, + ) + masked_contract, masked_safe, masked_reasons = _sampling_contract( + **common, + execution_semantics={ + "continuation_transport": "masked_av_prefix_22_v1", + }, + ) + + assert default_safe, default_reasons + assert reference_safe, reference_reasons + assert masked_safe, masked_reasons + assert "execution_semantics" not in default_contract["global"] + assert revision_identity(default_contract) == revision_identity(explicit_reference) + assert masked_contract["global"]["execution_semantics"] == { + "continuation_transport": "masked_av_prefix_22_v1", + } + assert revision_identity(masked_contract) != revision_identity(default_contract) + + +def test_run_storage_resume_session_preserves_execution_semantics(): + contract = { + "global": { + "execution_semantics": { + "flf_execution": "terminal_merged_10s_seed_v2", + "terminal_seed_policy": "physical_window_seed_v2", + "continuation_transport": "masked_av_prefix_22_v1", + } + } + } + settings = _resume_session_settings( + contract=contract, + revision_id="revision-a", + first_frame_hash="first-a", + last_frame_hash="last-a", + ) + + assert settings == { + "run_storage_validated_prefix": True, + "revision_id": "revision-a", + "first_frame_hash": "first-a", + "last_frame_hash": "last-a", + "flf_execution": "terminal_merged_10s_seed_v2", + "terminal_seed_policy": "physical_window_seed_v2", + "continuation_transport": "masked_av_prefix_22_v1", + } + + def test_terminal_seed_v2_revision_identity_is_deterministic(): semantics = { "flf_execution": "terminal_merged_10s_seed_v2", diff --git a/tests/test_v35_compact_ui_frontend.py b/tests/test_v35_compact_ui_frontend.py index 8a83653..0dc8535 100644 --- a/tests/test_v35_compact_ui_frontend.py +++ b/tests/test_v35_compact_ui_frontend.py @@ -31,6 +31,20 @@ def test_v35_sampler_uses_existing_compact_runtime_settings_path(): assert f"hidePersistentWidget(findWidget(node, {widget_name}))" in configure +def test_v36_sampler_uses_compact_settings_without_hiding_backend_choice(): + source = PROJECT_ID_JS.read_text(encoding="utf-8") + configure = _function_source(source, "configureNode", "configureNodeAfterSetup") + before_queue = source[source.index("async beforeQueuePrompt") :] + + assert 'const V36_NODE_CLASS = "H3ContinuumSamplerV36";' in source + assert "const isV36 = node.comfyClass === V36_NODE_CLASS;" in configure + assert "!isProduction && !isTimeline && !isV34 && !isV35 && !isV36" in configure + assert "isProduction || isV34 || isV35 || isV36" in configure + assert "isV35 || isV36" in configure + assert "node.comfyClass === V36_NODE_CLASS" in before_queue + assert 'hidePersistentWidget(findWidget(node, "continuation_backend"))' not in configure + + def test_v35_assembler_uses_existing_compact_runtime_settings_path(): source = PROJECT_ID_JS.read_text(encoding="utf-8") configure = _function_source(source, "configureAssembler", "configureNode") diff --git a/tests/test_v35_context_sampler.py b/tests/test_v35_context_sampler.py index e51051b..9f73180 100644 --- a/tests/test_v35_context_sampler.py +++ b/tests/test_v35_context_sampler.py @@ -1,5 +1,7 @@ from __future__ import annotations +import sys +from types import ModuleType from types import SimpleNamespace import torch @@ -12,6 +14,10 @@ from ComfyUI_H3_Continuum_Join.constants import ( V2_CONTINUITY_OPTIONS, ) from ComfyUI_H3_Continuum_Join.temporal import audio_latent_t, video_latent_t +from ComfyUI_H3_Continuum_Join.reference import ( + REFERENCE_SIZE_MATCH_OUTPUT, + ReferenceAssets, +) from ComfyUI_H3_Continuum_Join.v2 import sequence from ComfyUI_H3_Continuum_Join.v2.h3_builder import IdentityAssets from ComfyUI_H3_Continuum_Join.v2.prompts import make_prompt_plan @@ -34,6 +40,15 @@ class _Nested: return self.parts +def _install_nested_tensor(monkeypatch): + nested_module = ModuleType("comfy.nested_tensor") + nested_module.NestedTensor = _Nested + comfy_module = sys.modules.get("comfy") or ModuleType("comfy") + comfy_module.nested_tensor = nested_module + monkeypatch.setitem(sys.modules, "comfy", comfy_module) + monkeypatch.setitem(sys.modules, "comfy.nested_tensor", nested_module) + + class _Clip: def __init__(self): self.encode_calls = 0 @@ -83,13 +98,16 @@ def _capture_sequence( monkeypatch, *, terminal: bool, + reference_image: bool = False, reference_audio: bool = False, + continuation_transport=sequence.REFERENCE_CONTEXT_V1, session=None, diagnostics=DIAGNOSTICS_BASIC, memory_attribution=False, prompt_conditioning_cache=False, clip=None, ): + _install_nested_tensor(monkeypatch) width, height = 96, 64 first_image = torch.zeros((1, height, width, 3)) if terminal else None last_image = torch.ones((1, height, width, 3)) if terminal else None @@ -118,6 +136,15 @@ def _capture_sequence( "clone_model_for_chunk", lambda model, **_kwargs: model, ) + reference_assets = None + if reference_image: + reference_assets = ReferenceAssets( + images=(torch.full((1, height, width, 3), 0.5),), + latents=(torch.full((1, 24, 1, height // 16, width // 16), 0.5),), + image_hashes=("b" * 64,), + combined_hash="c" * 64, + size_mode=REFERENCE_SIZE_MATCH_OUTPUT, + ) reference_audio_source = None reference_audio_vae = None if reference_audio: @@ -171,11 +198,13 @@ def _capture_sequence( debug=False, session=session, latent_only=True, + reference_assets=reference_assets, reference_audio_source=reference_audio_source, reference_audio_vae=reference_audio_vae, capture_refine_context=True, memory_attribution=memory_attribution, prompt_conditioning_cache=prompt_conditioning_cache, + continuation_transport=continuation_transport, ) @@ -346,6 +375,37 @@ def test_reference_audio_is_captured_in_terminal_physical_group(monkeypatch): assert [ref["kind"] for ref in refs].count("audio") == 1 +def test_masked_av_preserves_image_and_audio_refs_in_every_normal_group(monkeypatch): + outputs = _capture_sequence( + monkeypatch, + terminal=False, + reference_image=True, + reference_audio=True, + continuation_transport=sequence.MASKED_AV_PREFIX_22_V1, + ) + groups = outputs[4]["groups"] + assert [group["logical_chunks"] for group in groups] == [(1,), (2,)] + for group in groups: + refs = group["conditioning"][0][1]["minimax_refs"] + assert [ref["kind"] for ref in refs] == ["image", "audio"] + + +def test_masked_av_preserves_image_and_audio_refs_in_terminal_groups(monkeypatch): + outputs = _capture_sequence( + monkeypatch, + terminal=True, + reference_image=True, + reference_audio=True, + continuation_transport=sequence.MASKED_AV_PREFIX_22_V1, + ) + groups = outputs[4]["groups"] + assert [group["logical_chunks"] for group in groups] == [(1,), (2, 3)] + assert groups[1]["prompt_policy"] == "paired_timeline_v1" + for group in groups: + refs = group["conditioning"][0][1]["minimax_refs"] + assert [ref["kind"] for ref in refs] == ["image", "audio"] + + def test_reused_session_returns_incomplete_context_without_stopping(monkeypatch): first_outputs = _capture_sequence(monkeypatch, terminal=False) reused_outputs = _capture_sequence( diff --git a/tests/test_v36_chunk_duration.py b/tests/test_v36_chunk_duration.py new file mode 100644 index 0000000..8529f36 --- /dev/null +++ b/tests/test_v36_chunk_duration.py @@ -0,0 +1,45 @@ +from ComfyUI_H3_Continuum_Join.constants import CHUNK_SECONDS_TOOLTIP +from ComfyUI_H3_Continuum_Join.v2.nodes import ( + H3ContinuumPromptPlanPreview, + H3ContinuumSampler, + H3ContinuumSamplerV2, +) +from ComfyUI_H3_Continuum_Join.v3.driving_nodes import ( + H3ContinuumSamplerV34, + H3ContinuumSamplerV35, +) +from ComfyUI_H3_Continuum_Join.v3.nodes import ( + H3ContinuumSamplerProduction, + H3ContinuumSamplerV3, +) + + +def _chunk_seconds_schema(node_class): + return node_class.INPUT_TYPES()["required"]["chunk_seconds"][1] + + +def test_all_shared_sampler_and_prompt_plan_schemas_allow_thirty_seconds(): + node_classes = ( + H3ContinuumSamplerV2, + H3ContinuumPromptPlanPreview, + H3ContinuumSampler, + H3ContinuumSamplerV3, + H3ContinuumSamplerProduction, + H3ContinuumSamplerV34, + H3ContinuumSamplerV35, + ) + for node_class in node_classes: + schema = _chunk_seconds_schema(node_class) + assert schema["default"] == 5.0 + assert schema["min"] == 4.0 + assert schema["max"] == 30.0 + assert schema["step"] == 0.1 + assert schema["tooltip"] == CHUNK_SECONDS_TOOLTIP + + +def test_chunk_seconds_tooltip_describes_validated_and_high_cost_ranges(): + assert "5–15 seconds" in CHUNK_SECONDS_TOOLTIP + assert "above 15 seconds are supported" in CHUNK_SECONDS_TOOLTIP + assert "VRAM" in CHUNK_SECONDS_TOOLTIP + assert "high resolution" in CHUNK_SECONDS_TOOLTIP + assert "shared by every chunk" in CHUNK_SECONDS_TOOLTIP diff --git a/tests/test_v36_masked_video_prefix.py b/tests/test_v36_masked_video_prefix.py new file mode 100644 index 0000000..19f9862 --- /dev/null +++ b/tests/test_v36_masked_video_prefix.py @@ -0,0 +1,795 @@ +from __future__ import annotations + +import hashlib +import sys +from types import ModuleType, SimpleNamespace + +import pytest +import torch + +from ComfyUI_H3_Continuum_Join.constants import ( + CONTINUITY_OPTIONS, + CONTINUUM_INTEROP_KEY, + DIAGNOSTICS_BASIC, + PROMPT_MODE_FIXED, + PROMPT_MODE_LIST, + V2_CONTINUITY_OPTIONS, +) +from ComfyUI_H3_Continuum_Join.temporal import ( + audio_grid_offset, + audio_latent_t, + context_slots, + make_extension_shape, + video_latent_t, +) +from ComfyUI_H3_Continuum_Join.v2.h3_builder import IdentityAssets +from ComfyUI_H3_Continuum_Join.v2.prompts import make_prompt_plan +from ComfyUI_H3_Continuum_Join.v2 import sequence +from ComfyUI_H3_Continuum_Join.v2.seeds import derive_chunk_seed +from ComfyUI_H3_Continuum_Join.v3.plan import prepare_physical_decode_entries +from ComfyUI_H3_Continuum_Join.v3.masked_continuation import ( + MASKED_AV_PREFIX_22_V1, + MASKED_AV_PREFIX_39_V1, + MASKED_VIDEO_PREFIX_V1, + build_masked_av_prefix_latent, + build_masked_video_prefix_latent, + restore_masked_av_prefix, +) + + +class Nested: + def __init__(self, parts): + self.parts = list(parts) + + def unbind(self): + return self.parts + + +class FakeClip: + def tokenize(self, prompt, images): + return prompt + + def encode_from_tokens_scheduled(self, tokens): + return [[torch.zeros(1, 1, 2), {}]] + + +def _install_nested_tensor(monkeypatch): + nested_module = ModuleType("comfy.nested_tensor") + nested_module.NestedTensor = Nested + comfy_module = sys.modules.get("comfy") or ModuleType("comfy") + comfy_module.nested_tensor = nested_module + monkeypatch.setitem(sys.modules, "comfy", comfy_module) + monkeypatch.setitem(sys.modules, "comfy.nested_tensor", nested_module) + + +def _latent(width, height, frames, *, fill=0.0): + return { + "samples": Nested( + ( + torch.full( + (1, 24, video_latent_t(frames), height // 16, width // 16), + float(fill), + ), + torch.full((1, 32, 2, audio_latent_t(frames)), float(fill)), + ) + ) + } + + +def _sha256(tensor): + value = tensor.detach().to("cpu").contiguous() + return hashlib.sha256(value.view(torch.uint8).numpy().tobytes()).hexdigest() + + +def test_nondefault_transport_scopes_session_and_run_storage_identity(): + base_hash = "a" * 64 + + assert sequence._continuation_transport_identity( + base_hash, sequence.REFERENCE_CONTEXT_V1 + ) == base_hash + masked_hash = sequence._continuation_transport_identity( + base_hash, MASKED_AV_PREFIX_22_V1 + ) + assert masked_hash != base_hash + assert masked_hash == sequence._continuation_transport_identity( + base_hash, MASKED_AV_PREFIX_22_V1 + ) + assert masked_hash != sequence._continuation_transport_identity( + base_hash, MASKED_AV_PREFIX_39_V1 + ) + + assert sequence._terminal_execution_semantics( + merge_enabled=False, + continuation_transport=sequence.REFERENCE_CONTEXT_V1, + ) is None + assert sequence._terminal_execution_semantics( + merge_enabled=False, + continuation_transport=MASKED_AV_PREFIX_22_V1, + ) == {"continuation_transport": MASKED_AV_PREFIX_22_V1} + assert sequence._terminal_execution_semantics( + merge_enabled=True, + prompt_policy=sequence.TERMINAL_PROMPT_POLICY_TIMELINE, + continuation_transport=MASKED_AV_PREFIX_22_V1, + ) == { + "flf_execution": sequence.FLF_STRATEGY, + "terminal_seed_policy": sequence.TERMINAL_SEED_POLICY, + "terminal_prompt_policy": sequence.TERMINAL_PROMPT_POLICY_TIMELINE, + "continuation_transport": MASKED_AV_PREFIX_22_V1, + } + + +def test_masked_av_39f_temporal_contract_is_exact_duration_with_known_grid_phase(): + shape = make_extension_shape(39, 5.0) + + assert context_slots(39) == 12 + assert audio_latent_t(39) == 65 + assert shape.total_frames == 158 + assert shape.net_new_frames == 119 + assert shape.video_latent_t == 47 + assert shape.audio_latent_t == 263 + assert audio_grid_offset(124, 207) == pytest.approx(1.0 / 3.0) + assert audio_grid_offset(158, 263) == pytest.approx(-1.0 / 3.0) + + +def test_masked_av_22f_temporal_contract_preserves_balanced_asymmetry(): + shape = make_extension_shape(22, 5.0) + + assert context_slots(22) == 7 + assert audio_latent_t(22) == 37 + assert shape.total_frames == 141 + assert shape.net_new_frames == 119 + assert shape.video_latent_t == 42 + assert shape.audio_latent_t == 235 + video_seconds = 22 / 24 + audio_seconds = 37 / 40 + assert audio_seconds - video_seconds == pytest.approx(1.0 / 120.0) + + +def test_build_masked_video_prefix_latent_preserves_normalized_prefix(monkeypatch): + _install_nested_tensor(monkeypatch) + target = _latent(96, 64, 141) + target_video, target_audio = target["samples"].unbind() + context = torch.arange( + 1 * 24 * 7 * 4 * 6, + dtype=torch.float64, + ).reshape(1, 24, 7, 4, 6) + source_before = context.clone() + target_video_before = target_video.clone() + target_audio_before = target_audio.clone() + + result = build_masked_video_prefix_latent(target, context, 22) + video, audio = result["samples"].unbind() + video_mask, audio_mask = result["noise_mask"].unbind() + normalized = context.to(dtype=video.dtype) + + assert torch.equal(video[:, :, :7], normalized) + assert _sha256(video[:, :, :7]) == _sha256(normalized) + assert torch.count_nonzero(video[:, :, 7:]) == 0 + assert torch.equal(audio, target_audio_before) + assert tuple(video_mask.shape) == (1, 1, 42, 4, 6) + assert torch.count_nonzero(video_mask[:, :, :7]) == 0 + assert torch.all(video_mask[:, :, 7:] == 1) + assert tuple(audio_mask.shape) == (1, 1, 2, 235) + assert torch.all(audio_mask == 1) + assert torch.equal(context, source_before) + assert torch.equal(target_video, target_video_before) + assert torch.equal(target_audio, target_audio_before) + assert "noise_mask" not in target + + +def test_build_masked_av_prefix_latent_preserves_exact_39f_65t_prefixes( + monkeypatch, +): + _install_nested_tensor(monkeypatch) + target = _latent(96, 64, 158) + target_video, target_audio = target["samples"].unbind() + video_context = torch.arange( + 1 * 24 * 12 * 4 * 6, + dtype=torch.float64, + ).reshape(1, 24, 12, 4, 6) + audio_context = torch.arange( + 1 * 32 * 2 * 65, + dtype=torch.float64, + ).reshape(1, 32, 2, 65) + source_video = video_context.clone() + source_audio = audio_context.clone() + target_video_before = target_video.clone() + target_audio_before = target_audio.clone() + + result = build_masked_av_prefix_latent( + target, + video_context, + audio_context, + 39, + ) + video, audio = result["samples"].unbind() + video_mask, audio_mask = result["noise_mask"].unbind() + normalized_video = video_context.to(video) + normalized_audio = audio_context.to(audio) + + assert tuple(video.shape) == (1, 24, 47, 4, 6) + assert tuple(audio.shape) == (1, 32, 2, 263) + assert torch.equal(video[:, :, :12], normalized_video) + assert torch.equal(audio[..., :65], normalized_audio) + assert _sha256(video[:, :, :12]) == _sha256(normalized_video) + assert _sha256(audio[..., :65]) == _sha256(normalized_audio) + assert torch.count_nonzero(video[:, :, 12:]) == 0 + assert torch.count_nonzero(audio[..., 65:]) == 0 + assert tuple(video_mask.shape) == (1, 1, 47, 4, 6) + assert tuple(audio_mask.shape) == (1, 1, 2, 263) + assert torch.count_nonzero(video_mask[:, :, :12]) == 0 + assert torch.all(video_mask[:, :, 12:] == 1) + assert torch.count_nonzero(audio_mask[..., :65]) == 0 + assert torch.all(audio_mask[..., 65:] == 1) + assert torch.equal(video_context, source_video) + assert torch.equal(audio_context, source_audio) + assert torch.equal(target_video, target_video_before) + assert torch.equal(target_audio, target_audio_before) + assert "noise_mask" not in target + + +def test_build_masked_av_prefix_latent_preserves_balanced_22f_37t_prefixes( + monkeypatch, +): + _install_nested_tensor(monkeypatch) + target = _latent(96, 64, 141) + video_context = torch.arange( + 1 * 24 * 7 * 4 * 6, + dtype=torch.float64, + ).reshape(1, 24, 7, 4, 6) + audio_context = torch.arange( + 1 * 32 * 2 * 37, + dtype=torch.float64, + ).reshape(1, 32, 2, 37) + + result = build_masked_av_prefix_latent( + target, + video_context, + audio_context, + 22, + ) + video, audio = result["samples"].unbind() + video_mask, audio_mask = result["noise_mask"].unbind() + + assert tuple(video.shape) == (1, 24, 42, 4, 6) + assert tuple(audio.shape) == (1, 32, 2, 235) + assert torch.equal(video[:, :, :7], video_context.to(video)) + assert torch.equal(audio[..., :37], audio_context.to(audio)) + assert torch.count_nonzero(video_mask[:, :, :7]) == 0 + assert torch.all(video_mask[:, :, 7:] == 1) + assert torch.count_nonzero(audio_mask[..., :37]) == 0 + assert torch.all(audio_mask[..., 37:] == 1) + + +def test_restore_masked_av_prefix_does_not_restore_generated_regions(monkeypatch): + _install_nested_tensor(monkeypatch) + target = _latent(96, 64, 158) + video_context = torch.arange( + 1 * 24 * 12 * 4 * 6, + dtype=torch.float32, + ).reshape(1, 24, 12, 4, 6) + audio_context = torch.arange( + 1 * 32 * 2 * 65, + dtype=torch.float32, + ).reshape(1, 32, 2, 65) + masked = build_masked_av_prefix_latent( + target, + video_context, + audio_context, + 39, + ) + masked_video, masked_audio = masked["samples"].unbind() + sampled_video = masked_video.clone() + sampled_audio = masked_audio.clone() + sampled_video[:, :, :12] = torch.nextafter( + sampled_video[:, :, :12], + torch.full_like(sampled_video[:, :, :12], float("inf")), + ) + sampled_audio[..., :65] = torch.nextafter( + sampled_audio[..., :65], + torch.full_like(sampled_audio[..., :65], float("inf")), + ) + sampled_video[:, :, 12:] = 7.0 + sampled_audio[..., 65:] = 11.0 + sampled = {"samples": Nested((sampled_video, sampled_audio))} + + restored = restore_masked_av_prefix(sampled, masked, 39) + restored_video, restored_audio = restored["samples"].unbind() + + assert torch.equal(restored_video[:, :, :12], masked_video[:, :, :12]) + assert torch.equal(restored_audio[..., :65], masked_audio[..., :65]) + assert torch.all(restored_video[:, :, 12:] == 7.0) + assert torch.all(restored_audio[..., 65:] == 11.0) + assert torch.all(sampled_video[:, :, 12:] == 7.0) + assert torch.all(sampled_audio[..., 65:] == 11.0) + + +@pytest.mark.parametrize( + "context", + ( + torch.zeros(1, 24, 6, 4, 6), + torch.zeros(1, 24, 7, 5, 6), + torch.zeros(1, 23, 7, 4, 6), + ), +) +def test_build_masked_video_prefix_latent_rejects_invalid_context( + monkeypatch, context +): + _install_nested_tensor(monkeypatch) + with pytest.raises(ValueError): + build_masked_video_prefix_latent(_latent(96, 64, 141), context, 22) + + +@pytest.mark.parametrize( + "audio_context", + ( + torch.zeros(1, 32, 2, 64), + torch.zeros(1, 31, 2, 65), + torch.full((1, 32, 2, 65), float("nan")), + ), +) +def test_build_masked_av_prefix_latent_rejects_invalid_audio_context( + monkeypatch, audio_context +): + _install_nested_tensor(monkeypatch) + video_context = torch.zeros(1, 24, 12, 4, 6) + with pytest.raises(ValueError): + build_masked_av_prefix_latent( + _latent(96, 64, 158), + video_context, + audio_context, + 39, + ) + + +@pytest.mark.parametrize( + ( + "transport", + "continuity", + "context_frames", + "video_slots", + "audio_steps", + "total_frames", + ), + ( + ( + MASKED_VIDEO_PREFIX_V1, + V2_CONTINUITY_OPTIONS[1], + 22, + 7, + 0, + 141, + ), + ( + MASKED_AV_PREFIX_22_V1, + V2_CONTINUITY_OPTIONS[1], + 22, + 7, + 37, + 141, + ), + ( + MASKED_AV_PREFIX_39_V1, + CONTINUITY_OPTIONS[2], + 39, + 12, + 65, + 158, + ), + ), +) +def test_sequence_masked_transport_uses_target_mask_without_reference_interop( + monkeypatch, + transport, + continuity, + context_frames, + video_slots, + audio_steps, + total_frames, +): + _install_nested_tensor(monkeypatch) + width, height = 96, 64 + events = [] + sample_inputs = [] + fake_model = SimpleNamespace( + model=SimpleNamespace(diffusion_model=SimpleNamespace()), + model_options={}, + wrappers={}, + model_dtype=lambda: torch.bfloat16, + model_size=lambda: 0, + ) + first_latent = torch.full((1, 24, 1, height // 16, width // 16), 0.25) + assets = IdentityAssets( + torch.zeros(1, height, width, 3), + first_latent, + None, + None, + "i2va-first-image", + ) + + monkeypatch.setattr(sequence, "check_comfy_h3_runtime", lambda: []) + monkeypatch.setattr(sequence, "prepare_identity_assets", lambda *a, **k: assets) + monkeypatch.setattr(sequence, "encode_identity_latents", lambda *a, **k: assets) + monkeypatch.setattr(sequence, "empty_h3_latent", _latent) + monkeypatch.setattr(sequence, "accelerator_summary", lambda model: "accelerators") + + def clone_model_for_chunk(model, *, strict, debug, chunk_index, context_frames): + options = dict(model.model_options) + transformer_options = dict(options.get("transformer_options") or {}) + if context_frames is not None: + transformer_options[CONTINUUM_INTEROP_KEY] = {"active": True} + options["transformer_options"] = transformer_options + events.append(("clone", chunk_index, context_frames)) + return SimpleNamespace( + model=model.model, + model_options=options, + wrappers=model.wrappers, + model_dtype=model.model_dtype, + model_size=model.model_size, + ) + + call_index = 0 + + def sample_chunk(**kwargs): + nonlocal call_index + call_index += 1 + latent = kwargs["latent"] + video, audio = latent["samples"].unbind() + conditioning = kwargs["conditioning"] + metadata = conditioning[0][1] + sample_inputs.append((video.clone(), audio.clone(), latent.get("noise_mask"))) + events.append( + ( + "sample", + call_index, + metadata.get("minimax_refs"), + kwargs["model"].model_options["transformer_options"].get( + CONTINUUM_INTEROP_KEY + ), + metadata.get("minimax_frame_count"), + metadata.get("minimax_keyframes"), + ) + ) + if call_index == 1: + video = torch.arange(video.numel(), dtype=video.dtype).reshape_as(video) + audio = torch.arange(audio.numel(), dtype=audio.dtype).reshape_as(audio) + return {"samples": Nested((video, audio))} + before_prefix = video[:, :, :video_slots].clone() + before_audio_prefix = ( + audio[..., :audio_steps].clone() if audio_steps else None + ) + sampled_video = video.clone() + sampled_audio = audio.clone() + # Core restores at each model call, but sampler integration may leave a + # final float32 rounding delta. The private sequence path reapplies only + # the preserved prefix after sampling. + sampled_video[:, :, :video_slots] = torch.nextafter( + sampled_video[:, :, :video_slots], + torch.full_like( + sampled_video[:, :, :video_slots], + float("inf"), + ), + ) + sampled_video[:, :, video_slots:] += 1 + assert not torch.equal( + before_prefix, + sampled_video[:, :, :video_slots], + ) + if audio_steps: + sampled_audio[..., :audio_steps] = torch.nextafter( + sampled_audio[..., :audio_steps], + torch.full_like( + sampled_audio[..., :audio_steps], + float("inf"), + ), + ) + sampled_audio[..., audio_steps:] += 2 + assert not torch.equal( + before_audio_prefix, + sampled_audio[..., :audio_steps], + ) + return {"samples": Nested((sampled_video, sampled_audio))} + + monkeypatch.setattr(sequence, "clone_model_for_chunk", clone_model_for_chunk) + monkeypatch.setattr(sequence, "sample_chunk", sample_chunk) + + plan = make_prompt_plan( + mode=PROMPT_MODE_FIXED, + script="continuous shot", + chunks=2, + chunk_seconds=5.0, + ) + entries, last_state, session, report = sequence.run_sequence( + model=fake_model, + clip=FakeClip(), + video_vae=object(), + audio_vae=object(), + sampler=object(), + sigmas=torch.tensor([1.0, 0.0]), + first_frame=None, + last_frame=None, + prompt_plan=plan, + width=width, + height=height, + continuity=continuity, + base_seed=42, + audio_continuity=False, + exact_total_duration=False, + diagnostics_mode=DIAGNOSTICS_BASIC, + reroll_from_chunk=0, + reroll_nonce=0, + strict_compatibility=False, + debug=False, + latent_only=True, + continuation_transport=transport, + ) + + first_video = entries[0]["video"] + second_video, second_audio, masks = sample_inputs[1] + video_mask, audio_mask = masks.unbind() + expected_prefix = first_video[:, :, -video_slots:].to(second_video) + assert torch.equal(second_video[:, :, :video_slots], expected_prefix) + assert _sha256(second_video[:, :, :video_slots]) == _sha256(expected_prefix) + assert tuple(second_video.shape) == ( + 1, + 24, + video_latent_t(total_frames), + 4, + 6, + ) + assert tuple(second_audio.shape) == ( + 1, + 32, + 2, + audio_latent_t(total_frames), + ) + assert torch.count_nonzero(video_mask[:, :, :video_slots]) == 0 + assert torch.all(video_mask[:, :, video_slots:] == 1) + if audio_steps: + first_audio = entries[0]["audio"] + expected_audio_prefix = first_audio[..., -audio_steps:].to(second_audio) + assert torch.equal( + second_audio[..., :audio_steps], + expected_audio_prefix, + ) + assert torch.count_nonzero(audio_mask[..., :audio_steps]) == 0 + assert torch.all(audio_mask[..., audio_steps:] == 1) + else: + assert torch.all(audio_mask == 1) + second_sample = next( + event for event in events if event[0] == "sample" and event[1] == 2 + ) + assert second_sample[2] is None + assert second_sample[3] is None + assert second_sample[4] == total_frames + first_sample = next( + event for event in events if event[0] == "sample" and event[1] == 1 + ) + assert len(first_sample[5]) == 1 + assert first_sample[5][0]["resolved_frame_index"] == 0 + assert first_sample[5][0]["latent"] is first_latent + assert second_sample[5] is None + assert [event[2] for event in events if event[0] == "clone"] == [None, None] + assert entries[1]["plan"]["total_frames"] == total_frames + assert entries[1]["plan"]["trim_frames"] == context_frames + assert entries[1]["plan"]["net_frames"] == 119 + assert torch.equal( + entries[1]["video"][:, :, :video_slots], + expected_prefix, + ) + if audio_steps: + assert torch.equal( + entries[1]["audio"][..., :audio_steps], + expected_audio_prefix, + ) + assert torch.all(entries[1]["audio"][..., audio_steps:] == 2) + assert f"masked AV target prefix {context_frames}f/{audio_steps}T" in report + assert "source_audio_grid_offset=0.333333" in report + else: + assert "masked video target prefix" in report + assert last_state["clip_index"] == 2 + assert len(session["chunks"]) == 2 + assert "interop=not_emitted" in report + + +@pytest.mark.parametrize( + ("transport", "audio_steps"), + ( + (MASKED_VIDEO_PREFIX_V1, 0), + (MASKED_AV_PREFIX_22_V1, 37), + ), +) +def test_fl2va_terminal_merge_uses_masked_prefix_without_reference_rows( + monkeypatch, + transport, + audio_steps, +): + _install_nested_tensor(monkeypatch) + width, height = 96, 64 + first_latent = torch.full((1, 24, 1, 4, 6), 0.25) + last_latent = torch.full((1, 24, 1, 4, 6), 0.75) + assets = IdentityAssets( + torch.zeros(1, height, width, 3), + first_latent, + torch.ones(1, height, width, 3), + last_latent, + "fl2va-identity", + ) + model = SimpleNamespace( + model=SimpleNamespace(diffusion_model=SimpleNamespace()), + model_options={}, + wrappers={}, + model_dtype=lambda: torch.bfloat16, + model_size=lambda: 0, + ) + samples = [] + clones = [] + finalized_physical = [] + + monkeypatch.setattr(sequence, "check_comfy_h3_runtime", lambda: []) + monkeypatch.setattr(sequence, "prepare_identity_assets", lambda *a, **k: assets) + monkeypatch.setattr(sequence, "encode_identity_latents", lambda *a, **k: assets) + monkeypatch.setattr(sequence, "empty_h3_latent", _latent) + monkeypatch.setattr(sequence, "accelerator_summary", lambda _model: "accelerators") + monkeypatch.setattr( + sequence, + "latent_from_cpu", + lambda video, audio: {"samples": Nested((video, audio))}, + ) + + def latent_to_cpu(latent): + video, audio = latent["samples"].unbind() + finalized_physical.append((video.clone(), audio.clone())) + return video, audio + + monkeypatch.setattr(sequence, "latent_to_cpu", latent_to_cpu) + + def clone_model_for_chunk(model, *, context_frames, **_kwargs): + clones.append(context_frames) + return model + + monkeypatch.setattr(sequence, "clone_model_for_chunk", clone_model_for_chunk) + + def sample_chunk(**kwargs): + latent = kwargs["latent"] + video, audio = latent["samples"].unbind() + masks = latent.get("noise_mask") + metadata = kwargs["conditioning"][0][1] + samples.append( + { + "video": video.clone(), + "audio": audio.clone(), + "masks": masks, + "metadata": metadata, + "seed": kwargs["seed"], + } + ) + if len(samples) == 1: + return { + "samples": Nested( + ( + torch.arange(video.numel(), dtype=video.dtype).reshape_as(video), + torch.arange(audio.numel(), dtype=audio.dtype).reshape_as(audio), + ) + ) + } + sampled_video = video.clone() + sampled_audio = audio.clone() + sampled_video[:, :, :7] = torch.nextafter( + sampled_video[:, :, :7], + torch.full_like(sampled_video[:, :, :7], float("inf")), + ) + sampled_video[:, :, 7:] = 7.0 + if audio_steps: + sampled_audio[..., :audio_steps] = torch.nextafter( + sampled_audio[..., :audio_steps], + torch.full_like(sampled_audio[..., :audio_steps], float("inf")), + ) + sampled_audio[..., audio_steps:] = 11.0 + else: + sampled_audio.fill_(11.0) + return {"samples": Nested((sampled_video, sampled_audio))} + + monkeypatch.setattr(sequence, "sample_chunk", sample_chunk) + + plan = make_prompt_plan( + mode=PROMPT_MODE_LIST, + script="first\n---\nmiddle\n---\nlast", + chunks=3, + chunk_seconds=5.0, + ) + entries, _last_state, _session, report = sequence.run_sequence( + model=model, + clip=FakeClip(), + video_vae=object(), + audio_vae=object(), + sampler=object(), + sigmas=torch.tensor([1.0, 0.0]), + first_frame=assets.first_image, + last_frame=assets.last_image, + prompt_plan=plan, + width=width, + height=height, + continuity=V2_CONTINUITY_OPTIONS[1], + base_seed=42, + audio_continuity=bool(audio_steps), + exact_total_duration=False, + diagnostics_mode=DIAGNOSTICS_BASIC, + reroll_from_chunk=0, + reroll_nonce=0, + strict_compatibility=False, + debug=False, + latent_only=True, + continuation_transport=transport, + ) + + assert len(samples) == 2 + assert len(entries) == 3 + assert clones == [None, None] + first_sample, terminal_sample = samples + assert first_sample["masks"] is None + assert first_sample["metadata"]["minimax_keyframes"] == [ + {"resolved_frame_index": 0, "latent": first_latent} + ] + assert tuple(terminal_sample["video"].shape) == (1, 24, 77, 4, 6) + assert tuple(terminal_sample["audio"].shape) == (1, 32, 2, 433) + assert terminal_sample["metadata"].get("minimax_refs") is None + terminal_keyframes = terminal_sample["metadata"]["minimax_keyframes"] + assert terminal_keyframes == [ + {"resolved_frame_index": 259, "latent": last_latent} + ] + video_mask, audio_mask = terminal_sample["masks"].unbind() + assert torch.count_nonzero(video_mask[:, :, :7]) == 0 + assert torch.all(video_mask[:, :, 7:] == 1) + expected_video_prefix = entries[0]["video"][:, :, -7:].to( + terminal_sample["video"] + ) + assert torch.equal(terminal_sample["video"][:, :, :7], expected_video_prefix) + if audio_steps: + assert torch.count_nonzero(audio_mask[..., :audio_steps]) == 0 + assert torch.all(audio_mask[..., audio_steps:] == 1) + expected_audio_prefix = entries[0]["audio"][..., -audio_steps:].to( + terminal_sample["audio"] + ) + assert torch.equal( + terminal_sample["audio"][..., :audio_steps], + expected_audio_prefix, + ) + else: + assert torch.all(audio_mask == 1) + + final_video, final_audio = finalized_physical[0] + assert torch.equal(final_video[:, :, :7], expected_video_prefix) + assert torch.all(final_video[:, :, 7:] == 7.0) + if audio_steps: + assert torch.equal(final_audio[..., :audio_steps], expected_audio_prefix) + assert torch.all(final_audio[..., audio_steps:] == 11.0) + else: + assert torch.all(final_audio == 11.0) + + expected_seed = derive_chunk_seed(42, 1, 0) + assert terminal_sample["seed"] == expected_seed + assert entries[1]["seed"] == expected_seed + assert entries[2]["seed"] == expected_seed + decode_entries, assembly_plan = prepare_physical_decode_entries( + entries, + chunk_seconds=5.0, + preserve_final_frame=True, + terminal_merged=True, + ) + assert len(decode_entries) == 2 + assert assembly_plan["logical_chunk_count"] == 3 + assert assembly_plan["physical_decode_group_count"] == 2 + terminal_group = assembly_plan["decode_groups"][1] + assert terminal_group["logical_chunk_indices"] == [2, 3] + assert terminal_group["terminal_merged"] is True + assert terminal_group["total_frames"] == 260 + assert terminal_group["trim_frames"] == 22 + assert terminal_group["expected_video_latent_t"] == 77 + assert terminal_group["expected_audio_latent_t"] == 433 + recombined_video = decode_entries[1]["video"] + recombined_audio = decode_entries[1]["audio"] + assert torch.equal(recombined_video, final_video) + assert torch.equal(recombined_audio, final_audio) + assert "paired_timeline_v1" in report + assert "physical_frames=260" in report diff --git a/tests/test_v36_public_sampler.py b/tests/test_v36_public_sampler.py new file mode 100644 index 0000000..de0c58b --- /dev/null +++ b/tests/test_v36_public_sampler.py @@ -0,0 +1,117 @@ +from __future__ import annotations + +import json +from pathlib import Path + +from ComfyUI_H3_Continuum_Join import nodes as root_nodes +from ComfyUI_H3_Continuum_Join.v2.sequence import ( + MASKED_AV_PREFIX_22_V1, + MASKED_VIDEO_PREFIX_V1, + REFERENCE_CONTEXT_V1, +) +from ComfyUI_H3_Continuum_Join.v3.driving_nodes import ( + CONTINUATION_BACKEND_COMPATIBILITY, + CONTINUATION_BACKEND_OPTIONS, + CONTINUATION_BACKEND_STANDARD, + H3ContinuumSamplerV35, + H3ContinuumSamplerV36, + NODE_CLASS_MAPPINGS, + NODE_DISPLAY_NAME_MAPPINGS, +) +from ComfyUI_H3_Continuum_Join.v3.nodes import H3ContinuumSamplerProduction + + +ROOT = Path(__file__).resolve().parents[1] + + +def test_v36_is_registered_without_replacing_v35(): + assert NODE_CLASS_MAPPINGS["H3ContinuumSamplerV36"] is H3ContinuumSamplerV36 + assert NODE_DISPLAY_NAME_MAPPINGS["H3ContinuumSamplerV36"] == ( + "H3 Continuum Sampler V3.6" + ) + assert root_nodes.NODE_CLASS_MAPPINGS["H3ContinuumSamplerV36"] is ( + H3ContinuumSamplerV36 + ) + assert root_nodes.NODE_CLASS_MAPPINGS["H3ContinuumSamplerV35"] is ( + H3ContinuumSamplerV35 + ) + assert H3ContinuumSamplerV36.RETURN_TYPES == H3ContinuumSamplerV35.RETURN_TYPES + assert H3ContinuumSamplerV36.RETURN_NAMES == H3ContinuumSamplerV35.RETURN_NAMES + + +def test_v36_schema_exposes_only_friendly_backend_names_at_the_end(): + required = H3ContinuumSamplerV36.INPUT_TYPES()["required"] + assert tuple(required)[-1] == "continuation_backend" + choices, metadata = required["continuation_backend"] + assert choices == CONTINUATION_BACKEND_OPTIONS + assert choices == ( + CONTINUATION_BACKEND_STANDARD, + CONTINUATION_BACKEND_COMPATIBILITY, + ) + assert metadata["default"] == CONTINUATION_BACKEND_STANDARD + rendered = repr(required["continuation_backend"]) + assert "masked_av_prefix" not in rendered + assert "reference_context_v1" not in rendered + assert "continuation_transport" not in required + assert "continuation_backend" not in H3ContinuumSamplerV35.INPUT_TYPES()["required"] + + +def test_v36_maps_public_backend_and_audio_policy_to_internal_transport(monkeypatch): + captured = [] + + def fake_production_run(_self, **kwargs): + captured.append(kwargs.get("continuation_transport", REFERENCE_CONTEXT_V1)) + return "video", "audio", {"plan": True}, "status", "context" + + monkeypatch.setattr(H3ContinuumSamplerProduction, "run", fake_production_run) + common = {"chunks": 1, "chunk_seconds": 5.0, "width": 96, "height": 64} + + H3ContinuumSamplerV35().run(**common, audio_continuity=True) + H3ContinuumSamplerV36().run( + **common, + audio_continuity=True, + continuation_backend=CONTINUATION_BACKEND_STANDARD, + ) + H3ContinuumSamplerV36().run( + **common, + audio_continuity=False, + continuation_backend=CONTINUATION_BACKEND_STANDARD, + ) + H3ContinuumSamplerV36().run( + **common, + audio_continuity=True, + continuation_backend=CONTINUATION_BACKEND_COMPATIBILITY, + ) + + assert captured == [ + REFERENCE_CONTEXT_V1, + MASKED_AV_PREFIX_22_V1, + MASKED_VIDEO_PREFIX_V1, + REFERENCE_CONTEXT_V1, + ] + + +def test_v36_template_uses_standard_backend_and_v35_template_is_unchanged(): + v36 = json.loads( + (ROOT / "examples/workflows/MiniMax_H3_Continuum_V36.json").read_text( + encoding="utf-8" + ) + ) + v35 = json.loads( + (ROOT / "examples/workflows/MiniMax_H3_Continuum_V35.json").read_text( + encoding="utf-8" + ) + ) + v36_sampler = next(node for node in v36["nodes"] if node["id"] == 305) + v35_sampler = next(node for node in v35["nodes"] if node["id"] == 305) + + assert v36_sampler["type"] == "H3ContinuumSamplerV36" + assert v36_sampler["properties"]["Node name for S&R"] == ( + "H3ContinuumSamplerV36" + ) + assert v36_sampler["widgets_values"][-1] == CONTINUATION_BACKEND_STANDARD + assert v36_sampler["widgets_values_named"]["continuation_backend"] == ( + CONTINUATION_BACKEND_STANDARD + ) + assert v35_sampler["type"] == "H3ContinuumSamplerV35" + assert "continuation_backend" not in v35_sampler["widgets_values_named"] diff --git a/tools/gpu_diagnostic_node/nodes.py b/tools/gpu_diagnostic_node/nodes.py index 6b749a4..bdb7051 100644 --- a/tools/gpu_diagnostic_node/nodes.py +++ b/tools/gpu_diagnostic_node/nodes.py @@ -3,13 +3,16 @@ from __future__ import annotations from contextlib import contextmanager +import copy from datetime import datetime import gc +import hashlib import importlib import json from pathlib import Path, PurePosixPath import random import sys +import time import traceback from types import SimpleNamespace from typing import Any @@ -65,6 +68,7 @@ def _resolve_continuum_modules() -> SimpleNamespace: sampling=load("v2/sampling.py", "v2.sampling"), prompts=load("v2/prompts.py", "v2.prompts"), decoder=load("v2/decoder.py", "v2.decoder"), + temporal=load("temporal.py", "temporal"), ) @@ -82,6 +86,52 @@ def _release_cuda() -> None: torch.cuda.empty_cache() +def _diagnostic_tensor_summary(tensor: torch.Tensor) -> dict[str, Any]: + value = tensor.detach().to("cpu").contiguous() + digest = hashlib.sha256() + digest.update(str(tuple(int(part) for part in value.shape)).encode("ascii")) + digest.update(str(value.dtype).encode("ascii")) + digest.update(value.view(torch.uint8).numpy().tobytes(order="C")) + return { + "shape": [int(part) for part in value.shape], + "dtype": str(value.dtype), + "sha256": digest.hexdigest(), + "finite": bool(torch.isfinite(value.float()).all().item()), + } + + +def _packed_layout_summary(layout: Any) -> dict[str, Any]: + segments = [] + rows_by_kind: dict[str, int] = {} + for start, stop, kind in getattr(layout, "segments", ()): + row_count = int(stop) - int(start) + label = str(kind) + segments.append( + { + "start": int(start), + "stop": int(stop), + "kind": label, + "rows": row_count, + } + ) + rows_by_kind[label] = rows_by_kind.get(label, 0) + row_count + return { + "seq_len": int(getattr(layout, "seq_len", 0)), + "signature": [int(value) for value in getattr(layout, "signature", ())], + "rows_by_kind": rows_by_kind, + "segments": segments, + } + + +def _diagnostic_public_v35_class(): + import nodes as comfy_nodes + + node_class = comfy_nodes.NODE_CLASS_MAPPINGS.get("H3ContinuumSamplerV35") + if node_class is None: + raise RuntimeError("H3ContinuumSamplerV35 is not loaded") + return node_class + + def _safe_output_directory(subdir: str) -> Path: import folder_paths @@ -706,10 +756,414 @@ class H3CoreContinuumGpuDiagnostic: return (summary,) +class H3ContinuumMaskedPrefixR1Diagnostic: + """Test-only V3.6-R1 wrapper; the Production V3.5 schema stays unchanged.""" + + CATEGORY = "H3-Continuum/Diagnostics" + FUNCTION = "run" + RETURN_TYPES = ( + "LATENT", + "LATENT", + "H3_CONTINUUM_ASSEMBLY_PLAN", + "STRING", + "AUDIO", + "H3_CONTINUUM_REFINE_CONTEXT", + ) + RETURN_NAMES = ( + "video_latents", + "audio_latents", + "assembly_plan", + "status", + "driving_audio", + "refine_context", + ) + OUTPUT_IS_LIST = (True, True, False, False, False, False) + + @classmethod + def INPUT_TYPES(cls): + schema = copy.deepcopy(_diagnostic_public_v35_class().INPUT_TYPES()) + required = dict(schema.get("required", {})) + required["continuation_transport"] = ( + ( + "reference_context_v1", + "masked_video_prefix_v1", + "masked_av_prefix_22_v1", + "masked_av_prefix_39_v1", + ), + { + "default": "masked_video_prefix_v1", + "tooltip": "Diagnostic-only V3.6-R1 A/B selector.", + }, + ) + required["synchronize_sampling"] = ( + "BOOLEAN", + { + "default": False, + "tooltip": ( + "Diagnostic-only CUDA synchronization around each physical " + "Sampling call. Keep Off for normal wall-time A/B runs." + ), + }, + ) + required["diagnostic_nonce"] = ( + "INT", + { + "default": 0, + "min": 0, + "max": 0x7FFFFFFF, + "tooltip": "Diagnostic-only cache invalidation nonce; generation semantics are unchanged.", + }, + ) + schema["required"] = required + return schema + + def run( + self, + continuation_transport, + synchronize_sampling=False, + diagnostic_nonce=0, + **kwargs, + ): + transport = str(continuation_transport) + if transport not in ( + "reference_context_v1", + "masked_video_prefix_v1", + "masked_av_prefix_22_v1", + "masked_av_prefix_39_v1", + ): + raise ValueError(f"unknown diagnostic transport: {transport!r}") + + modules = _resolve_continuum_modules() + production_class = _diagnostic_public_v35_class() + original_sample = modules.sequence.sample_chunk + continuity = str(kwargs.get("continuity", "")) + context_frames = int( + modules.constants.CONTINUITY_FRAMES.get(continuity, 22) + ) + if transport == "masked_video_prefix_v1": + context_frames = 22 + elif transport == "masked_av_prefix_22_v1": + context_frames = 22 + elif transport == "masked_av_prefix_39_v1": + context_frames = 39 + video_prefix_slots = int(modules.temporal.context_slots(context_frames)) + audio_prefix_steps = ( + int(modules.temporal.audio_latent_t(context_frames)) + if transport in ("masked_av_prefix_22_v1", "masked_av_prefix_39_v1") + else 0 + ) + requested_audio_continuity = bool(kwargs.get("audio_continuity", False)) + effective_audio_continuity = requested_audio_continuity + if transport == "masked_video_prefix_v1": + effective_audio_continuity = False + elif transport in ("masked_av_prefix_22_v1", "masked_av_prefix_39_v1"): + effective_audio_continuity = True + diagnostic: dict[str, Any] = { + "transport": transport, + "context_frames": context_frames, + "video_prefix_slots": video_prefix_slots, + "audio_prefix_steps": audio_prefix_steps, + "requested_audio_continuity": requested_audio_continuity, + "audio_continuity_forced": effective_audio_continuity, + "synchronize_sampling": bool(synchronize_sampling), + "diagnostic_nonce": int(diagnostic_nonce), + "sample_calls": [], + } + sample_number = 0 + previous_output_tail = None + previous_output_audio_tail = None + previous_output_source_frames = None + previous_output_audio_t = None + + def sampled_with_evidence(**sample_kwargs): + nonlocal sample_number, previous_output_tail, previous_output_audio_tail + nonlocal previous_output_source_frames, previous_output_audio_t + sample_number += 1 + input_video, input_audio = modules.state.extract_av_streams( + sample_kwargs["latent"] + ) + evidence: dict[str, Any] = { + "sample_number": sample_number, + "seed": int(sample_kwargs["seed"]), + "input_video": _diagnostic_tensor_summary(input_video), + "input_audio": _diagnostic_tensor_summary(input_audio), + } + conditioning = sample_kwargs.get("conditioning") or [] + metadata = conditioning[0][1] if conditioning else {} + evidence["minimax_frame_count"] = metadata.get("minimax_frame_count") + evidence["minimax_ref_kinds"] = [ + item.get("kind") for item in (metadata.get("minimax_refs") or []) + ] + evidence["minimax_keyframe_indices"] = [ + int(item.get("resolved_frame_index")) + for item in (metadata.get("minimax_keyframes") or []) + ] + transformer_options = getattr( + sample_kwargs.get("model"), "model_options", {} + ).get("transformer_options", {}) + evidence["continuum_interop_emitted"] = bool( + transformer_options.get(modules.constants.CONTINUUM_INTEROP_KEY) + ) + + before_prefix = None + before_audio_prefix = None + mask = sample_kwargs["latent"].get("noise_mask") + if sample_number >= 2: + before_prefix = input_video[:, :, :video_prefix_slots].detach().clone() + evidence["target_prefix_before"] = _diagnostic_tensor_summary( + before_prefix + ) + if previous_output_tail is not None: + evidence["source_tail_matches_target_prefix"] = bool( + torch.equal(previous_output_tail.to(before_prefix), before_prefix) + ) + evidence["source_tail"] = _diagnostic_tensor_summary( + previous_output_tail + ) + if previous_output_source_frames is not None and previous_output_audio_t is not None: + evidence["source_audio_grid_offset"] = float( + modules.temporal.audio_grid_offset( + previous_output_source_frames, + previous_output_audio_t, + ) + ) + if audio_prefix_steps: + before_audio_prefix = input_audio[..., :audio_prefix_steps].detach().clone() + evidence["target_audio_prefix_before"] = _diagnostic_tensor_summary( + before_audio_prefix + ) + if previous_output_audio_tail is not None: + evidence["source_audio_tail_matches_target_prefix"] = bool( + torch.equal( + previous_output_audio_tail.to(before_audio_prefix), + before_audio_prefix, + ) + ) + evidence["source_audio_tail"] = _diagnostic_tensor_summary( + previous_output_audio_tail + ) + if mask is not None: + mask_parts = list(mask.unbind()) + video_mask, audio_mask = mask_parts[0], mask_parts[1] + evidence["video_mask"] = _diagnostic_tensor_summary(video_mask) + evidence["audio_mask"] = _diagnostic_tensor_summary(audio_mask) + evidence["video_mask_prefix_zero"] = bool( + torch.count_nonzero( + video_mask[:, :, :video_prefix_slots] + ).item() == 0 + ) + evidence["video_mask_generated_one"] = bool( + torch.all( + video_mask[:, :, video_prefix_slots:] == 1 + ).item() + ) + evidence["audio_mask_all_one"] = bool( + torch.all(audio_mask == 1).item() + ) + if audio_prefix_steps: + evidence["audio_mask_prefix_zero"] = bool( + torch.count_nonzero( + audio_mask[..., :audio_prefix_steps] + ).item() == 0 + ) + evidence["audio_mask_generated_one"] = bool( + torch.all( + audio_mask[..., audio_prefix_steps:] == 1 + ).item() + ) + else: + evidence["video_mask"] = None + evidence["audio_mask"] = None + + import comfy.ldm.minimax.model as minimax_model + + captured_layouts: list[dict[str, Any]] = [] + original_layout_init = minimax_model.PackedLayout.__init__ + + def capture_layout(layout_self, *layout_args, **layout_kwargs): + original_layout_init(layout_self, *layout_args, **layout_kwargs) + captured_layouts.append(_packed_layout_summary(layout_self)) + + use_cuda = bool(torch.cuda.is_available()) + if use_cuda: + torch.cuda.reset_peak_memory_stats() + if bool(synchronize_sampling): + torch.cuda.synchronize() + sample_started = time.perf_counter() + minimax_model.PackedLayout.__init__ = capture_layout + try: + result = original_sample(**sample_kwargs) + if use_cuda and bool(synchronize_sampling): + torch.cuda.synchronize() + finally: + minimax_model.PackedLayout.__init__ = original_layout_init + evidence["sample_host_elapsed_seconds"] = float( + time.perf_counter() - sample_started + ) + evidence["packed_layouts"] = captured_layouts + if use_cuda: + evidence["cuda_allocator_peak_allocated_bytes"] = int( + torch.cuda.max_memory_allocated() + ) + evidence["cuda_allocator_peak_reserved_bytes"] = int( + torch.cuda.max_memory_reserved() + ) + output_video, output_audio = modules.state.extract_av_streams(result) + evidence["output_video"] = _diagnostic_tensor_summary(output_video) + evidence["output_audio"] = _diagnostic_tensor_summary(output_audio) + if before_prefix is not None: + after_prefix = output_video[:, :, :video_prefix_slots] + difference = ( + after_prefix.detach().float() - before_prefix.detach().float() + ).abs() + evidence["target_prefix_after"] = _diagnostic_tensor_summary( + after_prefix + ) + evidence["prefix_bit_exact"] = bool( + torch.equal(before_prefix, after_prefix) + ) + evidence["prefix_max_abs_diff"] = float( + difference.max().item() if difference.numel() else 0.0 + ) + if before_audio_prefix is not None: + after_audio_prefix = output_audio[..., :audio_prefix_steps] + audio_difference = ( + after_audio_prefix.detach().float() + - before_audio_prefix.detach().float() + ).abs() + evidence["target_audio_prefix_after"] = _diagnostic_tensor_summary( + after_audio_prefix + ) + evidence["audio_prefix_bit_exact"] = bool( + torch.equal(before_audio_prefix, after_audio_prefix) + ) + evidence["audio_prefix_max_abs_diff"] = float( + audio_difference.max().item() + if audio_difference.numel() + else 0.0 + ) + previous_output_tail = output_video[ + :, :, -video_prefix_slots: + ].detach().clone() + previous_output_audio_tail = ( + output_audio[..., -audio_prefix_steps:].detach().clone() + if audio_prefix_steps + else None + ) + previous_output_source_frames = int( + modules.temporal.pixel_frames_for_latent_t(output_video.shape[2]) + ) + previous_output_audio_t = int(output_audio.shape[-1]) + diagnostic["sample_calls"].append(evidence) + return result + + kwargs["audio_continuity"] = effective_audio_continuity + + modules.sequence.sample_chunk = sampled_with_evidence + try: + outputs = production_class().run( + continuation_transport=transport, + **kwargs, + ) + finally: + modules.sequence.sample_chunk = original_sample + + video_latents = outputs[0] + audio_latents = outputs[1] + diagnostic["physical_video_groups"] = [ + _diagnostic_tensor_summary(item["samples"]) for item in video_latents + ] + diagnostic["physical_audio_groups"] = [ + _diagnostic_tensor_summary(item["samples"]) for item in audio_latents + ] + diagnostic["physical_group_count"] = len(video_latents) + diagnostic["final_prefix_pairs"] = [] + for index in range(1, len(video_latents)): + source_tail = video_latents[index - 1]["samples"][ + :, :, -video_prefix_slots: + ] + final_prefix = video_latents[index]["samples"][ + :, :, :video_prefix_slots + ] + final_difference = ( + final_prefix.detach().float() - source_tail.detach().float() + ).abs() + pair = { + "source_group": index, + "target_group": index + 1, + "source_tail": _diagnostic_tensor_summary(source_tail), + "target_prefix": _diagnostic_tensor_summary(final_prefix), + "bit_exact": bool(torch.equal(source_tail, final_prefix)), + "max_abs_diff": float( + final_difference.max().item() + if final_difference.numel() + else 0.0 + ), + } + if audio_prefix_steps: + source_audio_tail = audio_latents[index - 1]["samples"][ + ..., -audio_prefix_steps: + ] + final_audio_prefix = audio_latents[index]["samples"][ + ..., :audio_prefix_steps + ] + final_audio_difference = ( + final_audio_prefix.detach().float() + - source_audio_tail.detach().float() + ).abs() + pair.update( + { + "source_audio_tail": _diagnostic_tensor_summary( + source_audio_tail + ), + "target_audio_prefix": _diagnostic_tensor_summary( + final_audio_prefix + ), + "audio_bit_exact": bool( + torch.equal(source_audio_tail, final_audio_prefix) + ), + "audio_max_abs_diff": float( + final_audio_difference.max().item() + if final_audio_difference.numel() + else 0.0 + ), + } + ) + diagnostic["final_prefix_pairs"].append(pair) + diagnostic["logical_chunk_count"] = len( + outputs[2].get("chunks", outputs[2].get("logical_chunks", [])) + ) + diagnostic["physical_decode_group_count"] = int( + outputs[2].get("physical_decode_group_count", len(video_latents)) + ) + diagnostic["decode_groups"] = [ + { + "logical_chunk_indices": [ + int(value) + for value in group.get("logical_chunk_indices", []) + ], + "terminal_merged": bool(group.get("terminal_merged", False)), + "total_frames": int(group.get("total_frames", 0)), + "trim_frames": int(group.get("trim_frames", 0)), + "expected_video_latent_t": int( + group.get("expected_video_latent_t", 0) + ), + "expected_audio_latent_t": int( + group.get("expected_audio_latent_t", 0) + ), + } + for group in outputs[2].get("decode_groups", []) + ] + report = json.dumps(diagnostic, ensure_ascii=False, sort_keys=True) + return (*outputs[:3], f"{outputs[3]}\nV3.6-R1 diagnostic: {report}", *outputs[4:]) + + NODE_CLASS_MAPPINGS = { "H3CoreContinuumGpuDiagnostic": H3CoreContinuumGpuDiagnostic, + "H3ContinuumMaskedPrefixR1Diagnostic": H3ContinuumMaskedPrefixR1Diagnostic, } NODE_DISPLAY_NAME_MAPPINGS = { "H3CoreContinuumGpuDiagnostic": "H3 Core vs Continuum GPU Diagnostic", + "H3ContinuumMaskedPrefixR1Diagnostic": "H3 Continuum V3.6-R1 Masked Prefix Diagnostic", } diff --git a/tools/verify_runtime.py b/tools/verify_runtime.py index 962a05b..0f5614d 100644 --- a/tools/verify_runtime.py +++ b/tools/verify_runtime.py @@ -68,6 +68,7 @@ def main() -> int: current_required = { "H3ContinuumSamplerV34", "H3ContinuumSamplerV35", + "H3ContinuumSamplerV36", "H3ContinuumAssembleSeamV34", "H3ContinuumAssembleSeamV35", "H3ContinuumHiResFixV35", diff --git a/v2/nodes.py b/v2/nodes.py index a719a00..6ac03fa 100644 --- a/v2/nodes.py +++ b/v2/nodes.py @@ -5,6 +5,11 @@ from __future__ import annotations import logging from ..constants import ( + CHUNK_SECONDS_DEFAULT, + CHUNK_SECONDS_MAX, + CHUNK_SECONDS_MIN, + CHUNK_SECONDS_STEP, + CHUNK_SECONDS_TOOLTIP, DIAGNOSTICS_ACCEPTED_OPTIONS, DIAGNOSTICS_OPTIONS, PROMPT_FORMAT_OPTIONS, @@ -142,7 +147,13 @@ class H3ContinuumSamplerV2: ), "chunk_seconds": ( "FLOAT", - {"default": 5.0, "min": 4.0, "max": 15.0, "step": 0.1, "tooltip": "Native H3 is trained for roughly 4–15 second outputs."}, + { + "default": CHUNK_SECONDS_DEFAULT, + "min": CHUNK_SECONDS_MIN, + "max": CHUNK_SECONDS_MAX, + "step": CHUNK_SECONDS_STEP, + "tooltip": CHUNK_SECONDS_TOOLTIP, + }, ), "width": ( "INT", @@ -314,6 +325,7 @@ class H3ContinuumSamplerV2: capture_refine_context=False, memory_attribution=False, prompt_conditioning_cache=False, + continuation_transport="reference_context_v1", **clip_prompt_inputs, ): ( @@ -389,6 +401,7 @@ class H3ContinuumSamplerV2: capture_refine_context=bool(capture_refine_context), memory_attribution=bool(memory_attribution), prompt_conditioning_cache=bool(prompt_conditioning_cache), + continuation_transport=str(continuation_transport), ) @@ -413,7 +426,13 @@ class H3ContinuumPromptPlanPreview: "chunks": ("INT", {"default": 3, "min": 1, "max": 16, "step": 1}), "chunk_seconds": ( "FLOAT", - {"default": 5.0, "min": 4.0, "max": 15.0, "step": 0.1, "tooltip": "Native H3 is trained for roughly 4–15 second outputs."}, + { + "default": CHUNK_SECONDS_DEFAULT, + "min": CHUNK_SECONDS_MIN, + "max": CHUNK_SECONDS_MAX, + "step": CHUNK_SECONDS_STEP, + "tooltip": CHUNK_SECONDS_TOOLTIP, + }, ), } } @@ -669,7 +688,13 @@ class H3ContinuumSampler: "chunks": ("INT", {"default": 3, "min": 1, "max": 16, "step": 1}), "chunk_seconds": ( "FLOAT", - {"default": 5.0, "min": 4.0, "max": 15.0, "step": 0.1}, + { + "default": CHUNK_SECONDS_DEFAULT, + "min": CHUNK_SECONDS_MIN, + "max": CHUNK_SECONDS_MAX, + "step": CHUNK_SECONDS_STEP, + "tooltip": CHUNK_SECONDS_TOOLTIP, + }, ), "width": ("INT", {"default": 1344, "min": 32, "max": 16384, "step": 32}), "height": ("INT", {"default": 768, "min": 32, "max": 16384, "step": 32}), diff --git a/v2/prompts.py b/v2/prompts.py index 31f6245..8ceec00 100644 --- a/v2/prompts.py +++ b/v2/prompts.py @@ -7,6 +7,7 @@ from __future__ import annotations import hashlib, json, re from typing import Any from ..constants import ( + CHUNK_SECONDS_MAX,CHUNK_SECONDS_MIN, PROMPT_FORMAT_AUTO,PROMPT_FORMAT_FIXED,PROMPT_FORMAT_LIST,PROMPT_FORMAT_TIMELINE, PROMPT_MODE_FIXED,PROMPT_MODE_LIST,PROMPT_MODE_TIMELINE,PROMPT_PLAN_MAGIC, ) @@ -155,7 +156,7 @@ def resolve_prompt_mode(mode,script): def make_prompt_plan(*,mode,script,chunks,chunk_seconds): chunks=int(chunks); chunk_seconds=float(chunk_seconds) if not 1<=chunks<=16: raise PromptPlanError("chunks must be between 1 and 16") - if not 4.0<=chunk_seconds<=15.0: raise PromptPlanError("chunk_seconds must be between 4.0 and 15.0 for native H3") + if not CHUNK_SECONDS_MIN<=chunk_seconds<=CHUNK_SECONDS_MAX: raise PromptPlanError(f"chunk_seconds must be between {CHUNK_SECONDS_MIN:.1f} and {CHUNK_SECONDS_MAX:.1f}") notes=[]; diagnostics=[] try: resolved_mode=resolve_prompt_mode(mode,script) @@ -177,6 +178,9 @@ def validate_prompt_plan(plan): if int(plan.get("schema_version",-1))!=PROMPT_PLAN_SCHEMA_VERSION: raise PromptPlanError(f"unsupported prompt-plan schema {plan.get('schema_version')}; expected {PROMPT_PLAN_SCHEMA_VERSION}") chunks=int(plan.get("chunks",0)); prompts=plan.get("prompts"); hashes=plan.get("hashes") if not 1<=chunks<=16: raise PromptPlanError("prompt-plan chunks are invalid") + try: chunk_seconds=float(plan.get("chunk_seconds")) + except (TypeError,ValueError): raise PromptPlanError("prompt-plan chunk_seconds is invalid") from None + if not CHUNK_SECONDS_MIN<=chunk_seconds<=CHUNK_SECONDS_MAX: raise PromptPlanError(f"prompt-plan chunk_seconds must be between {CHUNK_SECONDS_MIN:.1f} and {CHUNK_SECONDS_MAX:.1f}") if not isinstance(prompts,list) or len(prompts)!=chunks: raise PromptPlanError("prompt-plan prompt count does not match chunks") if not isinstance(hashes,list) or len(hashes)!=chunks: raise PromptPlanError("prompt-plan hash count does not match chunks") for index,prompt in enumerate(prompts): diff --git a/v2/sequence.py b/v2/sequence.py index 84ec719..2e722a7 100644 --- a/v2/sequence.py +++ b/v2/sequence.py @@ -47,6 +47,12 @@ from .session import ( LOG=logging.getLogger("h3_continuum_join") class SequenceRuntimeError(RuntimeError): pass +REFERENCE_CONTEXT_V1="reference_context_v1" +MASKED_VIDEO_PREFIX_V1="masked_video_prefix_v1" +MASKED_AV_PREFIX_22_V1="masked_av_prefix_22_v1" +MASKED_AV_PREFIX_39_V1="masked_av_prefix_39_v1" +CONTINUATION_TRANSPORTS=(REFERENCE_CONTEXT_V1,MASKED_VIDEO_PREFIX_V1,MASKED_AV_PREFIX_22_V1,MASKED_AV_PREFIX_39_V1) + def _record_context_diagnostics(*,tracker,reports,state,continuity,reused): if tracker is None: return try: @@ -153,6 +159,14 @@ def _flf_contract_identity(base_hash: str) -> str: return hashlib.sha256(payload.encode("utf-8")).hexdigest() +def _continuation_transport_identity(base_hash: str, transport: str) -> str: + """Scope non-default continuation sessions without revising legacy identity.""" + if str(transport) == REFERENCE_CONTEXT_V1: + return str(base_hash) + payload = f"{base_hash}|continuation_transport={transport}" + return hashlib.sha256(payload.encode("utf-8")).hexdigest() + + def _terminal_flf_merge_enabled( *, multi_chunk_flf: bool, @@ -248,16 +262,19 @@ def _terminal_execution_semantics( *, merge_enabled: bool, prompt_policy: str | None = None, + continuation_transport: str = REFERENCE_CONTEXT_V1, ) -> dict[str, str] | None: - if not merge_enabled: - return None - semantics = { - "flf_execution": FLF_STRATEGY, - "terminal_seed_policy": TERMINAL_SEED_POLICY, - } - if prompt_policy: - semantics["terminal_prompt_policy"] = str(prompt_policy) - return semantics + semantics: dict[str, str] = {} + if merge_enabled: + semantics.update({ + "flf_execution": FLF_STRATEGY, + "terminal_seed_policy": TERMINAL_SEED_POLICY, + }) + if prompt_policy: + semantics["terminal_prompt_policy"] = str(prompt_policy) + if str(continuation_transport) != REFERENCE_CONTEXT_V1: + semantics["continuation_transport"] = str(continuation_transport) + return semantics or None def _terminal_pair_contract(*, initial_pair: bool, chunk_seconds: float) -> dict[str, Any]: @@ -367,7 +384,7 @@ def _attach_terminal_flf_keyframes( metadata["minimax_frame_count"] = int(frame_count) return conditioning -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,driving_audio_source=None,driving_audio_vae=None,reference_video_source=None,timeline_video_source=None,capture_refine_context:bool=False,memory_attribution:bool=False,prompt_conditioning_cache:bool=False,_memory_attribution_collector:Any=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,driving_audio_source=None,driving_audio_vae=None,reference_video_source=None,timeline_video_source=None,capture_refine_context:bool=False,memory_attribution:bool=False,prompt_conditioning_cache:bool=False,continuation_transport:str=REFERENCE_CONTEXT_V1,_memory_attribution_collector:Any=None): from ..conditioning import detect_conditioning_mode, conditioning_display_label from ..run_storage import get_active_run_storage storage_controller=get_active_run_storage() @@ -385,6 +402,11 @@ def run_sequence(*,model:Any,clip:Any,video_vae:Any,audio_vae:Any,sampler:Any,si from ..v3.memory_attribution import capture_attribution_fail_soft capture_memory=capture_attribution_fail_soft plan=validate_prompt_plan(prompt_plan); chunks=int(plan["chunks"]); chunk_seconds=float(plan["chunk_seconds"]); prompts=list(plan["prompts"]); prompt_hashes=list(plan["hashes"]); width,height=int(width),int(height) + continuation_transport=str(continuation_transport) + if continuation_transport not in CONTINUATION_TRANSPORTS: + raise SequenceRuntimeError( + f"unknown private continuation transport: {continuation_transport!r}" + ) # Legacy workflow input only. Runtime compatibility is advisory in V3.4. strict_compatibility=False if width<=0 or height<=0 or width%32 or height%32: raise SequenceRuntimeError("width and height must be positive multiples of 32") @@ -435,9 +457,10 @@ def run_sequence(*,model:Any,clip:Any,video_vae:Any,audio_vae:Any,sampler:Any,si sequence_identity_hash=combine_timeline_video_identity(sequence_identity_hash,timeline_video_source) if multi_chunk_flf: sequence_identity_hash=_flf_contract_identity(sequence_identity_hash) + sequence_identity_hash=_continuation_transport_identity(sequence_identity_hash,continuation_transport) 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,reference_audio_contract=reference_audio_source.contract if reference_audio_source is not None else None,reference_audio_vae=reference_audio_vae,driving_audio_contract=driving_audio_source.contract if driving_audio_source is not None else None,driving_audio_vae=driving_audio_vae,reference_video_contract=reference_video_source.contract if reference_video_source is not None else None,timeline_video_contract=timeline_video_source.contract if timeline_video_source is not None else None,execution_semantics=_terminal_execution_semantics(merge_enabled=terminal_merge_enabled,prompt_policy=terminal_prompt_policy)) + 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,driving_audio_contract=driving_audio_source.contract if driving_audio_source is not None else None,driving_audio_vae=driving_audio_vae,reference_video_contract=reference_video_source.contract if reference_video_source is not None else None,timeline_video_contract=timeline_video_source.contract if timeline_video_source is not None else None,execution_semantics=_terminal_execution_semantics(merge_enabled=terminal_merge_enabled,prompt_policy=terminal_prompt_policy,continuation_transport=continuation_transport)) reroll_nonce=storage_controller.effective_reroll_nonce if stored_session is not None: session=stored_session accelerators=accelerator_summary(model) @@ -453,6 +476,8 @@ def run_sequence(*,model:Any,clip:Any,video_vae:Any,audio_vae:Any,sampler:Any,si preserved,atomic_reset=_atomic_terminal_prefix(preserved,chunks=chunks,reroll_from_chunk=int(reroll_from_chunk)) if atomic_reset: reuse_notes.append("terminal merged pair is atomic; regenerated both final logical chunks") + if storage_controller is not None: + storage_controller.reused_count=len(preserved) if multi_chunk_flf: if terminal_merge_enabled: reuse_notes.insert(0,"FLF execution: terminal merged 10s seed v2; the final two 5-second logical chunks share one physical sample and are split back into normal chunk entries.") @@ -551,7 +576,7 @@ def run_sequence(*,model:Any,clip:Any,video_vae:Any,audio_vae:Any,sampler:Any,si for sequence_index in normal_indices: if memory_collector is not None: capture_memory(memory_collector, "start_phase", phase="group_prepare", physical_group=sequence_index+1, logical_chunks=(sequence_index+1,)) - prompt=prompts[sequence_index]; prompt_hash_value=prompt_hashes[sequence_index]; is_final=sequence_index==chunks-1; effective_reroll_nonce=int(reroll_nonce) if int(reroll_from_chunk)>0 and sequence_index+1>=int(reroll_from_chunk) else 0; seed=derive_chunk_seed(base_seed,sequence_index,effective_reroll_nonce); motion_score=0.0; video_context=None; audio_context=None; context_before=None + prompt=prompts[sequence_index]; prompt_hash_value=prompt_hashes[sequence_index]; is_final=sequence_index==chunks-1; effective_reroll_nonce=int(reroll_nonce) if int(reroll_from_chunk)>0 and sequence_index+1>=int(reroll_from_chunk) else 0; seed=derive_chunk_seed(base_seed,sequence_index,effective_reroll_nonce); motion_score=0.0; video_context=None; audio_context=None; context_before=None; context_interop_emitted=False timeline_video_assets=reference_video_assets chunk_cache=cache if timeline_video_source is not None: @@ -579,13 +604,47 @@ def run_sequence(*,model:Any,clip:Any,video_vae:Any,audio_vae:Any,sampler:Any,si context_frames,motion_score,reason=choose_context_frames(continuity,previous_state); desired_cumulative=int(round((sequence_index+1)*chunk_seconds*FPS)); requested_new_frames=max(1,desired_cumulative-retained_frames); shape=make_extension_shape(context_frames,requested_new_frames/FPS); latent=empty_h3_latent(width,height,shape.total_frames) include_chunk_last=bool(last_frame is not None and is_final) conditioning_key=_conditioning_cache_key(prompt,include_last=include_chunk_last,reference_assets=reference_assets) - base_conditioning=attach_keyframes(chunk_cache[conditioning_key],frame_count=shape.total_frames,first_latent=chunk_assets.first_latent,last_latent=chunk_assets.last_latent if include_chunk_last else None) - video_context,audio_context,grid_offset=select_context(previous_state,context_frames,include_audio=bool(audio_continuity)); context_before=context_fingerprint(video_context,audio_context) - conditioning=prepare_conditioning(base_conditioning,video_context=video_context,audio_context=audio_context,audio_grid_offset=grid_offset,context_frames=context_frames,new_frame_count=shape.total_frames,first_frame_policy=POLICY_REPLACE,preserve_last_frame=True) + continuation_first_latent=None if continuation_transport in (MASKED_VIDEO_PREFIX_V1,MASKED_AV_PREFIX_22_V1,MASKED_AV_PREFIX_39_V1) else chunk_assets.first_latent + base_conditioning=attach_keyframes(chunk_cache[conditioning_key],frame_count=shape.total_frames,first_latent=continuation_first_latent,last_latent=chunk_assets.last_latent if include_chunk_last else None) + if continuation_transport in (MASKED_VIDEO_PREFIX_V1,MASKED_AV_PREFIX_22_V1,MASKED_AV_PREFIX_39_V1): + preserve_audio=continuation_transport in (MASKED_AV_PREFIX_22_V1,MASKED_AV_PREFIX_39_V1) + required_context=(22 if continuation_transport == MASKED_AV_PREFIX_22_V1 else 39) + if preserve_audio and int(context_frames) != required_context: + raise SequenceRuntimeError( + f"{continuation_transport} requires {required_context}-frame continuity" + ) + video_context,audio_context,grid_offset=select_context(previous_state,context_frames,include_audio=preserve_audio) + context_before=context_fingerprint(video_context,audio_context) + if preserve_audio: + from ..v3.masked_continuation import build_masked_av_prefix_latent + latent=build_masked_av_prefix_latent( + latent, + video_context, + audio_context, + context_frames, + ) + reason=( + f"{reason}; masked AV target prefix " + f"{context_frames}f/{int(audio_context.shape[-1])}T; " + f"source_audio_grid_offset={float(grid_offset):.6f}" + ) + else: + from ..v3.masked_continuation import build_masked_video_prefix_latent + latent=build_masked_video_prefix_latent( + latent, + video_context, + context_frames, + ) + reason=f"{reason}; masked video target prefix" + conditioning=base_conditioning + else: + video_context,audio_context,grid_offset=select_context(previous_state,context_frames,include_audio=bool(audio_continuity)); context_before=context_fingerprint(video_context,audio_context) + conditioning=prepare_conditioning(base_conditioning,video_context=video_context,audio_context=audio_context,audio_grid_offset=grid_offset,context_frames=context_frames,new_frame_count=shape.total_frames,first_frame_policy=POLICY_REPLACE,preserve_last_frame=True) + context_interop_emitted=True clip_index=int(previous_state["clip_index"])+1; chunk_plan=make_plan(continuation=True,clip_index=clip_index,total_frames=shape.total_frames,trim_frames=context_frames,width=width,height=height,context_frames=context_frames,state_capacity_frames=largest_context_capacity(shape.net_new_frames),requested_extend_seconds=chunk_seconds,debug=debug) driving_audio_latent=slice_driving_audio_latent(driving_audio_assets,cumulative_retained_before=retained_frames,total_frames=int(chunk_plan["total_frames"]),trim_frames=int(chunk_plan["trim_frames"]),fps=FPS) conditioning=attach_driving_audio(conditioning,driving_audio_latent) - chunk_model=clone_model_for_chunk(model,strict=bool(strict_compatibility),debug=bool(debug),chunk_index=clip_index,context_frames=context_frames if previous_state is not None else None) + chunk_model=clone_model_for_chunk(model,strict=bool(strict_compatibility),debug=bool(debug),chunk_index=clip_index,context_frames=context_frames if context_interop_emitted else None) if memory_collector is not None: capture_memory(memory_collector, "finish_phase", phase="group_prepare", physical_group=sequence_index+1, logical_chunks=(sequence_index+1,)) capture_memory(memory_collector, "start_phase", phase="refine_context", physical_group=sequence_index+1, logical_chunks=(sequence_index+1,)) @@ -620,6 +679,13 @@ def run_sequence(*,model:Any,clip:Any,video_vae:Any,audio_vae:Any,sampler:Any,si if memory_collector is not None: capture_memory(memory_collector, "start_phase", phase="sampling", physical_group=sequence_index+1, logical_chunks=(sequence_index+1,)) sampled=sample_chunk(model=chunk_model,conditioning=conditioning,latent=latent,sampler=sampler,sigmas=sigmas,seed=seed,enable_preview=bool(enable_preview)) + if previous_state is not None and continuation_transport in (MASKED_VIDEO_PREFIX_V1,MASKED_AV_PREFIX_22_V1,MASKED_AV_PREFIX_39_V1): + if continuation_transport in (MASKED_AV_PREFIX_22_V1,MASKED_AV_PREFIX_39_V1): + from ..v3.masked_continuation import restore_masked_av_prefix + sampled=restore_masked_av_prefix(sampled,latent,context_frames) + else: + from ..v3.masked_continuation import restore_masked_video_prefix + sampled=restore_masked_video_prefix(sampled,latent,context_frames) if memory_collector is not None: capture_memory(memory_collector, "finish_phase", phase="sampling", physical_group=sequence_index+1, logical_chunks=(sequence_index+1,)) if memory_collector is not None: @@ -640,7 +706,7 @@ def run_sequence(*,model:Any,clip:Any,video_vae:Any,audio_vae:Any,sampler:Any,si if memory_collector is not None: capture_memory(memory_collector, "finish_phase", phase="cpu_commit_validation", physical_group=sequence_index+1, logical_chunks=(sequence_index+1,)) retained_frames+=int(chunk_plan["net_frames"]) - sampling_reports.append(f"chunk {sequence_index+1}/{chunks}: seed={seed}, frames={chunk_plan['total_frames']}, trim={chunk_plan['trim_frames']}, retained_total={retained_frames}, context={context_frames} ({reason}), motion={motion_score:.6f}, "+(f"interop=emitted actual_prefix={CONTINUUM_ACTUAL_PREFIX_STEPS} consumer=not_observable" if context_before is not None else "interop=not_emitted")) + sampling_reports.append(f"chunk {sequence_index+1}/{chunks}: seed={seed}, frames={chunk_plan['total_frames']}, trim={chunk_plan['trim_frames']}, retained_total={retained_frames}, context={context_frames} ({reason}), motion={motion_score:.6f}, "+(f"interop=emitted actual_prefix={CONTINUUM_ACTUAL_PREFIX_STEPS} consumer=not_observable" if context_interop_emitted else "interop=not_emitted")) del sampled,latent,conditioning,chunk_model,chunk_cache if timeline_video_source is not None and timeline_video_assets is not None: del timeline_video_assets if memory_collector is not None: @@ -667,9 +733,26 @@ def run_sequence(*,model:Any,clip:Any,video_vae:Any,audio_vae:Any,sampler:Any,si contract=_terminal_pair_contract(initial_pair=initial_pair,chunk_seconds=chunk_seconds) physical_frames=int(contract["physical_frames"]) physical_context_frames=int(contract["physical_context_frames"]) + terminal_masked=bool( + not initial_pair + and continuation_transport in ( + MASKED_VIDEO_PREFIX_V1, + MASKED_AV_PREFIX_22_V1, + ) + ) + if not initial_pair and continuation_transport==MASKED_AV_PREFIX_39_V1: + raise SequenceRuntimeError( + "masked_av_prefix_39_v1 is not defined for the 22-frame " + "Long Terminal Merge contract" + ) latent=empty_h3_latent(width,height,physical_frames) conditioning_key=_conditioning_cache_key(prompt,include_last=True,reference_assets=reference_assets) - base_conditioning=attach_keyframes(cache[conditioning_key],frame_count=physical_frames,first_latent=assets.first_latent,last_latent=assets.last_latent) + base_conditioning=attach_keyframes( + cache[conditioning_key], + frame_count=physical_frames, + first_latent=None if terminal_masked else assets.first_latent, + last_latent=assets.last_latent, + ) video_context=None; audio_context=None; context_before=None; motion_score=0.0 if initial_pair: conditioning=base_conditioning @@ -677,14 +760,55 @@ def run_sequence(*,model:Any,clip:Any,video_vae:Any,audio_vae:Any,sampler:Any,si reason="terminal merged initial 10-second sample" else: selected_context,motion_score,selected_reason=choose_context_frames(continuity,previous_state) - video_context,audio_context,grid_offset=select_context(previous_state,TERMINAL_MERGE_CONTEXT_FRAMES,include_audio=bool(audio_continuity)) + masked_audio=terminal_masked and continuation_transport==MASKED_AV_PREFIX_22_V1 + video_context,audio_context,grid_offset=select_context( + previous_state, + TERMINAL_MERGE_CONTEXT_FRAMES, + include_audio=bool(audio_continuity) if not terminal_masked else masked_audio, + ) context_before=context_fingerprint(video_context,audio_context) - conditioning=prepare_conditioning(base_conditioning,video_context=video_context,audio_context=audio_context,audio_grid_offset=grid_offset,context_frames=TERMINAL_MERGE_CONTEXT_FRAMES,new_frame_count=physical_frames,first_frame_policy=POLICY_REPLACE,preserve_last_frame=True) + if terminal_masked: + if masked_audio: + from ..v3.masked_continuation import build_masked_av_prefix_latent + latent=build_masked_av_prefix_latent( + latent, + video_context, + audio_context, + TERMINAL_MERGE_CONTEXT_FRAMES, + ) + reason=( + "terminal merged 10-second sample with masked AV target " + "prefix 22f/37T; no Continuum Reference rows" + ) + else: + from ..v3.masked_continuation import build_masked_video_prefix_latent + latent=build_masked_video_prefix_latent( + latent, + video_context, + TERMINAL_MERGE_CONTEXT_FRAMES, + ) + reason=( + "terminal merged 10-second sample with masked video " + "target prefix 22f/7T; no Continuum Reference rows" + ) + conditioning=base_conditioning + else: + conditioning=prepare_conditioning(base_conditioning,video_context=video_context,audio_context=audio_context,audio_grid_offset=grid_offset,context_frames=TERMINAL_MERGE_CONTEXT_FRAMES,new_frame_count=physical_frames,first_frame_policy=POLICY_REPLACE,preserve_last_frame=True) + reason=f"terminal merged 10-second sample with 22-frame context; continuity selection was {selected_context} ({selected_reason})" physical_clip_index=int(previous_state["clip_index"])+1 - reason=f"terminal merged 10-second sample with 22-frame context; continuity selection was {selected_context} ({selected_reason})" driving_audio_latent=slice_driving_audio_latent(driving_audio_assets,cumulative_retained_before=retained_frames,total_frames=physical_frames,trim_frames=physical_context_frames,fps=FPS) conditioning=attach_driving_audio(conditioning,driving_audio_latent) - chunk_model=clone_model_for_chunk(model,strict=bool(strict_compatibility),debug=bool(debug),chunk_index=physical_clip_index,context_frames=physical_context_frames if not initial_pair else None) + chunk_model=clone_model_for_chunk( + model, + strict=bool(strict_compatibility), + debug=bool(debug), + chunk_index=physical_clip_index, + context_frames=( + physical_context_frames + if not initial_pair and not terminal_masked + else None + ), + ) if memory_collector is not None: capture_memory(memory_collector, "finish_phase", phase="group_prepare", physical_group=terminal_physical_group, logical_chunks=terminal_logical_chunks) capture_memory(memory_collector, "start_phase", phase="refine_context", physical_group=terminal_physical_group, logical_chunks=terminal_logical_chunks) @@ -701,7 +825,7 @@ def run_sequence(*,model:Any,clip:Any,video_vae:Any,audio_vae:Any,sampler:Any,si source_video_shape=tuple(int(value) for value in source_video.shape), physical_clip_index=int(physical_clip_index), context_frames=int(physical_context_frames), - first_image=assets.first_image, + first_image=None if terminal_masked else assets.first_image, last_image=assets.last_image, )) del source_video,_ @@ -719,6 +843,21 @@ def run_sequence(*,model:Any,clip:Any,video_vae:Any,audio_vae:Any,sampler:Any,si if memory_collector is not None: capture_memory(memory_collector, "start_phase", phase="sampling", physical_group=terminal_physical_group, logical_chunks=terminal_logical_chunks) sampled=sample_chunk(model=chunk_model,conditioning=conditioning,latent=latent,sampler=sampler,sigmas=sigmas,seed=physical_seed,enable_preview=bool(enable_preview)) + if terminal_masked: + if continuation_transport==MASKED_AV_PREFIX_22_V1: + from ..v3.masked_continuation import restore_masked_av_prefix + sampled=restore_masked_av_prefix( + sampled, + latent, + TERMINAL_MERGE_CONTEXT_FRAMES, + ) + else: + from ..v3.masked_continuation import restore_masked_video_prefix + sampled=restore_masked_video_prefix( + sampled, + latent, + TERMINAL_MERGE_CONTEXT_FRAMES, + ) if memory_collector is not None: capture_memory(memory_collector, "finish_phase", phase="sampling", physical_group=terminal_physical_group, logical_chunks=terminal_logical_chunks) if memory_collector is not None: @@ -775,6 +914,7 @@ def run_sequence(*,model:Any,clip:Any,video_vae:Any,audio_vae:Any,sampler:Any,si 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 multi_chunk_flf: settings["flf_execution"]=FLF_STRATEGY + if continuation_transport!=REFERENCE_CONTEXT_V1: settings["continuation_transport"]=continuation_transport if reference_audio_source is not None: settings["reference_audio_contract"]=reference_audio_source.contract if driving_audio_source is not None: settings["driving_audio_contract"]=driving_audio_source.contract if reference_video_source is not None: settings["reference_video_contract"]=reference_video_source.contract @@ -818,6 +958,7 @@ def run_sequence(*,model:Any,clip:Any,video_vae:Any,audio_vae:Any,sampler:Any,si 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":bool(exact_total_duration),"prompt_mode":plan["mode"],"base_seed":int(base_seed),"reroll_nonce":int(reroll_nonce),"diagnostics_mode":diagnostics_mode,"initial_state_source":initial_state is not None,"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 multi_chunk_flf: settings["flf_execution"]=FLF_STRATEGY + if continuation_transport!=REFERENCE_CONTEXT_V1: settings["continuation_transport"]=continuation_transport 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) decoded_gib=float(images.shape[0])*float(width)*float(height)*3.0*4.0/(1024.0**3) report_lines=[f"H3 Continuum V2 {PACKAGE_VERSION}",prompt_plan_report(plan),f"Seam correction: {seam_correction}.",accelerators,"Execution: conditioning precomputed; single call-local MODEL clone per chunk; decode deferred until sampling completed.",*reuse_notes] diff --git a/v3/driving_nodes.py b/v3/driving_nodes.py index 303e706..7883a15 100644 --- a/v3/driving_nodes.py +++ b/v3/driving_nodes.py @@ -265,6 +265,80 @@ class H3ContinuumSamplerV35(H3ContinuumSamplerV34): ) +CONTINUATION_BACKEND_STANDARD = "Standard" +CONTINUATION_BACKEND_COMPATIBILITY = "Compatibility" +CONTINUATION_BACKEND_OPTIONS = ( + CONTINUATION_BACKEND_STANDARD, + CONTINUATION_BACKEND_COMPATIBILITY, +) + + +class H3ContinuumSamplerV36(H3ContinuumSamplerV35): + """V3.6 sampler with Masked continuation and a legacy fallback.""" + + DEPRECATED = False + CATEGORY = CONTINUUM_CATEGORY + DESCRIPTION = ( + "H3 Continuum V3.6 sampler. Standard continuation preserves prior Video/Audio " + "inside the next H3 target with native noise masks; Compatibility retains the " + "V3.5 Reference Context transport." + ) + SEARCH_ALIASES = [ + "H3 Continuum Sampler V3.6", + "MiniMax H3 masked continuation", + ] + + @classmethod + def INPUT_TYPES(cls): + schema = super().INPUT_TYPES() + required = dict(schema.get("required", {})) + required["continuation_backend"] = ( + CONTINUATION_BACKEND_OPTIONS, + { + "default": CONTINUATION_BACKEND_STANDARD, + "display_name": "Continuation Backend", + "advanced": True, + "tooltip": ( + "Standard uses the V3.6 target-preserving continuation path. " + "Compatibility restores the V3.5 Reference Context path for " + "older workflows or comparison. Run Storage keeps the two " + "backends in separate revisions." + ), + }, + ) + schema["required"] = required + return schema + + def run( + self, + *args, + continuation_backend=CONTINUATION_BACKEND_STANDARD, + **kwargs, + ): + from ..v2.sequence import ( + MASKED_AV_PREFIX_22_V1, + MASKED_VIDEO_PREFIX_V1, + REFERENCE_CONTEXT_V1, + ) + + backend = str(continuation_backend) + if backend == CONTINUATION_BACKEND_COMPATIBILITY: + transport = REFERENCE_CONTEXT_V1 + else: + audio_continuity = kwargs.get("audio_continuity") + if audio_continuity is None and len(args) > 13: + audio_continuity = args[13] + if audio_continuity is None: + audio_continuity = True + transport = ( + MASKED_AV_PREFIX_22_V1 + if bool(audio_continuity) + else MASKED_VIDEO_PREFIX_V1 + ) + kwargs["continuation_transport"] = transport + return super().run(*args, **kwargs) + + class H3ContinuumAssembleSeamV34(H3ContinuumAssembleSeamExperimental): """Assemble decoded chunks and select original Driving Audio when connected.""" @@ -444,6 +518,7 @@ class H3ContinuumAssembleSeamV35(H3ContinuumAssembleSeamV34): NODE_CLASS_MAPPINGS = { "H3ContinuumSamplerV34": H3ContinuumSamplerV34, "H3ContinuumSamplerV35": H3ContinuumSamplerV35, + "H3ContinuumSamplerV36": H3ContinuumSamplerV36, "H3ContinuumAssembleSeamV34": H3ContinuumAssembleSeamV34, "H3ContinuumAssembleSeamV35": H3ContinuumAssembleSeamV35, } @@ -451,6 +526,7 @@ NODE_CLASS_MAPPINGS = { NODE_DISPLAY_NAME_MAPPINGS = { "H3ContinuumSamplerV34": "H3 Continuum Sampler V3.4", "H3ContinuumSamplerV35": "H3 Continuum Sampler V3.5", + "H3ContinuumSamplerV36": "H3 Continuum Sampler V3.6", "H3ContinuumAssembleSeamV34": "H3 Continuum Assemble + Seam V3.4", "H3ContinuumAssembleSeamV35": "H3 Continuum Assemble + Seam V3.5", } diff --git a/v3/masked_continuation.py b/v3/masked_continuation.py new file mode 100644 index 0000000..498c05b --- /dev/null +++ b/v3/masked_continuation.py @@ -0,0 +1,236 @@ +"""Private V3.6 masked-prefix continuation experiments. + +This module is intentionally not registered as a public node contract. It +builds H3 AV targets whose protected prefixes are preserved by Core's denoise +mask. R1 protects video only; R2-0 can protect matching video and audio tails. +""" + +from __future__ import annotations + +from typing import Any + +import torch + +from ..state import extract_av_streams +from ..temporal import audio_latent_t, context_slots + + +REFERENCE_CONTEXT_V1 = "reference_context_v1" +MASKED_VIDEO_PREFIX_V1 = "masked_video_prefix_v1" +MASKED_AV_PREFIX_22_V1 = "masked_av_prefix_22_v1" +MASKED_AV_PREFIX_39_V1 = "masked_av_prefix_39_v1" +CONTINUATION_TRANSPORTS = ( + REFERENCE_CONTEXT_V1, + MASKED_VIDEO_PREFIX_V1, + MASKED_AV_PREFIX_22_V1, + MASKED_AV_PREFIX_39_V1, +) + + +def _build_masked_prefix_latent( + target_latent: dict[str, Any], + video_context: torch.Tensor, + context_frames: int, + *, + audio_context: torch.Tensor | None, +) -> dict[str, Any]: + """Copy normalized AV tails into a target and attach stream masks.""" + + try: + import comfy.nested_tensor + except Exception as exc: # pragma: no cover - ComfyUI runtime only + raise RuntimeError(f"ComfyUI NestedTensor helper unavailable: {exc}") from exc + + target_video, target_audio = extract_av_streams(target_latent) + frames = int(context_frames) + slots = context_slots(frames) + if not torch.is_tensor(video_context) or video_context.ndim != 5: + raise ValueError("masked video context must be a five-dimensional Tensor") + if tuple(video_context.shape[:2]) != tuple(target_video.shape[:2]): + raise ValueError( + "masked video context batch/channel shape does not match the target: " + f"context={tuple(video_context.shape)}, target={tuple(target_video.shape)}" + ) + if int(video_context.shape[2]) != slots: + raise ValueError( + f"masked video context has T={video_context.shape[2]}; expected {slots} " + f"for {frames} frames" + ) + if tuple(video_context.shape[-2:]) != tuple(target_video.shape[-2:]): + raise ValueError( + "masked video context geometry does not match the target: " + f"context={tuple(video_context.shape[-2:])}, " + f"target={tuple(target_video.shape[-2:])}" + ) + if int(target_video.shape[2]) <= slots: + raise ValueError("masked video target must contain generated slots after the prefix") + + normalized_video = video_context.detach().to( + device=target_video.device, + dtype=target_video.dtype, + ).contiguous() + if not bool(torch.isfinite(normalized_video.float()).all().item()): + raise ValueError("masked video context contains NaN or Inf") + + normalized_audio = None + audio_steps = 0 + if audio_context is not None: + audio_steps = audio_latent_t(frames) + if not torch.is_tensor(audio_context) or audio_context.ndim != 4: + raise ValueError("masked audio context must be a four-dimensional Tensor") + if tuple(audio_context.shape[:3]) != tuple(target_audio.shape[:3]): + raise ValueError( + "masked audio context batch/channel shape does not match the target: " + f"context={tuple(audio_context.shape)}, target={tuple(target_audio.shape)}" + ) + if int(audio_context.shape[-1]) != audio_steps: + raise ValueError( + f"masked audio context has T={audio_context.shape[-1]}; expected " + f"{audio_steps} for {frames} frames" + ) + if int(target_audio.shape[-1]) <= audio_steps: + raise ValueError("masked audio target must contain generated ticks after the prefix") + normalized_audio = audio_context.detach().to( + device=target_audio.device, + dtype=target_audio.dtype, + ).contiguous() + if not bool(torch.isfinite(normalized_audio.float()).all().item()): + raise ValueError("masked audio context contains NaN or Inf") + + video = target_video.clone() + audio = target_audio.clone() + video[:, :, :slots].copy_(normalized_video) + if normalized_audio is not None: + audio[..., :audio_steps].copy_(normalized_audio) + + video_mask = torch.ones( + ( + int(video.shape[0]), + 1, + int(video.shape[2]), + int(video.shape[3]), + int(video.shape[4]), + ), + device=video.device, + dtype=torch.float32, + ) + video_mask[:, :, :slots] = 0.0 + audio_mask = torch.ones( + ( + int(audio.shape[0]), + 1, + int(audio.shape[2]), + int(audio.shape[3]), + ), + device=audio.device, + dtype=torch.float32, + ) + if normalized_audio is not None: + audio_mask[..., :audio_steps] = 0.0 + + result = dict(target_latent) + result["samples"] = comfy.nested_tensor.NestedTensor((video, audio)) + result["noise_mask"] = comfy.nested_tensor.NestedTensor( + (video_mask, audio_mask) + ) + return result + + +def build_masked_video_prefix_latent( + target_latent: dict[str, Any], + video_context: torch.Tensor, + context_frames: int, +) -> dict[str, Any]: + """Copy a normalized video tail into the target and attach AV noise masks.""" + return _build_masked_prefix_latent( + target_latent, + video_context, + context_frames, + audio_context=None, + ) + + +def build_masked_av_prefix_latent( + target_latent: dict[str, Any], + video_context: torch.Tensor, + audio_context: torch.Tensor, + context_frames: int, +) -> dict[str, Any]: + """Copy matching video/audio tails and preserve both with denoise masks.""" + + return _build_masked_prefix_latent( + target_latent, + video_context, + context_frames, + audio_context=audio_context, + ) + + +def _restore_masked_prefix( + sampled_latent: dict[str, Any], + target_latent: dict[str, Any], + context_frames: int, + *, + restore_audio: bool, +) -> dict[str, Any]: + """Reapply only protected prefix regions after sampler integration.""" + + try: + import comfy.nested_tensor + except Exception as exc: # pragma: no cover - ComfyUI runtime only + raise RuntimeError(f"ComfyUI NestedTensor helper unavailable: {exc}") from exc + + sampled_video, sampled_audio = extract_av_streams(sampled_latent) + target_video, target_audio = extract_av_streams(target_latent) + slots = context_slots(int(context_frames)) + if tuple(sampled_video.shape) != tuple(target_video.shape): + raise ValueError( + "sampled video shape does not match the masked target: " + f"sampled={tuple(sampled_video.shape)}, target={tuple(target_video.shape)}" + ) + restored_video = sampled_video.clone() + restored_video[:, :, :slots].copy_(target_video[:, :, :slots]) + restored_audio = sampled_audio + if restore_audio: + if tuple(sampled_audio.shape) != tuple(target_audio.shape): + raise ValueError( + "sampled audio shape does not match the masked target: " + f"sampled={tuple(sampled_audio.shape)}, target={tuple(target_audio.shape)}" + ) + audio_steps = audio_latent_t(int(context_frames)) + restored_audio = sampled_audio.clone() + restored_audio[..., :audio_steps].copy_(target_audio[..., :audio_steps]) + result = dict(sampled_latent) + result["samples"] = comfy.nested_tensor.NestedTensor( + (restored_video, restored_audio) + ) + return result + + +def restore_masked_video_prefix( + sampled_latent: dict[str, Any], + target_latent: dict[str, Any], + context_frames: int, +) -> dict[str, Any]: + """Reapply only the preserved prefix after sampler integration rounding.""" + return _restore_masked_prefix( + sampled_latent, + target_latent, + context_frames, + restore_audio=False, + ) + + +def restore_masked_av_prefix( + sampled_latent: dict[str, Any], + target_latent: dict[str, Any], + context_frames: int, +) -> dict[str, Any]: + """Reapply only protected video and audio prefixes after Sampling.""" + + return _restore_masked_prefix( + sampled_latent, + target_latent, + context_frames, + restore_audio=True, + ) diff --git a/v3/nodes.py b/v3/nodes.py index 40a107e..c0e3d3e 100644 --- a/v3/nodes.py +++ b/v3/nodes.py @@ -4,7 +4,14 @@ from __future__ import annotations import time -from ..constants import DIAGNOSTICS_FULL +from ..constants import ( + CHUNK_SECONDS_DEFAULT, + CHUNK_SECONDS_MAX, + CHUNK_SECONDS_MIN, + CHUNK_SECONDS_STEP, + CHUNK_SECONDS_TOOLTIP, + DIAGNOSTICS_FULL, +) from ..v2.nodes import ( CATEGORY, DIAGNOSTICS_OPTIONS, @@ -181,7 +188,13 @@ class H3ContinuumSamplerV3: "chunks": ("INT", {"default": 3, "min": 1, "max": 16, "step": 1}), "chunk_seconds": ( "FLOAT", - {"default": 5.0, "min": 4.0, "max": 15.0, "step": 0.1}, + { + "default": CHUNK_SECONDS_DEFAULT, + "min": CHUNK_SECONDS_MIN, + "max": CHUNK_SECONDS_MAX, + "step": CHUNK_SECONDS_STEP, + "tooltip": CHUNK_SECONDS_TOOLTIP, + }, ), "width": ( "INT", @@ -259,6 +272,7 @@ class H3ContinuumSamplerV3: capture_refine_context=False, memory_attribution=False, prompt_conditioning_cache=False, + continuation_transport="reference_context_v1", ): if prompt_overrides is not None and not isinstance(prompt_overrides, dict): prompt_overrides = None @@ -341,6 +355,7 @@ class H3ContinuumSamplerV3: capture_refine_context=bool(capture_refine_context), memory_attribution=bool(memory_attribution), prompt_conditioning_cache=bool(prompt_conditioning_cache), + continuation_transport=str(continuation_transport), **clip_prompt_inputs, ) if bool(capture_refine_context): @@ -465,11 +480,11 @@ class H3ContinuumSamplerProduction(H3ContinuumSamplerV3): "chunk_seconds": ( "FLOAT", { - "default": 5.0, - "min": 4.0, - "max": 15.0, - "step": 0.1, - "tooltip": "Target duration per chunk. Five seconds is the validated default.", + "default": CHUNK_SECONDS_DEFAULT, + "min": CHUNK_SECONDS_MIN, + "max": CHUNK_SECONDS_MAX, + "step": CHUNK_SECONDS_STEP, + "tooltip": CHUNK_SECONDS_TOOLTIP, }, ), "width": ( @@ -666,6 +681,7 @@ class H3ContinuumSamplerProduction(H3ContinuumSamplerV3): capture_refine_context=False, memory_attribution=False, prompt_conditioning_cache=False, + continuation_transport="reference_context_v1", ): runtime_started_at = time.perf_counter() from ..reference import prepare_reference_assets @@ -718,6 +734,7 @@ class H3ContinuumSamplerProduction(H3ContinuumSamplerV3): capture_refine_context=bool(capture_refine_context), memory_attribution=bool(memory_attribution), prompt_conditioning_cache=bool(prompt_conditioning_cache), + continuation_transport=str(continuation_transport), advanced={ "audio_continuity": bool(audio_continuity), "diagnostics": diagnostics, diff --git a/version.py b/version.py index 207381b..bbe8f29 100644 --- a/version.py +++ b/version.py @@ -1,6 +1,6 @@ """Package version and public schema identifiers.""" -PACKAGE_VERSION = "3.5.3" +PACKAGE_VERSION = "3.6.0" STATE_SCHEMA_VERSION = 1 PLAN_SCHEMA_VERSION = 1 PUBLIC_API_VERSION = 3 diff --git a/web/project_id.js b/web/project_id.js index 695475c..006a3e5 100644 --- a/web/project_id.js +++ b/web/project_id.js @@ -7,6 +7,7 @@ const ASSEMBLE_SEAM_NODE_CLASS = "H3ContinuumAssembleSeamExperimental"; const V34_NODE_CLASS = "H3ContinuumSamplerV34"; const V34_ASSEMBLE_SEAM_NODE_CLASS = "H3ContinuumAssembleSeamV34"; const V35_NODE_CLASS = "H3ContinuumSamplerV35"; +const V36_NODE_CLASS = "H3ContinuumSamplerV36"; const V35_ASSEMBLE_SEAM_NODE_CLASS = "H3ContinuumAssembleSeamV35"; const PROJECT_WIDGET = "project_id"; const LEGACY_RUN_NAME_WIDGET = "run_name"; @@ -227,19 +228,20 @@ function configureNode(node) { const isTimeline = node.comfyClass === TIMELINE_NODE_CLASS; const isV34 = node.comfyClass === V34_NODE_CLASS; const isV35 = node.comfyClass === V35_NODE_CLASS; - if (!isProduction && !isTimeline && !isV34 && !isV35) { + const isV36 = node.comfyClass === V36_NODE_CLASS; + if (!isProduction && !isTimeline && !isV34 && !isV35 && !isV36) { configureAssembler(node); return null; } const projectWidget = findWidget(node, PROJECT_WIDGET); - if (isProduction || isV34 || isV35) { + if (isProduction || isV34 || isV35 || isV36) { if (projectWidget && !String(projectWidget.value || "").trim()) { projectWidget.value = createProjectId(); } removeUnusedInput(node, PROMPT_OVERRIDES_INPUT); } applyRuntimeSettings(node); - if (isV35) { + if (isV35 || isV36) { normalizeReferenceAudioLabels(node); } hidePersistentWidget(findWidget(node, "diagnostics")); @@ -316,6 +318,7 @@ app.registerExtension({ || node.comfyClass === TIMELINE_NODE_CLASS || node.comfyClass === V34_NODE_CLASS || node.comfyClass === V35_NODE_CLASS + || node.comfyClass === V36_NODE_CLASS ) { apiNode.inputs.diagnostics = settingValue(SETTINGS.detailedReport, false) ? "Detailed Report"