Skip to content

Update geotransolver for 2d and 3d use cases#1502

Merged
coreyjadams merged 16 commits intoNVIDIA:mainfrom
coreyjadams:geotransolver-2d-3d
May 4, 2026
Merged

Update geotransolver for 2d and 3d use cases#1502
coreyjadams merged 16 commits intoNVIDIA:mainfrom
coreyjadams:geotransolver-2d-3d

Conversation

@coreyjadams
Copy link
Copy Markdown
Collaborator

PhysicsNeMo Pull Request

This PR adds the same structured 2d and 3d convolutional steps to geotransolver that are available in transolver.

To make sure the code is not overly duplicating, it refactors a few places to ensure the implementation can reuse core components as much as possible.

Description

Checklist

Dependencies

Review Process

All PRs are reviewed by the PhysicsNeMo team before merging.

Depending on which files are changed, GitHub may automatically assign a maintainer for review.

We are also testing AI-based code review tools (e.g., Greptile), which may add automated comments with a confidence score.
This score reflects the AI’s assessment of merge readiness and is not a qualitative judgment of your work, nor is
it an indication that the PR will be accepted / rejected.

AI-generated feedback should be reviewed critically for usefulness.
You are not required to respond to every AI comment, but they are intended to help both authors and reviewers.
Please react to Greptile comments with 👍 or 👎 to provide feedback on their accuracy.

@coreyjadams coreyjadams self-assigned this Mar 14, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Mar 14, 2026

Greptile Summary

This PR extends GeoTransolver with structured 2D and 3D convolutional paths, mirroring the existing Transolver structured mesh support. The refactoring extracts shared logic into reusable functions (_gale_forward_impl, _gale_compute_slice_attention_cross, _SliceToContextMixin) and adds GALEStructuredMesh2D, GALEStructuredMesh3D, and StructuredContextProjector classes.

  • Adds structured_shape parameter to GeoTransolver, GALE_block, and GlobalContextBuilder to enable Conv2d/Conv3d slice projection on structured grids
  • Refactors GALE forward pass and cross-attention into shared module-level functions to avoid code duplication between irregular and structured variants
  • Extracts slice-to-context initialization and computation into _SliceToContextMixin shared by ContextProjector and the new StructuredContextProjector
  • Adds _flatten_for_structured helper in geotransolver.py to handle both spatial (B,H,W,C) and flattened (B,N,C) inputs with proper unflatten on output
  • Correctly disables ball-query local features when structured_shape is set (incompatible paths)
  • New tests cover 2D/3D structured forward passes, spatial-vs-flattened input equivalence, structured+global-context, and rejection of include_local_features with structured_shape
  • New public classes (GALEStructuredMesh2D, GALEStructuredMesh3D, StructuredContextProjector) have minimal docstrings compared to the project's coding standards

Important Files Changed

Filename Overview
physicsnemo/experimental/models/geotransolver/init.py Exports new structured GALE variants (GALEStructuredMesh2D, GALEStructuredMesh3D, StructuredContextProjector). Clean and correct.
physicsnemo/experimental/models/geotransolver/context_projector.py Refactors shared slice logic into _SliceToContextMixin and adds StructuredContextProjector with Conv2d/Conv3d encoding. Well-structured refactoring; StructuredContextProjector.forward lacks docstring.
physicsnemo/experimental/models/geotransolver/gale.py Extracts shared GALE forward/cross-attention into module-level functions; adds GALEStructuredMesh2D/3D via mixin + PhysicsAttentionStructured* inheritance; GALE_block now supports spatial_shape routing. Clean refactoring with correct MRO.
physicsnemo/experimental/models/geotransolver/geotransolver.py Adds structured_shape parameter to GeoTransolver with flatten/unflatten support for 2D/3D grids. Includes proper validation and output reshaping. Well-integrated with existing architecture.
test/models/geotransolver/test_geotransolver.py Adds structured 2D/3D forward tests, rejects-local-features validation, and global-context-with-structured-grid test. Good coverage of new functionality.

Last reviewed commit: a0cd8b0

Comment thread physicsnemo/experimental/models/geotransolver/context_projector.py
Comment thread physicsnemo/experimental/models/geotransolver/gale.py
Comment thread test/models/geotransolver/test_geotransolver.py
Comment thread physicsnemo/experimental/models/geotransolver/context_projector.py
Comment thread physicsnemo/experimental/models/geotransolver/__init__.py
Comment thread physicsnemo/experimental/models/geotransolver/context_projector.py
Copy link
Copy Markdown
Collaborator

@mnabian mnabian left a comment

Choose a reason for hiding this comment

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

LGTM! Left a few minor comments.

@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented Apr 30, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coreyjadams
Copy link
Copy Markdown
Collaborator Author

/ok to test 57981f5

@coreyjadams
Copy link
Copy Markdown
Collaborator Author

/ok to test 93084eb

Copy link
Copy Markdown
Collaborator

@loliverhennigh loliverhennigh left a comment

Choose a reason for hiding this comment

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

I think the way nn is setup is fine

@coreyjadams
Copy link
Copy Markdown
Collaborator Author

/blossom-ci

@coreyjadams coreyjadams enabled auto-merge May 4, 2026 18:57
@coreyjadams
Copy link
Copy Markdown
Collaborator Author

/blossom-ci

@coreyjadams coreyjadams added this pull request to the merge queue May 4, 2026
Merged via the queue into NVIDIA:main with commit b193e03 May 4, 2026
4 checks passed
coreyjadams added a commit that referenced this pull request May 5, 2026
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