Skip to content

Enhance crash recipe with configurable stats directory#1466

Open
dran-dev wants to merge 1 commit intoNVIDIA:mainfrom
dran-dev:crash-stats-dir
Open

Enhance crash recipe with configurable stats directory#1466
dran-dev wants to merge 1 commit intoNVIDIA:mainfrom
dran-dev:crash-stats-dir

Conversation

@dran-dev
Copy link
Contributor

@dran-dev dran-dev commented Mar 1, 2026

PhysicsNeMo Pull Request

Description

Make the stats directory (node_stats.json, feature_stats.json,
edge_stats.json) configurable via Hydra in the crash simulation recipe.

Previously, training wrote normalization statistics to a relative ./stats/
path under the Hydra run output directory. During inference, a different Hydra
output directory is used, so the stats files were not found — resulting in:

FileNotFoundError: Node stats file stats/node_stats.json or
feature stats file stats/feature_stats.json not found

This PR adds a datapipe.stats_dir configuration option (defaulting to
null, which preserves the existing ./stats/ behavior) so users can
point inference to the training run's stats directory:

python inference.py --config-name=experiment_bumper_geotransolver \
  ++datapipe.stats_dir=/path/to/training_output/stats

Changes

  • Added stats_dir parameter to CrashBaseDataset.__init__ with
    backward-compatible default (None falls back to relative stats/).
  • Added stats_dir: null to point_cloud.yaml and graph.yaml
    datapipe configs.
  • Added logging of the resolved stats directory path in datapipe.py,
    train.py, and inference.py.
  • Updated README to document the new datapipe.stats_dir option.
  • Updated CHANGELOG.

Checklist

Dependencies

None.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 1, 2026

Greptile Summary

This PR successfully adds a configurable stats_dir parameter to the crash simulation recipe, solving the problem where inference couldn't find normalization statistics computed during training.

Key improvements:

  • Adds backward-compatible stats_dir parameter to CrashBaseDataset (defaults to ./stats/ under Hydra run directory)
  • Enables users to point inference to training stats via ++datapipe.stats_dir=/path/to/training_output/stats
  • Properly logs the resolved stats directory in both training and inference
  • Updates configuration files and documentation

Implementation approach:
The change leverages Hydra's instantiate() to automatically pass the stats_dir config value to the dataset constructor. The dataset implementation uses stats_dir if stats_dir is not None else STATS_DIRNAME, preserving existing behavior when the parameter is not specified.

The solution is clean and minimal, with good backward compatibility.

Important Files Changed

Filename Overview
examples/structural_mechanics/crash/datapipe.py Added stats_dir parameter to CrashBaseDataset.__init__() with backward-compatible default behavior and proper logging
examples/structural_mechanics/crash/train.py Added logging for stats directory path at startup
examples/structural_mechanics/crash/inference.py Added logging for stats directory path at startup
examples/structural_mechanics/crash/conf/datapipe/graph.yaml Added stats_dir: null configuration option with descriptive comment
examples/structural_mechanics/crash/conf/datapipe/point_cloud.yaml Added stats_dir: null configuration option with descriptive comment

Last reviewed commit: 7f6061f

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

7 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@dran-dev
Copy link
Contributor Author

dran-dev commented Mar 1, 2026

/blossom-ci

@dran-dev dran-dev changed the title Enhance crash simulation recipe with configurable stats directory Enhance crash recipe with configurable stats directory Mar 1, 2026
Added support for a configurable stats directory in train.py, inference.py for crash recipe.

Signed-off-by: Dileep Ranganathan <8152399+dran-dev@users.noreply.github.com>
@dran-dev
Copy link
Contributor Author

dran-dev commented Mar 1, 2026

@mnabian @ktangsali PTAL

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.

1 participant