Skip to content

Ensure force_patch_weights is set when partially loading/unloading models - #469

Open
blepping wants to merge 1 commit into
city96:mainfrom
blepping:fix_partially_load_unload
Open

Ensure force_patch_weights is set when partially loading/unloading models#469
blepping wants to merge 1 commit into
city96:mainfrom
blepping:fix_partially_load_unload

Conversation

@blepping

Copy link
Copy Markdown
Contributor

The custom GGUFModelPatcher sets force_patch_weights to the load method so ComfyUI won't try to create low-VRAM patches for LoRAs, etc. However, it doesn't set that parameter for the partial load/unload methods (which default to force_patch_weights=False). This results in ComfyUI trying to create model weight functions to apply the LoRAs.

With the way the ops and patcher are set up in the official repo, those weight functions get ignored. However, we can skip the overhead of having ComfyUI create patches that are never going to get applied. You can confirm that ComfyUI is creating those weight functions that will never be applied since the log output dumps the low-VRAM patch count when the model gets loaded.

@blepping
blepping force-pushed the fix_partially_load_unload branch from e913a8a to 3b4b1ad Compare July 26, 2026 19:48
ChrisColeTech added a commit to ChrisColeTech/ComfyUI-GGUF-Loader that referenced this pull request Aug 12, 2026
Cherry-pick production fixes from city96/ComfyUI-GGUF open PRs:
- city96#472 dequant device-constant cache (major LTX/sampling speedup)
- city96#433 IQ1/IQ2/IQ3 torch dequant (extra TE quants)
- city96#470 QK-norm .scale→.weight (silent NaN/black Flux-compat)
- city96#467 dequant bare nn.Parameters (LTX learnable_registers)
- city96#392 lumina2/zimage pad token shape fix
- city96#456/city96#468 GGMLTensor dtype + dequantize() for core cast path
- city96#461 WeightAdapter-aware move_patch_to_device
- city96#469 force_patch on partial load/unload
- city96#440/city96#436 mistral3 TE, city96#438 qwen35, qwen2 allowlist
- city96#473 partial: Qwen3-VL deepstack mmproj map for MiniMax H3 TE

Skipped mega/draft rewrites (city96#459, full city96#473 LazyGGUFReader, city96#336 Triton).
See PR_BACKPORT.md for the full matrix.
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.

1 participant