Skip to content

Fix weight_norm parametrizations skipped in _load_list causing stable audio partial-load failure#13443

Open
octo-patch wants to merge 1 commit intoComfy-Org:masterfrom
octo-patch:fix/issue-11855-weight-norm-partial-loading
Open

Fix weight_norm parametrizations skipped in _load_list causing stable audio partial-load failure#13443
octo-patch wants to merge 1 commit intoComfy-Org:masterfrom
octo-patch:fix/issue-11855-weight-norm-partial-loading

Conversation

@octo-patch
Copy link
Copy Markdown

Summary

  • _load_list() in model_patcher.py incorrectly sets default = True (treating a module as having random weights in child sub-modules) when a module uses torch.nn.utils.parametrizations.weight_norm
  • weight_norm moves the actual weight into a parametrizations child sub-module as original0/original1, so named_parameters(recurse=True) yields parametrizations.weight.original0 while named_parameters(recurse=False) does not — triggering the false-positive check
  • This causes weight-normed modules to be excluded from the partial-load list entirely, so their parameters are never moved to GPU during low-VRAM loading
  • AudioOobleckVAE (Stable Audio) had a disable_offload = True workaround that forced full GPU load to paper over this bug; with the root cause fixed, the workaround is removed so the model can use partial VRAM offloading on low-memory systems

Fix

Skip parametrizations.* parameter names in the _load_list() non-leaf check:

# Before
if name not in params:
    default = True  # default random weights in non leaf modules
    break

# After
if name not in params and not name.startswith("parametrizations."):
    default = True  # default random weights in non leaf modules
    break

Test plan

  • Load a Stable Audio model on a system with limited VRAM (--lowvram or --novram) and confirm it generates audio without error
  • Confirm the fix does not affect regular (non-weight-normed) models that correctly have child sub-modules with random weights

Closes #11855

…in _load_list

When a module uses torch.nn.utils.parametrizations.weight_norm, its weight
parameter is moved into a 'parametrizations' child sub-module as original0/original1.
named_parameters(recurse=True) yields 'parametrizations.weight.original0' while
named_parameters(recurse=False) does not, causing _load_list() to incorrectly
classify the module as having random weights in non-leaf sub-modules and skipping
it during partial VRAM loading.

The fix skips 'parametrizations.*' entries in the check, so weight-normed modules
are correctly included in the load list and their parameters moved to GPU as needed.

The AudioOobleckVAE (Stable Audio) had a disable_offload=True workaround that
forced full GPU load to avoid this bug. With the root cause fixed, that workaround
is no longer necessary and is removed, allowing partial VRAM offloading on systems
with limited GPU memory.

Fixes Comfy-Org#11855
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 17, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0cfe6d56-fc0b-4fd0-9823-13e6279287a9

📥 Commits

Reviewing files that changed from the base of the PR and between 1391579 and 7c1ec4a.

📒 Files selected for processing (2)
  • comfy/model_patcher.py
  • comfy/sd.py
💤 Files with no reviewable changes (1)
  • comfy/sd.py

📝 Walkthrough

Walkthrough

This pull request contains two internal implementation adjustments. First, in the model patcher's weight-loading logic, parameter names beginning with "parametrizations." are now excluded from the default random weight handling for non-leaf modules. Second, the VAE initialization code no longer sets the disable_offload flag to True when AudioOobleckVAE weights are detected. Both changes are internal to their respective modules with no modifications to public APIs.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title directly describes the main fix: correcting the _load_list() logic to handle weight_norm parametrizations and resolving the Stable Audio partial-load failure.
Description check ✅ Passed The description is comprehensive and directly related to the changeset, explaining the root cause, the fix, and the removal of the workaround.
Linked Issues check ✅ Passed The PR fully addresses issue #11855 by fixing the _load_list() non-leaf check to skip parametrizations.* names [#11855] and removing the AudioOobleckVAE disable_offload workaround.
Out of Scope Changes check ✅ Passed All changes are scoped to the linked issue: fixing the parametrizations check in model_patcher.py and removing the workaround in sd.py as documented in the PR objectives.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stable audio broken with partial loading (indicative of slightly bigger bug)

1 participant