SeedVR2 native: drop disk-load prompt embeddings, restore checkpoint buffer access#53
Closed
pollockjj wants to merge 1 commit into
Closed
SeedVR2 native: drop disk-load prompt embeddings, restore checkpoint buffer access#53pollockjj wants to merge 1 commit into
pollockjj wants to merge 1 commit into
Conversation
…buffer access PR #51 introduced _load_seedvr2_prompt_embed[s] + _SEEDVR2_PROMPT_EMBED_CANDIDATES which made comfy_extras/nodes_seedvr.py:SeedVR2Conditioning load pos_emb.pt / neg_emb.pt from one of four search paths inside the numz and canonical custom_node directories. That made the native SeedVR2 pipeline silently dependent on third-party custom_nodes being present on disk. Yusef's upstream PR (Comfy-Org#11294) reads model.positive_conditioning and model.negative_conditioning as buffers. The official seedvr2_3b_fp16vae.safetensors checkpoint ships both buffers (positive 58x5120 bf16, negative 64x5120 bf16). Direct buffer access removes the filesystem dependency. Changes: comfy_extras/nodes_seedvr.py - Remove import folder_paths. - Remove _SEEDVR2_PROMPT_EMBED_CANDIDATES table. - Remove _load_seedvr2_prompt_embed and _load_seedvr2_prompt_embeds. - SeedVR2Conditioning.execute reads pos_cond and neg_cond off model directly. tests-unit/comfy_extras_test/test_seedvr_conditioning_hardening.py - Drop the four _load_seedvr2_prompt_embed* unit tests (lines 337-528). - test_seedvr2_conditioning_disables_cfg1_optimization no longer monkeypatches _load_seedvr2_prompt_embeds (the test fixture _DiffusionModel already registers buffers via register_buffer). tests-unit/comfy_extras_test/test_seedvr_input_processing_temporal_overlap.py tests-unit/comfy_extras_test/test_seedvr_temporal_overlap.py - Add parameters() to _FakeFirstStage to satisfy tiled_vae's next(vae_model.parameters()).dtype call. - Patch nodes_seedvr.tiled_vae to capture encode kwargs (the dispatch site moved off vae.encode_tiled in PR #51). Verification: 94 passed, 0 failed across the seedvr2 test surface; ruff clean. Tracking: pollockjj/mydevelopment#224
There was a problem hiding this comment.
Pull request overview
Removes SeedVR2’s on-disk prompt-embedding lookup from SeedVR2Conditioning and restores the native behavior of reading positive/negative conditioning directly from buffers registered on the diffusion model, eliminating an implicit dependency on third-party custom_nodes packs.
Changes:
- Drop
folder_paths-based prompt-embedding search and disk loading helpers incomfy_extras/nodes_seedvr.py. - Update
SeedVR2Conditioning.executeto usemodel.positive_conditioning/model.negative_conditioningbuffers. - Adjust SeedVR2 temporal-overlap tests to reflect the
tiled_vae(..., encode=True)encode dispatch and add minimal stubs needed by the refactor.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
comfy_extras/nodes_seedvr.py |
Removes filesystem dependency for prompt embeddings; uses model buffers for SeedVR2 conditioning. |
tests-unit/comfy_extras_test/test_seedvr_conditioning_hardening.py |
Removes tests for deleted disk-load helpers; keeps CFG=1 optimization-disable test aligned with buffer-based conditioning. |
tests-unit/comfy_extras_test/test_seedvr_temporal_overlap.py |
Updates mocks to intercept tiled_vae encode dispatch; adds parameters() stub for VAE wrapper behavior. |
tests-unit/comfy_extras_test/test_seedvr_input_processing_temporal_overlap.py |
Same as above for the parallel temporal-overlap wiring test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
314
to
+318
| model_patcher = model | ||
| model = _resolve_seedvr2_diffusion_model(model_patcher) | ||
| model_patcher.disable_model_cfg1_optimization() | ||
| pos_cond, neg_cond = _load_seedvr2_prompt_embeds(device, model.positive_conditioning.dtype) | ||
| pos_cond = model.positive_conditioning | ||
| neg_cond = model.negative_conditioning |
| assert captured["encode_tiled"]["tile_t"] == 16 | ||
| assert captured["encode_tiled"]["overlap_t"] == 4 | ||
| assert captured["tiled_vae"]["temporal_size"] == 16 | ||
| assert captured["tiled_vae"]["encode"] is True |
| assert captured["encode_tiled"]["tile_t"] == 16 | ||
| assert captured["encode_tiled"]["overlap_t"] == 4 | ||
| assert captured["tiled_vae"]["temporal_size"] == 16 | ||
| assert captured["tiled_vae"]["encode"] is True |
Owner
Author
|
Closing per direction: PR scope creep. Will resubmit with only the disk-load reversion (nodes_seedvr.py + test_seedvr_conditioning_hardening.py deletions). The temporal_overlap test edits in this PR don't belong in a reversion. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR #51 (merged into
issue_101) introduced_load_seedvr2_prompt_embed[s]and_SEEDVR2_PROMPT_EMBED_CANDIDATESincomfy_extras/nodes_seedvr.py, makingSeedVR2Conditioning.executeloadpos_emb.pt/neg_emb.ptfrom one of four search paths viafolder_paths.get_full_path:The native SeedVR2 pipeline was silently dependent on third-party custom_nodes being present on disk. Disabling the numz pack made
SeedVR2ConditioningraiseFileNotFoundError.This PR removes that dependency by restoring Yusef's upstream pattern: read
model.positive_conditioningandmodel.negative_conditioningdirectly off the diffusion model.Why this works
The official
seedvr2_3b_fp16vae.safetensorscheckpoint bundles both prompt embeddings as model-level buffers:comfy/ldm/seedvr/model.pyalready registers both buffers in the diffusion model viaregister_buffer. The state-dict load populates them. Yusef's upstream PR (Comfy-Org#11294) reads them directly offmodel— no filesystem lookup, no custom-node dependency.Changes
comfy_extras/nodes_seedvr.pyimport folder_paths._SEEDVR2_PROMPT_EMBED_CANDIDATES._load_seedvr2_prompt_embedand_load_seedvr2_prompt_embeds.SeedVR2Conditioning.executereadspos_cond = model.positive_conditioningandneg_cond = model.negative_conditioning.The
disable_model_cfg1_optimization()call (also added by PR #51) is preserved — that part of PR #51 is correct (the SeedVR2 DiT requires the[neg, pos]chunk concat that Comfy's CFG=1 short-circuit otherwise strips).tests-unit/comfy_extras_test/test_seedvr_conditioning_hardening.py_load_seedvr2_prompt_embed*unit tests (lines 337-528).test_seedvr2_conditioning_disables_cfg1_optimizationno longer monkey-patches_load_seedvr2_prompt_embeds— the existing_DiffusionModeltest fixture already registers the conditioning buffers viaregister_buffer, which is exactly the contractSeedVR2Conditioning.executeconsumes post-revert.tests-unit/comfy_extras_test/test_seedvr_input_processing_temporal_overlap.py+test_seedvr_temporal_overlap.pyparameters()to_FakeFirstStageto satisfytiled_vae'snext(vae_model.parameters()).dtypecall (introduced by PR SeedVR2 native encode + conditioning (companion to PR #50) #51's encode dispatch refactor).nodes_seedvr.tiled_vaeto capture encode kwargs; the dispatch site moved offvae.encode_tiledin PR SeedVR2 native encode + conditioning (companion to PR #50) #51, so the old mock no longer fires.Net diff
4 files changed, 20 insertions(+), 256 deletions(-)Verification
ruff checkclean on all four files.comfy/ldm/seedvr/,comfy_extras/nodes_seedvr.py, related VAE wrappers, RoPE delegation, and conditioning hardening).Test plan
_load_seedvr2_prompt_embed,_load_seedvr2_prompt_embeds,_SEEDVR2_PROMPT_EMBED_CANDIDATES,import folder_paths) absent fromcomfy_extras/nodes_seedvr.pypost-merge.SeedVR2Conditioning.executereads buffers directly from the resolved diffusion model.test_seedvr2_conditioning_disables_cfg1_optimizationpasses without the_load_seedvr2_prompt_embedsmonkeypatch.Linked