Skip to content

Conversation

@CharlelieLrt
Copy link
Collaborator

PhysicsNeMo Pull Request

Description

This PR improves the docstring for the method Module.from_checkpoint with added details regarding the mechanism to infer the class, as well as recommended usage.

Note: This PR has a companion PR in the documentation repo, and they should be merged together.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.
  • The CHANGELOG.md is up to date with these changes.
  • An issue is linked to this pull request.

Dependencies

@CharlelieLrt CharlelieLrt added the ! - Release PRs or Issues releating to a release label Oct 24, 2025
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.

Greptile Overview

Greptile Summary

This PR enhances the docstring for the Module.from_checkpoint method in physicsnemo/models/module.py to provide clearer guidance on model class inference during checkpoint loading. The documentation now explicitly describes the three-step precedence order: (1) using the qualifier when calling on a subclass (e.g., MyModuleSubclass.from_checkpoint), (2) looking up the class in PhysicsNeMo's model registry, and (3) importing from the module path stored in the checkpoint file. The PR emphasizes best practice by recommending users call from_checkpoint on the specific subclass rather than the base Module class, which is particularly important for both built-in PhysicsNeMo models and custom user-defined subclasses. This documentation improvement integrates with PhysicsNeMo's existing architecture where models can be discovered through the ModelRegistry (as seen in the registry system mentioned in the repository root documentation) or loaded from .mdlus checkpoint files, making the checkpoint loading mechanism more transparent.

PR Description Notes:

  • Contains a typo in the docstring: "instantiatie" should be "instantiate" (line 596)

Confidence score: 4/5

  • This PR is safe to merge with minimal risk as it only modifies documentation without changing any functional code.
  • Score reflects that this is a documentation-only change with clear improvements, though a minor typo should be corrected before final merge. No code logic changes means very low risk of runtime issues.
  • No files require special attention beyond a quick typo correction in physicsnemo/models/module.py line 596.

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@CharlelieLrt CharlelieLrt removed the ! - Release PRs or Issues releating to a release label Oct 31, 2025
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