Mainline geo t#1845
Conversation
…are not yet updated.
Greptile SummaryThis PR promotes
Important Files Changed
|
| def _extract_global_embedding(args: tuple, kwargs: dict) -> torch.Tensor | None: | ||
| """Pull ``global_embedding`` from a GeoTransolver forward call. | ||
|
|
||
| ``GeoTransolver.forward`` takes ``global_embedding`` as its third positional |
There was a problem hiding this comment.
GuardedGeoTransolver should inherit from physicsnemo.Module (MOD-001)
GuardedGeoTransolver is a torch.nn.Module subclass. Per coding standard MOD-001, all model classes in this repository must inherit from physicsnemo.Module to benefit from serialisation, versioning, and registry features. Even as an experimental wrapper, this class exposes a forward() method and acts as a model.
File Used: CODING_STANDARDS/MODELS_IMPLEMENTATION.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| class GuardedGeoTransolver(nn.Module): | ||
| """GeoTransolver wrapped with an out-of-distribution guard. |
There was a problem hiding this comment.
The
GuardedGeoTransolver class docstring uses plain """ instead of the required raw-string prefix r""". Per coding standard MOD-003b, all class and method docstrings must use r""" so that LaTeX backslash sequences are not interpreted as Python escape sequences.
| class GuardedGeoTransolver(nn.Module): | |
| """GeoTransolver wrapped with an out-of-distribution guard. | |
| class GuardedGeoTransolver(nn.Module): | |
| r"""GeoTransolver wrapped with an out-of-distribution guard. |
File Used: CODING_STANDARDS/MODELS_IMPLEMENTATION.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
peterdsharpe
left a comment
There was a problem hiding this comment.
Verified changes on the unified recipe (CODEOWNER), LGTM there!
One question - where is the new geotransolver_guard coming from? Is that splitting out functionality that used to be in core geotransolver.py?
|
This PR is breaking the kinetic Monte-Carlo recipe as well as checkpoints that were distributed. Nothing against the move, but can we keep it importable from |
Yes, exactly. This is really something that @mnabian needs to weigh in on, if we should build it this way or another way. |
|
Also, model hould be added to API doc I think? |
I would like to put in a second docs PR to give @megnvidia breathing room to review independent of code changes. I've got the updates staged locally already. Are you ok with that? We can have it ready up here before approval of this one. |
|
/ok to test 8a20c73 |
| from .gale import ( | ||
| GALE, | ||
| GALE_FA, | ||
| GALE_block, |
|
Docs update in #1847 . It's this whole PR + docs, so this one needs to merge first. |
|
@CharlelieLrt I've added shims back to experimental. @ktangsali maybe a good test is to try this PR in physicsnemo-cfd and validate the checkpoints import correctly? I can do it if you think that will be robust testing. |
| > By default, the normalization sets the mean to 0.0 and std to 1.0 of all labels in the dataset, computing the mean across the train dataset. You could adapt this to a different normalization, however take care to update both the preprocessing as well as inference scripts. Min/Max is another popular strategy. | ||
|
|
||
| To configure your training run, use `hydra`. The config contains sections for the model, data, optimizer, and training settings. For details on the model parameters, see the API for `physicsnemo.models.transolver` and `physicsnemo.experimental.models.geotransolver`. | ||
| To configure your training run, use `hydra`. The config contains sections for the model, data, optimizer, and training settings. For details on the model parameters, see the API for `physicsnemo.models.transolver` and `physicsnemo.models.geotransolver`. |
There was a problem hiding this comment.
| To configure your training run, use `hydra`. The config contains sections for the model, data, optimizer, and training settings. For details on the model parameters, see the API for `physicsnemo.models.transolver` and `physicsnemo.models.geotransolver`. | |
| To configure your training run, use `hydra`. The config contains sections for the model, data, optimizer, and training settings. For details on the model parameters, refer to the API for `physicsnemo.models.transolver` and `physicsnemo.models.geotransolver`. |
| (leave `null` to disable): | ||
| To enable the guard, wrap a constructed `GeoTransolver` with | ||
| `GuardedGeoTransolver` (from `physicsnemo.experimental.guardrails.embedded`). | ||
| The wrapper observes the two surfaces above via a forward hook and delegates the |
There was a problem hiding this comment.
| The wrapper observes the two surfaces above via a forward hook and delegates the | |
| The wrapper observes the two surfaces above through a forward hook and delegates the |
| `physicsnemo.models.geotransolver.GeoTransolver`, together with the FLARE | ||
| model (`physicsnemo.models.flare.FLARE`) and the reusable GALE and FLARE | ||
| attention layers (`physicsnemo.nn.GALE`, `physicsnemo.nn.GALE_block`, | ||
| `physicsnemo.nn.FLARE`). The embedded OOD guard is decoupled from the model: |
There was a problem hiding this comment.
| `physicsnemo.nn.FLARE`). The embedded OOD guard is decoupled from the model: | |
| `physicsnemo.nn.FLARE`). The embedded OOD guard is decoupled from the model. |
| model (`physicsnemo.models.flare.FLARE`) and the reusable GALE and FLARE | ||
| attention layers (`physicsnemo.nn.GALE`, `physicsnemo.nn.GALE_block`, | ||
| `physicsnemo.nn.FLARE`). The embedded OOD guard is decoupled from the model: | ||
| wrap a constructed GeoTransolver with |
There was a problem hiding this comment.
| wrap a constructed GeoTransolver with | |
| Wrap a constructed GeoTransolver with |
| attention layers (`physicsnemo.nn.GALE`, `physicsnemo.nn.GALE_block`, | ||
| `physicsnemo.nn.FLARE`). The embedded OOD guard is decoupled from the model: | ||
| wrap a constructed GeoTransolver with | ||
| `physicsnemo.experimental.guardrails.embedded.GuardedGeoTransolver` (or |
There was a problem hiding this comment.
| `physicsnemo.experimental.guardrails.embedded.GuardedGeoTransolver` (or | |
| GuardedGeoTransolver (or call |
| `physicsnemo.nn.FLARE`). The embedded OOD guard is decoupled from the model: | ||
| wrap a constructed GeoTransolver with | ||
| `physicsnemo.experimental.guardrails.embedded.GuardedGeoTransolver` (or | ||
| `attach_ood_guard`) to enable out-of-distribution guarding — the |
There was a problem hiding this comment.
| `attach_ood_guard`) to enable out-of-distribution guarding — the | |
| `attach_ood_guard`) to enable out-of-distribution guarding. The `guard_config` |
| wrap a constructed GeoTransolver with | ||
| `physicsnemo.experimental.guardrails.embedded.GuardedGeoTransolver` (or | ||
| `attach_ood_guard`) to enable out-of-distribution guarding — the | ||
| `guard_config` model argument is removed. |
There was a problem hiding this comment.
| `guard_config` model argument is removed. | |
| model argument is removed. |
mnabian
left a comment
There was a problem hiding this comment.
LGTM! Left a couple of minor comments. Great to see TE is now enabled for FLARE! Guardrail changes look good, but an action item for me is to update the user documentation accordingly.
| @@ -14,11 +14,10 @@ | |||
| # See the License for the specific language governing permissions and | |||
There was a problem hiding this comment.
You can also include a test for the return_embedding_states=True path.
| self.attn_fn = te.DotProductAttention( | ||
| num_attention_heads=self.heads, | ||
| kv_channels=self.dim_head, | ||
| attention_dropout=dropout, |
There was a problem hiding this comment.
When use_te=True, attention-weight dropout is applied inside the TE kernel in addition to the shared out_dropout, but the non-TE path skips attention dropout entirely. This won't affect our GeoTransolver trainings as we usually don't use dropout, but will affect the models that use Concrete Dropout for UQ, and makes the two modes non-equivalent for UQ.
PhysicsNeMo Pull Request
This PR moves GeoTransolver out of experimental and into physicsnemo proper. Because GeoT also has a FLARE attention backend, we also move FLARE at the same time.
A few other pieces change with this:
Tests are updated, and most examples are changed only to update import paths, etc. The major update is the OODGuard changes. No example yet is exercising the FLARE TE path.
A docs update will come in a follow on PR so it can be reviewed on a separate time scale.
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.