Skip to content

Fixes and renaming in dps_guidance.py#1471

Merged
CharlelieLrt merged 1 commit intoNVIDIA:2.0.0-rcfrom
CharlelieLrt:diffusion-fix-guidance
Mar 5, 2026
Merged

Fixes and renaming in dps_guidance.py#1471
CharlelieLrt merged 1 commit intoNVIDIA:2.0.0-rcfrom
CharlelieLrt:diffusion-fix-guidance

Conversation

@CharlelieLrt
Copy link
Collaborator

PhysicsNeMo Pull Request

Description

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 a review from NickGeneva March 5, 2026 00:23
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 5, 2026

Greptile Summary

This PR renames DPSDenoiserDPSScorePredictor to better reflect the class's role (producing a score-Predictor, not a Denoiser directly) and removes the incorrect Denoiser base-class inheritance. It also updates the math symbol for the guidance strength from \gamma to \rho(t) in the protocol docstring and from \gamma to \Gamma for the SDA scaling parameter in both concrete guidance classes, and adds three inference-mode guard checks that raise a descriptive RuntimeError before attempting requires_grad_().

Key changes:

  • DPSDenoiser renamed to DPSScorePredictor across dps_guidance.py and __init__.pybreaking rename with no backward-compatibility alias; callers must update their imports.
  • Base class changed from Denoiser to bare object; the class still satisfies the Predictor protocol structurally via @runtime_checkable.
  • Added torch.is_inference_mode_enabled() guards in DPSScorePredictor.__call__, ModelConsistencyDPSGuidance.__call__, and DataConsistencyDPSGuidance.__call__.
  • The error messages in those guards suggest torch.no_grad() as an alternative fix, but torch.no_grad() does not exit inference mode; only torch.inference_mode(False) does — the message is misleading and should be clarified.

Important Files Changed

Filename Overview
physicsnemo/diffusion/guidance/dps_guidance.py Renames DPSDenoiser to DPSScorePredictor (removing the Denoiser base class), updates math symbol gamma→rho/Γ throughout docstrings, and adds inference mode guard checks at three call sites. The guard's error message misleadingly suggests torch.no_grad() as a fix for being inside torch.inference_mode(), which will not actually resolve the issue.
physicsnemo/diffusion/guidance/init.py Correctly updates the import and all export from DPSDenoiser to DPSScorePredictor in lockstep with the rename in dps_guidance.py.

Last reviewed commit: c5bf78a

@ktangsali ktangsali mentioned this pull request Mar 5, 2026
6 tasks
@ktangsali
Copy link
Collaborator

/blossom-ci

Copy link
Collaborator

@NickGeneva NickGeneva left a comment

Choose a reason for hiding this comment

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

Few comments but approve to unblock

@CharlelieLrt CharlelieLrt merged commit 2841666 into NVIDIA:2.0.0-rc Mar 5, 2026
1 check passed
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.

3 participants