Skip to content

DSMLoss implementation + minor bugfixes in noise_schedulers.py and pr…#1430

Merged
CharlelieLrt merged 10 commits intoNVIDIA:2.0.0-rcfrom
CharlelieLrt:diffusion-dsm-loss
Feb 20, 2026
Merged

DSMLoss implementation + minor bugfixes in noise_schedulers.py and pr…#1430
CharlelieLrt merged 10 commits intoNVIDIA:2.0.0-rcfrom
CharlelieLrt:diffusion-dsm-loss

Conversation

@CharlelieLrt
Copy link
Collaborator

…econditioners.py

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.

CharlelieLrt and others added 2 commits February 18, 2026 19:29
@CharlelieLrt
Copy link
Collaborator Author

/blossom-ci

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 19, 2026

Greptile Summary

This PR introduces DSMLoss (Denoising Score Matching loss) for training diffusion models, along with supporting infrastructure changes to noise schedulers and preconditioners.

Major additions:

  • New DSMLoss class in physicsnemo/diffusion/metrics/losses.py with comprehensive documentation, examples, and support for both x0-prediction and score-prediction training modes
  • Added loss_weight() method to all noise scheduler implementations to compute per-sample training weights
  • Added score_to_x0() method to LinearGaussianNoiseScheduler for converting score predictions to x0 estimates

Improvements to noise schedulers:

  • Changed training time sampling in EDMNoiseScheduler and StudentTEDMNoiseScheduler from log-uniform to log-normal distribution
  • Added new parameters (sigma_data, P_mean, P_std) to EDM-based schedulers for better control
  • Fixed _sample_student_t signature to use *shape instead of shape: Tuple[int, ...] for cleaner syntax

Bug fixes:

  • Removed unused _exponent helper method from VPNoiseScheduler and inlined its logic into alpha() method
  • Fixed Student-t sampling to properly handle device and dtype parameters

Documentation updates:

  • Enhanced preconditioner docstrings to clarify terminology ("noise schedule" → "time-to-noise-level mapping")
  • Added usage guidance linking each preconditioner to its corresponding noise scheduler and loss function
  • All new code follows NumPy docstring conventions with proper LaTeX math notation

Important Files Changed

Filename Overview
physicsnemo/diffusion/metrics/losses.py New DSMLoss class implementation with comprehensive docstrings and examples, following NumPy-style conventions
physicsnemo/diffusion/noise_schedulers/noise_schedulers.py Added loss_weight and score_to_x0 methods to NoiseScheduler protocol and implementations; updated EDM/StudentT time sampling to log-normal; refactored VPNoiseScheduler to inline _exponent; fixed Student-t sampling signature

Last reviewed commit: 0dd567e

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.

4 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@CharlelieLrt CharlelieLrt changed the base branch from main to 2.0.0-rc February 19, 2026 19:09
@CharlelieLrt
Copy link
Collaborator Author

/blossom-ci

Signed-off-by: Charlelie Laurent <claurent@nvidia.com>
@CharlelieLrt
Copy link
Collaborator Author

/blossom-ci

@CharlelieLrt
Copy link
Collaborator Author

/blossom-ci

Copy link
Collaborator

@pzharrington pzharrington left a comment

Choose a reason for hiding this comment

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

LGTM!

@CharlelieLrt
Copy link
Collaborator Author

/blossom-ci

auto-merge was automatically disabled February 20, 2026 19:50

Merge commits are not allowed on this repository

@CharlelieLrt CharlelieLrt merged commit 2f2099a into NVIDIA:2.0.0-rc Feb 20, 2026
1 check passed
ktangsali pushed a commit that referenced this pull request Feb 25, 2026
#1430)

* DSMLoss implementation + minor bugfixes in noise_schedulers.py and preconditioners.py

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

* Bugfix for missing abstract class in noise_schedulers.py

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

* Grammar improvements

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

* Added 'reduction' argument to MSEDSMLoss + added new WeightedMSEDSMLoss

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