Skip to content

Fix model signature from from_torch (#1349)#1350

Merged
CharlelieLrt merged 6 commits intoNVIDIA:mainfrom
giprayogo:fix-module-from-torch
Feb 13, 2026
Merged

Fix model signature from from_torch (#1349)#1350
CharlelieLrt merged 6 commits intoNVIDIA:mainfrom
giprayogo:fix-module-from-torch

Conversation

@giprayogo
Copy link
Copy Markdown
Contributor

@giprayogo giprayogo commented Jan 27, 2026

PhysicsNeMo Pull Request

Fix Module.from_torch() dropping keyword-only arguments from __init__ signature.

Description

Closes #1349 .

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.

* Use original `__init__` signature instead of reconstructing it

Signed-off-by: giprayogo <genki016@gmail.com>
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Jan 27, 2026

Greptile Overview

Greptile Summary

Simplified Module.from_torch() signature handling by directly copying the signature using inspect.signature() instead of manually reconstructing it with getfullargspec().

  • Removed 19 lines of complex manual signature reconstruction logic
  • The old implementation only preserved positional/keyword arguments and their defaults, dropping keyword-only arguments (*, syntax)
  • The new implementation correctly preserves all parameter kinds including keyword-only arguments
  • This change aligns with how signatures are handled elsewhere in the codebase (consistently uses inspect.signature)

Important Files Changed

Filename Overview
physicsnemo/core/module.py Simplified signature handling by directly copying inspect.signature instead of manually reconstructing it, fixing keyword-only argument preservation

Copy link
Copy Markdown
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.

No files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@CharlelieLrt
Copy link
Copy Markdown
Collaborator

/blossom-ci

@CharlelieLrt CharlelieLrt added the ! - Release PRs or Issues releating to a release label Feb 12, 2026
@CharlelieLrt
Copy link
Copy Markdown
Collaborator

/blossom-ci

@CharlelieLrt
Copy link
Copy Markdown
Collaborator

/blossom-ci

@CharlelieLrt
Copy link
Copy Markdown
Collaborator

/blossom-ci

Copy link
Copy Markdown
Collaborator

@CharlelieLrt CharlelieLrt left a comment

Choose a reason for hiding this comment

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

@loliverhennigh can comment on that, but looks good to me

@CharlelieLrt CharlelieLrt added this pull request to the merge queue Feb 13, 2026
Merged via the queue into NVIDIA:main with commit 0ce9a98 Feb 13, 2026
4 checks passed
nbren12 pushed a commit to nbren12/modulus that referenced this pull request Mar 24, 2026
* Use original `__init__` signature instead of reconstructing it

Signed-off-by: giprayogo <genki016@gmail.com>
Co-authored-by: Charlelie Laurent <84199758+CharlelieLrt@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

! - Release PRs or Issues releating to a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛[BUG]: Module.from_torch() produces incomplete __init__ signature (missing keyword-only arguments)

3 participants