Skip to content

Fix Aimdo fallback on probe to not use zero-copy sft#12634

Open
rattus128 wants to merge 2 commits intoComfy-Org:masterfrom
rattus128:prs/dynamic-vram-fixes/aimdo-fallback-pollution
Open

Fix Aimdo fallback on probe to not use zero-copy sft#12634
rattus128 wants to merge 2 commits intoComfy-Org:masterfrom
rattus128:prs/dynamic-vram-fixes/aimdo-fallback-pollution

Conversation

@rattus128
Copy link
Contributor

Complete the fallback properly when aimdo fails to probe.

Improves the behaviour seen in:

Comfy-Org/comfy-aimdo#5

Does not fix root cause (which is cu13 incompatibilty) but will improve fallback to be clean.

Requested to load WAN21

Pin error.

...

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

Pin error.

loaded partially; 4244.10 MB usable, 3758.94 MB loaded, 9870.92 MB offloaded, 472.53 MB buffer reserved, lowvram patches: 346

100%|████████████████████████████████████████████████████████████████████████████████████| 2/2 [01:03<00:00, 31.65s/it]

Requested to load WanVAE

loaded completely; 1203.19 MB usable, 242.03 MB loaded, full load: True

Prompt executed in 93.16 seconds

got prompt

loaded partially; 4229.11 MB usable, 3756.57 MB loaded, 9873.28 MB offloaded, 472.53 MB buffer reserved, lowvram patches: 0

100%|████████████████████████████████████████████████████████████████████████████████████| 2/2 [01:00<00:00, 30.07s/it]

Requested to load WanVAE

loaded completely; 1195.19 MB usable, 242.03 MB loaded, full load: True

Prompt executed in 72.22 seconds

This was going to the raw command line switch and should respect main.py
probe of whether aimdo actually loaded successfully.
Avoid changes of behaviour on --fast dynamic_vram when aimdo doesnt work.
@rattus128 rattus128 changed the title Prs/dynamic vram fixes/aimdo fallback pollution Fix Aimdo fallback on probe to not use zero-copy sft Feb 25, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 25, 2026

📝 Walkthrough

Walkthrough

This pull request refactors the dynamic VRAM loading mechanism across two files. In comfy/ops.py, the import of enables_dynamic_vram from comfy.cli_args is removed and replaced with direct flag checks against comfy.memory_management.aimdo_enabled. Similarly, in comfy/utils.py, the runtime check using enables_dynamic_vram() in the load_torch_file function is replaced with the same flag check pattern, and an explicit import of comfy.memory_management is added. The changes maintain the original control flow while shifting the underlying mechanism for determining dynamic VRAM enablement status.

🚥 Pre-merge checks | ✅ 2 | ❌ 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 (2 passed)
Check name Status Explanation
Title check ✅ Passed The title describes a specific fix for aimdo fallback behavior with zero-copy SFT loading, which aligns with the changeset's focus on removing enables_dynamic_vram and implementing fallback logic improvements.
Description check ✅ Passed The description explains the purpose of completing the fallback sequence when aimdo fails to probe, references a related issue, and provides runtime logs demonstrating the improvement, which directly relates to the changes made.

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

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
comfy/utils.py (1)

33-33: Remove the duplicated comfy.memory_management import.

Line 33 re-imports a module already imported at Line 23. This is harmless at runtime, but it adds noise and can trip lint configs.

Suggested cleanup
-from comfy.cli_args import args
-import comfy.memory_management
+from comfy.cli_args import args
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@comfy/utils.py` at line 33, Remove the duplicated import of the module
comfy.memory_management in comfy/utils.py: locate the repeated "import
comfy.memory_management" entry that appears after the original import and delete
the redundant line so the module is only imported once; ensure other imports
remain untouched and run the linter to verify no import-duplication warnings
remain.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@comfy/utils.py`:
- Line 33: Remove the duplicated import of the module comfy.memory_management in
comfy/utils.py: locate the repeated "import comfy.memory_management" entry that
appears after the original import and delete the redundant line so the module is
only imported once; ensure other imports remain untouched and run the linter to
verify no import-duplication warnings remain.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3ebe1ac and 8844348.

📒 Files selected for processing (2)
  • comfy/ops.py
  • comfy/utils.py

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