Skip to content

fix: Proper memory estimation for frame interpolation (CORE-150)#13698

Merged
kijai merged 1 commit into
Comfy-Org:masterfrom
kijai:interp_fix
May 4, 2026
Merged

fix: Proper memory estimation for frame interpolation (CORE-150)#13698
kijai merged 1 commit into
Comfy-Org:masterfrom
kijai:interp_fix

Conversation

@kijai

@kijai kijai commented May 4, 2026

Copy link
Copy Markdown
Collaborator

Should fix #13583

load_model_gpu + separate free_memory could evict the just-loaded interp model back to CPU, causing a CUDA/CPU mismatch on forward. Replaced with a single load_models_gpu(memory_required=...) call (matches some existing patterns such as VAEs), profiled memory_used_forward on IFNet/FILMNet replacing the under-reserved 20× heuristic, and switched loader to CoreModelPatcher.

@coderabbitai

coderabbitai Bot commented May 4, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d8a134cc-dfd3-4c04-823f-63eb03e59071

📥 Commits

Reviewing files that changed from the base of the PR and between f3ea976 and 313ffea.

📒 Files selected for processing (3)
  • comfy_extras/frame_interpolation_models/film_net.py
  • comfy_extras/frame_interpolation_models/ifnet.py
  • comfy_extras/nodes_frame_interpolation.py

📝 Walkthrough

Walkthrough

The PR adds memory-usage estimation methods to two frame interpolation models (FILMNet and IFNet). It updates the frame interpolation node to use CoreModelPatcher instead of ModelPatcher for model loading. The GPU memory-handling logic is refactored to query the model's memory requirements via the new method instead of using a fixed formula, and then passes this value to load_models_gpu. The computation order of image alignment and dimensions is adjusted to occur after GPU loading.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.11% 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 Title references memory estimation improvement for frame interpolation, directly related to the main changes adding memory_used_forward methods and refactoring memory management.
Description check ✅ Passed Description clearly addresses issue #13583, explaining the CUDA/CPU mismatch problem and the fix involving load_models_gpu, memory profiling, and CoreModelPatcher.
Linked Issues check ✅ Passed PR fully addresses issue #13583 by replacing separate load_model_gpu/free_memory calls with single load_models_gpu(memory_required=...) call using profiled memory_used_forward methods to prevent model eviction and dtype/device mismatches.
Out of Scope Changes check ✅ Passed All changes directly support the core objective of fixing device mismatch: adding memory estimation methods, switching to CoreModelPatcher, and refactoring memory management logic.

✏️ 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
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@Kosinkadink

Copy link
Copy Markdown
Member

I think this can be merged by anyone at anytime, if everything's seems fine 👌

@kijai kijai merged commit c33d26c into Comfy-Org:master May 4, 2026
14 checks passed
@alexisrolland alexisrolland changed the title fix: Proper memory estimation for frame interpolation when not using … May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants