diff --git a/MANIFEST.sha256 b/MANIFEST.sha256 index e8b6cbe..e24f44d 100644 --- a/MANIFEST.sha256 +++ b/MANIFEST.sha256 @@ -1,13 +1,13 @@ dca65fb1393e67f59c6f81f9411e3e745eb8f1097e9a2adf7ffc6f4e3901ca9f __init__.py -15b900d02624bea6cfe8ea25b22266a0c68b38b9f10c9089be0e38988bf2e34d .github/workflows/tests.yml -0a2f69d4cec89d440f5d5aa1ec68a7c9a741382d313f80dcddf96d13f70b3e68 .gitignore -16ea21aa8fe115ce8f6538a0268bc64762be2fd6931b3a0071a86a8cc9d218cf AGENTS.md -1313e8e2301cfd6aff6c97bc50858bf9450210c83bd4166a74e61fd9c66c0498 CHANGELOG.md +31c3aebb287fe73bfb567db41b4539058f8ef074dae400405f7b7a44dc5b9cbc .github/workflows/tests.yml +85eada29c12706d55b78e4d8100899d1dadde4d9867406b8bac4eec22b81c6b6 .gitignore +b3df39256d3d6a2a955c6447365714ff4460d461cf31a714e841f97d5a4c2353 AGENTS.md +154b9568464a52226c3aa549b4b8f7eab09da3ed08f53e0eab3595584d11756f CHANGELOG.md e97e47c7585e81d9ec5fd32c0ca0b64699fd4610cd03e9d6575a91c30a10ca4e compatibility.py -4d62508f900af9f93ec320afb900c27cc9a300d1e0c0a94714258498c5ede5fc conditioning.py +16148b2175b371e082f2c623f6084bb45919d9eb5e4c478f882920c6761b5f6a conditioning.py 71e3df269e226b1ecad597f9831c2a10b2215c8a3783652e9e9f536e99ce46c9 constants.py cf255b8a635471229aebadc926acfdcacb65963adbcb9e0f9505d04eada2c6b5 continuation.py -f9375629fa1a2c4d3538442f0c3192d7ba2f46fe9544fb2e21f0c144b53d608c docs/AB_TEST_LOG_JA.md +23db6dadd0848345c74d066d421bdc6f695cd524cb6373078bcf105a10bb3830 docs/AB_TEST_LOG_JA.md c93a3e52e4deabe5ef0db7f34a7605856a543089574ba17227e697e9a2c0139a docs/ARCHITECTURE.md 7660570840229b6fcbe62f0fbb52966d0099d64d7e6f01a739fbf9899293c8e4 docs/FUTURE_ROADMAP.md 9a634b4ff6c9ca98285f6b250402a3d0e67d29f031e134d9bfcab54c119ed337 docs/images/comfyui-manager-h3-continuum.png @@ -27,8 +27,8 @@ ff8d901d05aa89f9b698c60b3d11534ef97982b3e22e9ede6255a85149a669c4 docs/images/v3 a53796f7a904d675e80a2276c20d68502f03a3958529278e6ce9465baaf1c4af docs/images/v35-hires-fix-node.png 5a23f232a8b795226e8255e6e2e3248b0130f1c7ce276d50370d0333d6a62ef0 docs/images/v35-second-pass-node.png 93f07aa727b34802bce3d333426b8ba2af522500882a6d222d00cf577ca82e49 docs/SEAM_TEST_SOURCE_JA.md -2c13aefd137db92a3dbf5576e9442d58012b1f0de1240c07d039ceeb702e7c1f docs/V2_1_4_UI_SIMPLIFICATION.md -b08022df068576c759c8bf80ac6b6519693f3c65c917f1822aeb06ea359aa5b1 docs/V2_1_5_UI_SERIALIZATION_STABILITY.md +90acddd795d84c5a24f79598670aec1655eaf58d45fd6d362dc758e2b880a071 docs/V2_1_4_UI_SIMPLIFICATION.md +61805ebbfa2bb2451c4fc8a2bed046073cc135b93ddc4b52dca61a0459c8d3d6 docs/V2_1_5_UI_SERIALIZATION_STABILITY.md a032738b0bc5acb136e92d8bf7694643a5f518b9c7fc0fc878d66d81ba8b1b04 docs/V2_1_6_UNIFIED_UI.md 384e3841603f7c6c8286ef147e93aaf7d056a286503a2a4fc21f397e4dec4876 docs/V34_DRIVING_AUDIO_VALIDATION.md 1840c81b4090ff3c86c0c1b0acc2cc10d3d9839e383c81f262a5c59a67504cd6 docs/V35_HIRES_FIX.md @@ -37,7 +37,7 @@ f0806bb2b999794ddda072e98424dbd1b613df1cd8a096b12d979f124e066d8a docs/VALIDATIO cedd7b07901d6065079ef37380f0062d535a39c98c8f614e1b26582f549d7183 driving_audio.py 6771c9905d35666121c4892d2ec26202505f96d244ce814ad9a87a02878952cd examples/H3_CONTINUUM_V1_WIRING.md f85ba3c69a473f0ac4bb96895c6d6532e8270121da65f858e364b19d31f05ef5 examples/H3_Continuum_V2_3x5s.json -be419d6c773784823af7b58a3423ef2e21d3cc3e23c40e60e274560895ca034b examples/H3_Continuum_V2_README.txt +9d88c187e80ab726afb4dc685dc2ac20039a2c6933f118caa23e2ba8e1c640cd examples/H3_Continuum_V2_README.txt 4b94f779a98bfc555f6999113a694da07746cc3cf400bfc70ebc580592034d52 examples/H3_Continuum_V2_reference.webp c3cefcdf50df9d6609f583a008453b587c011a0fb41e290d5f1196ce62f58877 examples/H3_CONTINUUM_V2_WIRING_JA.md 20f4e7c4ad085791f8b578f575d03e52ef09d0d4550aa58ad086c9857b59bf29 examples/H3_Continuum_V2.json @@ -46,36 +46,36 @@ f67febfdd7b2bfca2ad4e477c87a9a74dbe636231f9db3e1158b944d7b9f8397 examples/H3_Co 5a26408c770381cdb259cb710de7dab12d7ddecca262bdbf35ba1566056050f5 examples/recommended_settings_v2.json b8275c8cecde12aee0418cea456d1e7f4b875cbb1bce32f1f3d9e06a44dd0be1 examples/v2_prompt_list_example.txt 0e59ea821081cb93165aa3f88c6949736dd225837fe1cdcf1173aa5cd54c6d29 examples/v2_prompt_timeline_example.txt -55bc60447d6cd783b9df049d04b6cebb6e4a633981434ac2b28e5a1527d4f4b4 examples/workflows/MiniMax_H3_Continuum_V32_turbo.json -4e410aed8d7f6ebf11c98d4f71571e46855e4619c2bcbec921df70f29189b6b1 examples/workflows/MiniMax_H3_Continuum_V32.json -55bc60447d6cd783b9df049d04b6cebb6e4a633981434ac2b28e5a1527d4f4b4 examples/workflows/MiniMax_H3_Continuum_V33_turbo.json -4e410aed8d7f6ebf11c98d4f71571e46855e4619c2bcbec921df70f29189b6b1 examples/workflows/MiniMax_H3_Continuum_V33.json +c3a6345242c598caa64fafe68a5e304ede59ffe3092ee70a285995110253ad65 examples/workflows/MiniMax_H3_Continuum_V32_turbo.json +f69c9e9075bc3302dd91b1890b79e0e4d8f7b34c46da999bb51d92f81743664c examples/workflows/MiniMax_H3_Continuum_V32.json +c3a6345242c598caa64fafe68a5e304ede59ffe3092ee70a285995110253ad65 examples/workflows/MiniMax_H3_Continuum_V33_turbo.json +f69c9e9075bc3302dd91b1890b79e0e4d8f7b34c46da999bb51d92f81743664c examples/workflows/MiniMax_H3_Continuum_V33.json 5eab33c110e07ec08ac66f289f20c295a90ca026ea5231ad6121755a28a2ded8 examples/workflows/MiniMax_H3_Continuum_V34_turbo.json 660e955c983e41947f5abfd89e66fbe5759ffda01e6c1a7164d580b0c41b2120 examples/workflows/MiniMax_H3_Continuum_V34.json ed31ddd3d0af5e6f8dbd609e5ef51872322dbe52eaad8cae35e16342ac53dbfa examples/workflows/MiniMax_H3_Continuum_V35.json e8f41dee2240f1fcc6e8fd12448856513483ff3ae0427b2c554bb351f9ae8047 graph_contract.py -3d14acac341c63207995e2bd45cd407fdb3e2308273b1c90605adfe6f2e0bd8f hardening.py +79bd878b1c639c8ad77afe972a20810d1060f7903f0ae8ddc31ba22d84777ba1 hardening.py 6abdbc29472c7f9d447085b189fc47b69e110b94ef83192f9689d04000408843 INSTALL_JA.txt 23bddc5a41d2e997f4fbf789c7128e32f4f197f1405b2aef1c76794f57482446 install_windows.bat d74073e7ee292ebeba913af4288284f9f197cd91fceed6c62bf6c66b784c7cec install_windows.ps1 6aa3f5780baa7bb0c0672b5f01a2f77e5f209da93f6373468cb274ea2f643d4b layout_adapter.py -c44abbd789091bbead01250dbd5453e60539d2665c69f162335fdbd2936019c2 LICENSE +15fd1cdc62ffa959b49fd5088bdb1d4b5fa406fa8e420de64603e86458a1a3b8 LICENSE d3e213005670e94dee33a240349a4d245cf9a3b6602099f11ed30cf5a32e2c21 media.py -84cc75b4583a2851e657f3142a1ec4e099091cb7a960be7355e376269e4d3048 metadata.ini +6d9527ba9cf7fa411f46056c93ef662a1800fc0fc7bd2b7a12b9f72e9f81b892 metadata.ini ef705a476e3f5bbd05559e7a0e7d3dfb9275badef0f8f65fb1a36ce27fbcb537 model_patch.py 01ea71240361725972e41746f5a1c4ff90653e6ccc673085f46f427fbf65e4be nodes.py a230cd2f772021a683432e41f7028f6ea628e34dd19f617a3f98c174fdc97d58 PACKAGE_INFO_JA.txt -a7084bc1d12ab25a1ebe29a089dba72d6c1147e0f5556837e6321277562ad1f5 PACKAGE_VALIDATION.txt +59ac121d919a0c372979e4e7d6c8f55b28968d99f44ef26f2dc4490ea172dd0f PACKAGE_VALIDATION.txt b470819f16fc179654dc1600721a63f0a5a14e777f4c004d574b499da6886ba5 public_api.py -16bc48b9ef6127af7e0e3ddd96791640cedf5159cd7c06452d72604f41998a52 pyproject.toml +fe65a21c645b62ce3c03a80ef9146a36e5e30c4d3a715cd4842c2fd1bfb9d95f pyproject.toml 94fdc2d545b2d4077a4d70229fd22ba3ccac21d49d1097d2873f76d04e9a3c7a pytest.ini -3a3ab9f5b9860c4b5478e37e49c06b1b102d49a408c712a25e439b6a557d7071 README_JA.md -dfcaceb3a9ed4784ca0017f864011cc9904c15dc95d5b59dd39d8a429aee28bb README.md +e8d655533351f66268561cd215dff67c00cfab789bb6cf7d4115424c39dfb6d0 README_JA.md +bbb55aec2b7bbbae3ae4a77bffd8defd8966dabecba456930602392504363495 README.md 5d89c366b4f076fa73a2695557e0af749bf95df1dad0d55dbb2fe5b1c2519ad7 reference_audio.py 8f1744dc99f1a3a222b7d6e986f6dac1edcc0abbbe8b61a1d2606b1ca3569b3d reference_video.py -2995924fcb7bac27b548b01187d8276d2ab103c6f43416cf85400de3846c6297 reference.py +f45e2cd438125bbf4730d809118c3c007f742cc719cc458178275da8f6759fca reference.py 467edb2c188d024c2392aafe7423b3f835e16b10f570da76e2f7dda8a962c1c5 requirements.txt -e02b523b5b1c1272c912c16d547050cc9bb9feb6c348743015bb5d059a4ead06 run_storage.py +1c2b36c532552c71712a645a7c8524f09b3afe4179ec2cfbf69f853f1ac2952d run_storage.py 6056de6c0a5322a8a51ba5a114538dca2ef67788cd1afba10fedd483b95f6afa state_io.py 3a359a0467725cc292ccb4c86cf0c3d30bb6a114d01f5345792b09ea3d45441d state.py 43ec4023dc06c941e5d7a04db4b8a89fb58d744ceb986f6eb9bf534d4fdcb87b temporal.py @@ -100,19 +100,20 @@ d4c53d2c260b635d70fa211029d608f63776e0a56c20253475fa47c58363f8a7 tests/test_sta 912661d91c7f11f5fcaf0bd14d7d3ecf5c74c33b1507272f0ae72af6e5bffa6f tests/test_v2_decoder.py 36084a4f37e56786fa82200dad3e13a6a1a1ddde4f4eb5654117a88ef2659b99 tests/test_v2_prompts.py 5dfdd4b108ba7444c0f5f371c3b1e244b5735d23136127b9818fd60738c78b68 tests/test_v2_registration.py -0a520b34b12e1d2556d50480c43318de7eab4221afb96ef4760127c8bc90c890 tests/test_v2_seam.py +273188a69b3d39eb7e190c16c593db440c5427e51435ddfbfe4e1b71f00b414c 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 -0410e2d10af76a83eee0e622d63b8d91662d9516c990aa657a15066e30604f58 tests/test_v217_stable_facade.py -78bc478a5e4edda902c80849c911782a99e75c06dfb04127391b6cc5b27b28e1 tests/test_v3_hardening.py +4e777a8c6456328a96f1647033e1d74e3791559b21852b2523c69ed46acc7ff7 tests/test_v217_stable_facade.py +7c81dd04af121e07fd63bac8e9f83c328219dc95c4939c021d75927c47cd3458 tests/test_v3_hardening.py eb5b27f8f0d79529c56ef344a5601703642c3cba5388c9768116223e2ed58a36 tests/test_v3_video_seam.py -eec67e2daddbbe4f5933a3ac0dd9c3188f750081d377b7d08fd6d5a02ff4a529 tests/test_v31_run_storage.py -3af78ab85c8e19dee8d0a98bfd11a2c0e88c30d87256da1f9699c49a19a684e9 tests/test_v32_reference.py +8747b9abfa58a1bdc2381c9c86628c2c44321071a79de63a5a46a13c7c5deeb8 tests/test_v31_run_storage.py +d66489f9ead30686ee82a4e1f24a7d7c4a36f835678812e1fca58f3bbf46ecaf tests/test_v32_reference.py f692476d0a7795b36bc5d9b97c10b7c6ba9686122b8f7987629948141e5dbab3 tests/test_v34_driving_audio.py +7fd13dd3e969b623f525e38753252b179d55988b8fb794326137899d1fe7c6b6 tests/test_v351_reference_audio.py 8b75c23dccfd1ac302596187f2fbbd1c9b71fddcb5e666aa4f9eedfd8b5b4b93 tests/test_v35_compact_ui_frontend.py -c5a122cb9510320820f6057fc29e6bef4b42e19f141d4d9090c817702e7d151e tests/test_v35_context_sampler.py +b7267778fd1e77bd12d7c6e71c200fd0a4367cd8ae3276823ddeba16e015cfa6 tests/test_v35_context_sampler.py c97d1323fa3d66c28dd1974340dbc17a3e6d5a79d4a5206b82d48bfb1a14b4ce tests/test_v35_hires_fix.py 9ceac8c3c6e4e57ec8b53b48f3b547c204df36a3f6281328aa9ab5ebc2e6a0b6 tests/test_v35_latent_resize.py 59a07f2172014dfdc0a447775324d7cd049f20b823276dfaf9b7b3f79628f5a8 tests/test_v35_pixel_vae_resize.py @@ -128,33 +129,33 @@ ffd61f3f31c9b6430e1169007ee906c8f5000eba63ee44e2976ad4f5f1112671 v2/__init__.py 2003902c87bba09cfa143f5a9e4248f3a78c0fb544449a75fd40ba2cacb35655 v2/context_diagnostics.py cde27db19b677e318cc4dfb4235be7a11429c19945f4083052a91fe117e74c82 v2/decoder.py 31012ec48a64c7467ad869c79982b7f8502c1785c33f51ee1b5727ce8b4243fb v2/diagnostics.py -87b054be8754ebfcd85e106a7b221604611d3bf05de03380565ee3562d1c823b v2/h3_builder.py +20b8132fb231c5b8ce61da2c1fbad310c22f332d66926a706523009deed54f65 v2/h3_builder.py aea01a48a8c03a25ed97ea05e5b137f89e388832d1be7d38f2da2be3d1b9830b v2/motion.py -080e9d597e2586eb88c448c7db32b9e3661f5d21a4c270f163696966ffa6c7e0 v2/nodes.py +a8432732548ae9521ee445a017e1d6d7f65b0e7bb120a89d6cfe1c18834f377c v2/nodes.py 3c2145d47924b53f8f6ec50806f1b7113120ac314142d8b7809c4f2064ad6aef v2/prompts.py 4080f1875b958b316e8e76852c4be5527a6de5c71d604e7642d3098478eb4a36 v2/sampling.py 2fd811794c4cc0f2ce050250b80484876454926b9f20fce6af3a97d728e5acdf v2/seam_guard.py be0d8585fa57e0ccd6d02577bbc7299629e5bfe20e186747f571fccc98b67d7e v2/seam_types.py 12cfcc0c71ca087fe39a5ce2922959a62b2bb311bfe664f05c4480affce03708 v2/seeds.py -e6c15105fe66b9d7786602c8e6d51dd256428d80635cee686b0e35d66ab3b794 v2/sequence.py +e1fa369acf61e17d25e7dfe24eb84a4a44dda1622f85a5f2e2b04210f1f38c85 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 -1465a4cd53e4a90788c7cdbbbef5f7bc0dee2a8be04cc4c707863837077d9a47 v3/driving_nodes.py +30e5ef19e182a288b21b76f644188cdb0763c367c8f468fad056bae65bc32f89 v3/assembly.py +5af29b8247319dbb5321c711318ead2e75baf12bd26d1460bb8a4c58f8e631c8 v3/driving_nodes.py 6cc7ed74666084c55beb9075304e92a9defafd81b9c6678239ca3859a08cddd7 v3/file_backed_buffer.py 897343a4845f4ed59828bbfcfb16a22fcfce2c22907548bb3234c98dabcefff6 v3/hires_fix_nodes.py 0858487e2b8c0060a856273ffc65d23165b2f253d183f506e27e419aea0da561 v3/latent_resize_nodes.py 45bd1945b984b56369234053be2edb8455d4cff7bf976f7d9c7bef77a762b7eb v3/memory_attribution.py -f8708118f70fa2aae22951e025ed3b9499951088988c817c28f6ef7f388f2570 v3/nodes.py +5bfa482eaae3fdc04601c6bd6ea41c175632b581f7a3e0dc80ff408cae275b0f v3/nodes.py b7c4a35a5e73f528492bc6946b97b687c412f1d3f5f976c19d45c6dc20288c9a v3/pixel_vae_resize.py -34ea38c03b6322288d88fc8595e3655a7a7afddb51709142a954eb7349f71ac2 v3/plan.py +60ac543e3a5ae9029ff2eeb5c91b72280869acdf3ee4808676650f213b3438c6 v3/plan.py 10eaab14eb8a70dea3345bf8bb20069d78ec5464aef5542a9a80f1ccfdeeb9b0 v3/refine_context.py 519586b1b3f48c73d329f7a2aaa8a1bfc6fe31ac2ecb64f2b1fdf9c19026001a v3/refine_sampling.py da5edf3b4392c41e12ef73a0cd21799be42a327b18bd5a6989447b75163dcab1 v3/second_pass_nodes.py 998d002c73c59ce88de1cf72afbb5f481a57cc31d365ba2fb4889ebf405dedc8 v3/second_pass.py 4178dcfa442abdb06ce276e05bd7bcbaa6da28469ba5e57d3da3c663de4e4a9d v3/video_seam_v35.py -2f07ace1462644f0bee553827b3571535de4d0c2d9ef847bd9e0ca73a4eed5cb v3/video_seam.py -343bf84d768b93a59c8a418635bcad4133961431c9c6f7975d7d65b0fac25eb4 version.py -ea79af984eb7d615f0d79384c8b505442af2b00cf7babfd53e82da2733927bcc web/project_id.js +f8824d6c9280b0af7723722e06a78c2ce84faa1da1a9ee2e41ee4b03cfda8d37 v3/video_seam.py +52173490b708846a794b625befde12952daf8aa070f762b2713aa8bfe660ebc8 version.py +760f4a77128b80107477a475d2ae0e5440475ff3095d9653ad7249c9a534daaa web/project_id.js diff --git a/tests/test_v31_run_storage.py b/tests/test_v31_run_storage.py index ef0e0c8..73e25b6 100644 --- a/tests/test_v31_run_storage.py +++ b/tests/test_v31_run_storage.py @@ -277,6 +277,15 @@ class _VideoVAE: self.upscale_ratio = 16 +class _AudioVAE: + def __init__(self): + self.first_stage_model = torch.nn.Linear(2, 2) + self.patcher = _Patcher(self.first_stage_model) + self.vae_dtype = torch.float32 + self.audio_sample_rate = 32000 + self.latent_channels = 32 + + def _sampling_contract( *, model=None, clip=None, video_vae=None, sampler=None, reroll_nonce=0, conditioning_mode="i2va", first_frame_hash="a" * 64, @@ -284,6 +293,8 @@ def _sampling_contract( upstream_graph_contract=None, upstream_graph_safe=None, upstream_graph_reasons=None, execution_semantics=None, + reference_audio_contract=None, + reference_audio_vae=None, ): return build_sampling_contract( model=model or _Model(), @@ -314,9 +325,63 @@ def _sampling_contract( upstream_graph_safe=upstream_graph_safe, upstream_graph_reasons=upstream_graph_reasons, execution_semantics=execution_semantics, + reference_audio_contract=reference_audio_contract, + reference_audio_vae=reference_audio_vae, ) +def test_reference_audio_revision_separates_changes_and_restores_on_disconnect(): + model = _Model() + clip = _Clip() + sampler = _Sampler() + audio_vae = _AudioVAE() + common = { + "model": model, + "clip": clip, + "sampler": sampler, + "conditioning_mode": "t2va", + "first_frame_hash": "", + } + disconnected, safe, reasons = _sampling_contract( + **common, + reference_audio_vae=audio_vae, + ) + assert safe, reasons + assert "reference_audio" not in disconnected["global"] + assert "reference_audio_vae" not in disconnected["global"] + + first_contract = { + "reference_audio_contract_version": 1, + "source_sha256": "a" * 64, + "resolved_vae_sample_rate": 32000, + } + first, safe, reasons = _sampling_contract( + **common, + reference_audio_contract=first_contract, + reference_audio_vae=audio_vae, + ) + assert safe, reasons + assert first["global"]["reference_audio"] == first_contract + assert "reference_audio_vae" in first["global"] + + changed_contract = dict(first_contract, source_sha256="b" * 64) + changed, safe, reasons = _sampling_contract( + **common, + reference_audio_contract=changed_contract, + reference_audio_vae=audio_vae, + ) + assert safe, reasons + restored, safe, reasons = _sampling_contract( + **common, + reference_audio_vae=audio_vae, + ) + assert safe, reasons + + assert revision_identity(disconnected) != revision_identity(first) + assert revision_identity(first) != revision_identity(changed) + assert revision_identity(restored) == revision_identity(disconnected) + + def test_terminal_seed_v2_revision_is_scoped_and_distinct(): old_contract, old_safe, old_reasons = _sampling_contract( conditioning_mode="fl2va", diff --git a/tests/test_v351_reference_audio.py b/tests/test_v351_reference_audio.py new file mode 100644 index 0000000..44a6c78 --- /dev/null +++ b/tests/test_v351_reference_audio.py @@ -0,0 +1,154 @@ +from __future__ import annotations + +import inspect +import json +from pathlib import Path + +import pytest +import torch + +from ComfyUI_H3_Continuum_Join.reference_audio import ( + ReferenceAudioError, + prepare_reference_audio_source, +) +from ComfyUI_H3_Continuum_Join.run_storage import automatic_project_key +from ComfyUI_H3_Continuum_Join.v3 import driving_nodes +from ComfyUI_H3_Continuum_Join.v3.driving_nodes import ( + H3ContinuumSamplerV34, + H3ContinuumSamplerV35, +) +from ComfyUI_H3_Continuum_Join.v3.nodes import H3ContinuumSamplerProduction + + +ROOT = Path(__file__).resolve().parents[1] + + +def test_v35_appends_reference_audio_sockets_without_changing_v34_schema(): + v34_optional = H3ContinuumSamplerV34.INPUT_TYPES()["optional"] + v35_optional = H3ContinuumSamplerV35.INPUT_TYPES()["optional"] + + assert "reference_audio_1" not in v34_optional + assert "reference_audio_vae" not in v34_optional + assert list(v35_optional)[:-2] == list(v34_optional) + assert list(v35_optional)[-2:] == ["reference_audio_1", "reference_audio_vae"] + assert v35_optional["reference_audio_1"][0] == "AUDIO" + assert v35_optional["reference_audio_1"][1]["display_name"] == ( + "Reference Audio" + ) + assert v35_optional["reference_audio_vae"][0] == "VAE" + assert v35_optional["reference_audio_vae"][1]["display_name"] == ( + "Reference Audio VAE" + ) + assert "Driving Audio" in v35_optional["reference_audio_1"][1]["tooltip"] + + +def test_v34_internal_reference_audio_parameters_are_appended_and_forwarded( + monkeypatch, +): + parameters = list(inspect.signature(H3ContinuumSamplerV34.run).parameters) + assert parameters[-4:] == [ + "capture_refine_context", + "reference_audio_1", + "reference_audio_vae", + "kwargs", + ] + + captured = {} + reference_audio = object() + reference_audio_vae = object() + + monkeypatch.setattr( + driving_nodes, + "prepare_driving_audio_source", + lambda *_args, **_kwargs: None, + ) + monkeypatch.setattr( + "ComfyUI_H3_Continuum_Join.reference_video.prepare_reference_video_source", + lambda *_args, **_kwargs: None, + ) + + def production_run(_self, **kwargs): + captured.update(kwargs) + return [], [], {}, "status" + + monkeypatch.setattr(H3ContinuumSamplerProduction, "run", production_run) + outputs = H3ContinuumSamplerV34().run( + reference_audio_1=reference_audio, + reference_audio_vae=reference_audio_vae, + chunks=1, + chunk_seconds=5.0, + width=640, + height=640, + ) + + assert captured["reference_audio_1"] is reference_audio + assert captured["reference_audio_vae"] is reference_audio_vae + assert outputs[-1] is None + + +def test_v35_run_forwards_reference_audio_without_duplicate_preparation(monkeypatch): + captured = {} + reference_audio = object() + reference_audio_vae = object() + + def v34_run(_self, *args, **kwargs): + captured.update(kwargs) + return [], [], {}, "status", None, {"groups": ()} + + monkeypatch.setattr(H3ContinuumSamplerV34, "run", v34_run) + H3ContinuumSamplerV35().run( + reference_audio_1=reference_audio, + reference_audio_vae=reference_audio_vae, + ) + + assert captured["reference_audio_1"] is reference_audio + assert captured["reference_audio_vae"] is reference_audio_vae + assert captured["capture_refine_context"] is True + assert captured["memory_attribution"] is True + + +def test_reference_audio_vae_is_ignored_without_audio_and_required_with_audio(): + vae = object() + assert prepare_reference_audio_source(None, vae) is None + audio = { + "waveform": torch.zeros((1, 2, 32000), dtype=torch.float32), + "sample_rate": 32000, + } + with pytest.raises(ReferenceAudioError, match="reference_audio_vae is required"): + prepare_reference_audio_source(audio, None) + + +def test_unused_reference_audio_vae_does_not_change_automatic_project_key(): + base = { + "1": {"class_type": "H3ContinuumSamplerV35", "inputs": {}}, + "2": {"class_type": "VAELoader", "inputs": {}}, + } + vae_only = { + **base, + "1": { + "class_type": "H3ContinuumSamplerV35", + "inputs": {"reference_audio_vae": ["2", 0]}, + }, + } + assert automatic_project_key(base, "1") == automatic_project_key(vae_only, "1") + + +def test_published_v35_template_keeps_existing_sampler_socket_routes(): + template = ROOT / "examples/workflows/MiniMax_H3_Continuum_V35.json" + if not template.exists(): + pytest.skip("published workflow template is not installed in this runtime copy") + workflow = json.loads( + template.read_text(encoding="utf-8") + ) + sampler = next( + node for node in workflow["nodes"] if node["type"] == "H3ContinuumSamplerV35" + ) + routes = {item["name"]: item.get("link") for item in sampler["inputs"]} + assert routes["reference_image_1"] == 321 + assert routes["reference_image_2"] == 320 + assert routes["reference_image_3"] == 318 + assert routes["reference_video_1"] == 322 + assert routes["driving_audio"] == 294 + assert routes["audio_vae"] == 295 + assert "reference_audio_1" not in routes + assert "reference_audio_vae" not in routes diff --git a/tests/test_v35_context_sampler.py b/tests/test_v35_context_sampler.py index de521ad..f23ece9 100644 --- a/tests/test_v35_context_sampler.py +++ b/tests/test_v35_context_sampler.py @@ -69,6 +69,7 @@ def _capture_sequence( monkeypatch, *, terminal: bool, + reference_audio: bool = False, session=None, diagnostics=DIAGNOSTICS_BASIC, memory_attribution=False, @@ -101,6 +102,27 @@ def _capture_sequence( "clone_model_for_chunk", lambda model, **_kwargs: model, ) + reference_audio_source = None + reference_audio_vae = None + if reference_audio: + from ComfyUI_H3_Continuum_Join import reference_audio as reference_audio_module + + reference_audio_source = SimpleNamespace( + combined_hash="reference-audio-hash", + contract={ + "reference_audio_contract_version": 1, + "source_sha256": "a" * 64, + }, + ) + reference_audio_vae = object() + reference_audio_assets = SimpleNamespace( + audio_latent=torch.arange(64, dtype=torch.float32).reshape(1, 32, 2, 1) + ) + monkeypatch.setattr( + reference_audio_module, + "encode_reference_audio", + lambda _vae, _source: reference_audio_assets, + ) chunks = 3 if terminal else 2 mode = PROMPT_MODE_LIST if terminal else PROMPT_MODE_FIXED script = "first\n---\nmiddle\n---\nlast" if terminal else "same prompt" @@ -133,6 +155,8 @@ def _capture_sequence( debug=False, session=session, latent_only=True, + reference_audio_source=reference_audio_source, + reference_audio_vae=reference_audio_vae, capture_refine_context=True, memory_attribution=memory_attribution, ) @@ -275,6 +299,33 @@ def test_capture_records_terminal_pair_as_one_physical_group(monkeypatch): assert validate_refine_context(context, assembly_plan) is context +def test_reference_audio_is_captured_in_every_normal_physical_group(monkeypatch): + outputs = _capture_sequence( + monkeypatch, + terminal=False, + reference_audio=True, + ) + 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].count("audio") == 1 + + +def test_reference_audio_is_captured_in_terminal_physical_group(monkeypatch): + outputs = _capture_sequence( + monkeypatch, + terminal=True, + reference_audio=True, + ) + 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].count("audio") == 1 + + def test_reused_session_returns_incomplete_context_without_stopping(monkeypatch): first_outputs = _capture_sequence(monkeypatch, terminal=False) reused_outputs = _capture_sequence( diff --git a/v3/driving_nodes.py b/v3/driving_nodes.py index 8395265..c9279a9 100644 --- a/v3/driving_nodes.py +++ b/v3/driving_nodes.py @@ -151,6 +151,8 @@ class H3ContinuumSamplerV34(H3ContinuumSamplerProduction): reference_video_1=None, video_reference_size=REFERENCE_VIDEO_SIZE_EFFICIENT, capture_refine_context=False, + reference_audio_1=None, + reference_audio_vae=None, **kwargs, ): from ..reference_video import prepare_reference_video_source @@ -175,8 +177,8 @@ class H3ContinuumSamplerV34(H3ContinuumSamplerProduction): size_mode=str(video_reference_size), ) outputs = super().run( - reference_audio_1=None, - reference_audio_vae=None, + reference_audio_1=reference_audio_1, + reference_audio_vae=reference_audio_vae, driving_audio_source=source, driving_audio_vae=audio_vae, reference_video_source=reference_video_source, @@ -217,6 +219,33 @@ class H3ContinuumSamplerV35(H3ContinuumSamplerV34): ) OUTPUT_IS_LIST = (*H3ContinuumSamplerV34.OUTPUT_IS_LIST, False) + @classmethod + def INPUT_TYPES(cls): + schema = super().INPUT_TYPES() + optional = dict(schema.get("optional", {})) + optional["reference_audio_1"] = ( + "AUDIO", + { + "display_name": "Reference Audio", + "tooltip": ( + "Optional standalone audio reference for H3 conditioning. " + "Unlike Driving Audio, it does not replace the generated final audio." + ), + }, + ) + optional["reference_audio_vae"] = ( + "VAE", + { + "display_name": "Reference Audio VAE", + "tooltip": ( + "Required only when Reference Audio is connected. It encodes the " + "reference for H3 conditioning; generated audio remains the output." + ), + }, + ) + schema["optional"] = optional + return schema + def run(self, *args, **kwargs): kwargs.pop("capture_refine_context", None) kwargs.pop("memory_attribution", None)