Skip to content

Fix MoGe antialiased interpolation for half precision#14637

Open
holys519 wants to merge 2 commits into
Comfy-Org:masterfrom
holys519:fix-moge-half-antialias
Open

Fix MoGe antialiased interpolation for half precision#14637
holys519 wants to merge 2 commits into
Comfy-Org:masterfrom
holys519:fix-moge-half-antialias

Conversation

@holys519

Copy link
Copy Markdown

Summary

  • Add a small wrapper for antialiased interpolation that upcasts float16/bfloat16 tensors to float32 before resizing, then casts back.
  • Use it in the MoGe resize paths that call F.interpolate(..., antialias=True).

Motivation

PyTorch does not implement antialiased interpolation for float16/bfloat16 tensors on some backends, which can raise NotImplementedError: "compute_index_ranges_weights" not implemented for 'Half' or BFloat16.

Testing

  • git diff --check
  • Verified _interpolate_antialias_safe with float16, bfloat16, and float32 tensors using the local .venv and --cpu.

@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: 51cfda6b-ef0b-4f1f-9a3d-25add99ae52f

📥 Commits

Reviewing files that changed from the base of the PR and between ee847d4 and 2e9d624.

📒 Files selected for processing (1)
  • comfy/ldm/moge/modules.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • comfy/ldm/moge/modules.py

📝 Walkthrough

Walkthrough

This PR adds _interpolate_antialias_safe in comfy/ldm/moge/modules.py, which casts half-precision inputs to float32 for antialiased interpolation and casts back afterward. DINOv2Encoder.forward now uses this helper for image_14 resizing. MoGeModelV1.forward also switches its input-image resize step to the same helper, while keeping the existing resize settings and later bilinear resize path.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.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 clearly summarizes the main change: fixing MoGe antialiased interpolation for half precision.
Description check ✅ Passed The description matches the changes by describing the safe antialiased interpolation wrapper and its use in MoGe paths.
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.

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.

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.

3 participants