Omni: Account whole LoRA weights in ComfyUI memory budgets - #613
Merged
xiangyuT merged 5 commits intoAug 15, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new ComfyUI-OmniXPU adapter that caches whole-LoRA tensor sizes on ModelPatcher attachments and applies the cached staging budget to ComfyUI model load memory requirements, with an optional runtime trace mode for per-layer staging behavior.
Changes:
- Introduces
lora_memoryadapter to compute/dedupe LoRA tensor sizes, persist them on patchers, and add the cached budget toload_models_gpumemory requirements. - Registers the adapter as a patch component and wires a new
OMNIXPU_LORA_MEMORYconfig flag. - Adds documentation and tests covering cache behavior, stacking, deduplication, and optional staging trace logging.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| omni/ComfyUI-OmniXPU/adapters/lora_memory.py | New adapter that caches LoRA tensor budgets and applies them to model load requests; optional dynamic staging trace. |
| omni/ComfyUI-OmniXPU/config.py | Adds lora_memory feature flag controlled by OMNIXPU_LORA_MEMORY. |
| omni/ComfyUI-OmniXPU/patches/init.py | Registers the new adapter component in the patch registry. |
| omni/ComfyUI-OmniXPU/README.md | Documents the new adapter and environment variables, including trace mode. |
| omni/tests/test_comfyui_omnixpu_lora_memory.py | New unit tests validating budget computation, caching, stacking, and tracing behavior. |
| omni/tests/test_comfyui_omnixpu_bootstrap.py | Verifies adapter registration and config default behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+224
to
+234
| if "minimum_memory_required" in new_kwargs: | ||
| minimum = new_kwargs["minimum_memory_required"] | ||
| if minimum is not None: | ||
| new_kwargs["minimum_memory_required"] = minimum + budget | ||
| elif len(new_args) > 2: | ||
| minimum = new_args[2] | ||
| if minimum is not None: | ||
| new_args[2] = minimum + budget | ||
| else: | ||
| minimum = None | ||
| effective_minimum = None if minimum is None else minimum + budget |
Comment on lines
+60
to
+66
| Component( | ||
| "lora_memory_budget", | ||
| "lora_memory", | ||
| "adapter", | ||
| "ComfyUI-OmniXPU", | ||
| "adapters/lora_memory.py", | ||
| ), |
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.
No description provided.