Skip to content

Improved docs for module.py + multiple cleanups in docs#1478

Merged
ktangsali merged 6 commits intoNVIDIA:2.0.0-rcfrom
CharlelieLrt:api-docs-improvements-for-module
Mar 9, 2026
Merged

Improved docs for module.py + multiple cleanups in docs#1478
ktangsali merged 6 commits intoNVIDIA:2.0.0-rcfrom
CharlelieLrt:api-docs-improvements-for-module

Conversation

@CharlelieLrt
Copy link
Collaborator

@CharlelieLrt CharlelieLrt commented Mar 7, 2026

PhysicsNeMo Pull Request

Description

Closes #1177 #1178 #1176 #1169 .

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.

Signed-off-by: Charlelie Laurent <claurent@nvidia.com>
@CharlelieLrt CharlelieLrt requested review from ktangsali and removed request for ktangsali March 7, 2026 04:11
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 7, 2026

Greptile Summary

This PR significantly rewrites the docs/api/models/modules.rst reference page and adds doctest examples to physicsnemo/utils/checkpoint.py. The documentation improvements are substantial and well-structured, with proper cross-references, new sections (Backward Compatibility, dedicated API Reference), corrected import paths (physicsnemo.core.meta instead of physicsnemo.models.meta), and removal of stale content (e.g., the deprecated StaticCaptureTraining section).

Key changes:

  • modules.rst: Comprehensive rewrite with :class:, :meth:, :func:, and :ref: cross-references; new Backward Compatibility and ModelRegistry sections; timm third-party integration example; corrected entry-point format ("mypackage.models:MyPhysicsNeMoModel") and Module.from_torch instead of removed Module.from_pytorch.
  • checkpoint.py: Adds doctest examples to save_checkpoint and load_checkpoint.
  • Issue found: The "Load a specific epoch" doctest in load_checkpoint is misleading. save_checkpoint with epoch=0 never stores the epoch in the .pt training-state file (the if epoch: guard is False for 0), so no .pt file is created for epoch 0. load_checkpoint then returns 0 as a default fallback — not from an actual checkpoint — making the example appear to work correctly while hiding the underlying behaviour.

Important Files Changed

Filename Overview
docs/api/models/modules.rst Major documentation rewrite for the PhysicsNeMo modules page: adds cross-references using :class:/:meth:/:func: roles, new sections for Backward Compatibility and a dedicated API Reference, removes stale StaticCaptureTraining content, and adds timm integration and model registry usage examples. All code snippets were verified against the actual implementation.
physicsnemo/utils/checkpoint.py Adds doctest examples to save_checkpoint and load_checkpoint. The first save/load example is correct. The "Save multiple models" example is correct. The "Load a specific epoch" example is misleading: save_checkpoint with epoch=0 never writes the epoch into the .pt file (due to if epoch: being falsy for 0), so load_checkpoint returns 0 as a default fallback rather than from the checkpoint, masking a subtle pre-existing behaviour.

Last reviewed commit: 5f5ddb5

Signed-off-by: Charlelie Laurent <claurent@nvidia.com>
Signed-off-by: Charlelie Laurent <claurent@nvidia.com>
Signed-off-by: Charlelie Laurent <claurent@nvidia.com>
@ktangsali ktangsali merged commit 1ca85d6 into NVIDIA:2.0.0-rc Mar 9, 2026
ktangsali pushed a commit that referenced this pull request Mar 10, 2026
* Improved docs for module.py

Signed-off-by: Charlelie Laurent <claurent@nvidia.com>

* Fix in save_checkpoint and load_checkpoint docstrings

Signed-off-by: Charlelie Laurent <claurent@nvidia.com>

* Addressed PR comments

Signed-off-by: Charlelie Laurent <claurent@nvidia.com>

* Improvements in docs

Signed-off-by: Charlelie Laurent <claurent@nvidia.com>

* Moved down section about static capture in physicsnemo.utils.rst

Signed-off-by: Charlelie Laurent <claurent@nvidia.com>

---------

Signed-off-by: Charlelie Laurent <claurent@nvidia.com>
ktangsali pushed a commit that referenced this pull request Mar 10, 2026
* Improved docs for module.py

Signed-off-by: Charlelie Laurent <claurent@nvidia.com>

* Fix in save_checkpoint and load_checkpoint docstrings

Signed-off-by: Charlelie Laurent <claurent@nvidia.com>

* Addressed PR comments

Signed-off-by: Charlelie Laurent <claurent@nvidia.com>

* Improvements in docs

Signed-off-by: Charlelie Laurent <claurent@nvidia.com>

* Moved down section about static capture in physicsnemo.utils.rst

Signed-off-by: Charlelie Laurent <claurent@nvidia.com>

---------

Signed-off-by: Charlelie Laurent <claurent@nvidia.com>
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.

2 participants