Skip to content

Added support for lowvram argument for 'mps' devices. #14622

Open
FromFirstByte wants to merge 3 commits into
Comfy-Org:masterfrom
FromFirstByte:master
Open

Added support for lowvram argument for 'mps' devices. #14622
FromFirstByte wants to merge 3 commits into
Comfy-Org:masterfrom
FromFirstByte:master

Conversation

@FromFirstByte

Copy link
Copy Markdown

Right now VRAM-related args are ignored if cpu_state == CPUState.MPS

If --lowvram arg passed it would prevent from loading 100% of weights to VRAM. With modified GGUF loader it allows to keep memory-mapped weights on disk significantly reducing RAM usage. Modified GGUF loader - https://github.com/FromFirstByte/ComfyUI-GGUF

…ghts would not be loaded to VRAM completely. With modified GGUF loader it allows to keep memory-mapped weights on disk.
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 2006597b-ce75-4183-8898-31d94434564a

📥 Commits

Reviewing files that changed from the base of the PR and between abbe30c and 489fc75.

📒 Files selected for processing (1)
  • comfy/model_management.py

📝 Walkthrough

Walkthrough

In load_models_gpu, the fallback path for lowvram_model_memory now also applies when set_vram_to is LOW_VRAM, vram_state is SHARED, and force_full_load is false. The existing NO_VRAM case remains included.

🚥 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 accurately summarizes the new low-VRAM support for MPS devices.
Description check ✅ Passed The description matches the change by explaining that lowvram behavior now applies to MPS devices.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@comfy/model_management.py`:
- Around line 941-942: The new shared-lowvram fallback in the model memory
selection logic is applying too broadly and can affect CPU-loaded models. Update
the condition in the memory-setting block around the VRAMState check so the
shared-lowvram path only forces lowvram_model_memory when the current model’s
torch_dev is a non-CPU load device, preserving the existing behavior for CPU
loads. Keep the change localized to the lowvram memory decision in the relevant
model management function and avoid altering other VRAMState handling.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 19caa59a-e498-497a-940f-0b0aba97665f

📥 Commits

Reviewing files that changed from the base of the PR and between 64e1d74 and abbe30c.

📒 Files selected for processing (1)
  • comfy/model_management.py

Comment thread comfy/model_management.py Outdated
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