Adds inference script (incl. force calculation) to Unifed External Aero Recipe#1706
Adds inference script (incl. force calculation) to Unifed External Aero Recipe#1706peterdsharpe wants to merge 25 commits into
Conversation
- Introduced `infer.py`, a model-agnostic inference script that loads trained checkpoints, runs inference over specified dataset splits, and outputs predictions in the native `.pdmsh` format. - Added `infer.yaml` configuration file to define inference parameters, including dataset selection, checkpoint locations, and output settings. - Ensured compatibility with existing training configurations by sharing base settings, allowing for consistent precision and data loading across training and inference phases.
- Moved the import of `Float` from `jaxtyping` to improve code organization. - Removed unnecessary blank lines to enhance readability.
…ynamics - Updated the README to clarify that users can both train and run inference with models. - Added detailed instructions for running inference on trained checkpoints, including command examples and output specifications. - Introduced force and moment coefficient integration in the inference configuration, enabling users to obtain physical coefficients from surface cases. - Improved the `infer.yaml` configuration to support force coefficient calculations and added relevant parameters for reference areas and moment centers. - Refactored the `datasets.py` and `infer.py` scripts to streamline data loading and inference processes, ensuring consistency across training and inference phases.
Greptile SummaryThis PR adds an inference script (
Important Files Changed
|
…dynamics - Modified the file patterns in `drivaer_ml_surface.yaml`, `drivaer_ml_volume.yaml`, and `highlift_volume.yaml` to specify directory structures, ensuring correct data loading for the respective readers. - Adjusted patterns to include specific prefixes for better organization and clarity in dataset management.
…stency - Changed file patterns in `README.md`, `shift_suv_estate_surface.yaml`, and `shift_suv_fastback_surface.yaml` to include a `run_*` prefix, ensuring uniformity in data loading paths across the unified external aerodynamics recipe. - Adjusted the pattern in `merge_global_data.py` to match the updated structure for better integration with the data pipeline.
|
/blossom-ci |
|
/ok to test 0101ef0 |
…/github.com/peterdsharpe/physicsnemo into psharpe/add-unified-recipe-inference-script
|
/blossom-ci |
|
/ok to test b290b3a |
|
/blossom-ci |
PhysicsNeMo Pull Request
Description
This PR modifies the Unified External Aero Recipe (
examples/cfd/external_aerodynamics/unified_external_aero_recipe), to:src/infer.pyandconf/infer.yaml) to the Unified External Aero RecipeIn order to pull this off cleanly (i.e., without massive duplication between the pre-existing
train.pyscript andinfer.py), some tooling was refactored within the recipe. In general this means:train.pygot a lot shorter.utils.pyanddatasets.pygot a lot longer, mostly with stuff that was pulled out oftrain.py.infer.pycan now re-use most of that shared tooling :)So, in-net, for code reviewers, I would recommend:
README.mdfor an overview.train.py->utils.pyanddatasets.py.infer.py, along with the new YAMLs, and let me know if it's understandable.forces.py, which is used for force calculation.All other changes are pretty peripheral and/or derived from this.
Some more detailed notes on how the inference script works:
infer.pyis a companion totrain.pythat loads a trained checkpoint, runs it over a split, and writes predictions back to disk:input_type/output_type/forward_kwargs/targetscontract as training, so it works for every model in the recipe (GeoTransolver, Transolver, FLARE, GLOBE, ...) with no per-model code. It reusesbuild_dataloaders, the collate,normalize_output_to_tensordict, andMetricCalculatordirectly (which now live indatasets.py)..pdmshDomainMeshper sample under${output_dir}/${run_id}/predictions/, withpred_<field>andtrue_<field>on the interior, plus ametrics.jsonl.rescale_geometryrestores physical-scale coordinates.conf/infer.yamlsharesconf/base.yamlwith the trainer and swaps the training schedule for checkpoint/output knobs (run_id,checkpoint_dir/checkpoint_path,infer_split,redimensionalize, ...).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.