SeedVR2 native: drop disk-load prompt embeddings, restore checkpoint buffer access#54
Merged
Merged
Conversation
…buffer access PR #51 introduced _load_seedvr2_prompt_embed[s] and _SEEDVR2_PROMPT_EMBED_CANDIDATES, making SeedVR2Conditioning load pos_emb.pt / neg_emb.pt from one of four search paths inside the numz and canonical custom_node directories via folder_paths.get_full_path. Native inference became 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). This PR restores that path. Pure reversion. Deletions only across two files. comfy_extras/nodes_seedvr.py - Remove import folder_paths. - Remove _SEEDVR2_PROMPT_EMBED_CANDIDATES. - 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 - Remove the four _load_seedvr2_prompt_embed* unit tests. - Remove the _load_seedvr2_prompt_embeds monkey-patch line in test_seedvr2_conditioning_disables_cfg1_optimization (the existing _DiffusionModel test fixture already register_buffers the conditioning, which is exactly the contract the reverted execute path consumes). Tracking: pollockjj/mydevelopment#224
There was a problem hiding this comment.
Pull request overview
Reverts SeedVR2 conditioning to use prompt-embedding buffers shipped inside the SeedVR2 diffusion checkpoint, removing the runtime dependency on on-disk pos_emb.pt / neg_emb.pt files (and third-party custom_nodes search paths). This restores the native/upstream behavior described in the PR metadata.
Changes:
- Remove filesystem-based prompt embedding discovery/loading helpers from
comfy_extras/nodes_seedvr.py. - Update
SeedVR2Conditioning.executeto readmodel.positive_conditioning/model.negative_conditioningdirectly. - Remove unit tests that were specific to the deleted disk-load helpers and simplify the remaining conditioning hardening test accordingly.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
comfy_extras/nodes_seedvr.py |
Removes disk-based prompt embedding loading and switches conditioning to model-provided buffers. |
tests-unit/comfy_extras_test/test_seedvr_conditioning_hardening.py |
Deletes tests for removed loader helpers and updates the remaining conditioning test to use the model fixture’s registered buffers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+317
to
+318
| pos_cond = model.positive_conditioning | ||
| neg_cond = model.negative_conditioning |
Comment on lines
314
to
319
| 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 | ||
|
|
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
Pure reversion. PR #51 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— three of which point inside the numz and canonical custom_node directories. Native SeedVR2 inference became silently dependent on third-party custom_nodes being present on disk; disabling the numz pack made the node raiseFileNotFoundError.This PR removes that contamination and restores Yusef's upstream pattern: read
model.positive_conditioningandmodel.negative_conditioningdirectly off the diffusion model. The officialseedvr2_3b_fp16vae.safetensorscheckpoint ships both as model-level buffers (positive 58×5120 bf16, negative 64×5120 bf16, registered incomfy/ldm/seedvr/model.pyand populated by the state-dict load).Net diff
2 files changed, 2 insertions(+), 243 deletions(-)Deletions only.
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.tests-unit/comfy_extras_test/test_seedvr_conditioning_hardening.py_load_seedvr2_prompt_embed*unit tests._load_seedvr2_prompt_embedsmonkey-patch line intest_seedvr2_conditioning_disables_cfg1_optimization. The existing_DiffusionModeltest fixture already registerspositive_conditioningandnegative_conditioningviaregister_buffer, which is exactly the contract the reverted execute path consumes.Linked