Fix weight_norm parametrizations skipped in _load_list causing stable audio partial-load failure#13443
Conversation
…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
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughThis pull request contains two internal implementation adjustments. First, in the model patcher's weight-loading logic, parameter names beginning with 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ 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. Comment |
Summary
_load_list()inmodel_patcher.pyincorrectly setsdefault = True(treating a module as having random weights in child sub-modules) when a module usestorch.nn.utils.parametrizations.weight_normweight_normmoves the actual weight into aparametrizationschild sub-module asoriginal0/original1, sonamed_parameters(recurse=True)yieldsparametrizations.weight.original0whilenamed_parameters(recurse=False)does not — triggering the false-positive checkAudioOobleckVAE(Stable Audio) had adisable_offload = Trueworkaround 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 systemsFix
Skip
parametrizations.*parameter names in the_load_list()non-leaf check:Test plan
--lowvramor--novram) and confirm it generates audio without errorCloses #11855