Skip to content

Refactored diffusion sampler#1363

Merged
CharlelieLrt merged 254 commits intoNVIDIA:mainfrom
CharlelieLrt:diffusion-samplers-and-guidance
Feb 18, 2026
Merged

Refactored diffusion sampler#1363
CharlelieLrt merged 254 commits intoNVIDIA:mainfrom
CharlelieLrt:diffusion-samplers-and-guidance

Conversation

@CharlelieLrt
Copy link
Collaborator

PhysicsNeMo Pull Request

Description

Overview

This PR introduces a new modular framework for diffusion model sampling, designed to decouple the core components of the sampling process for maximum flexibility and reusability.

Key Contributions

Decoupled Architecture

  • Model-agnostic: The sampling function now works with any model implementing the DiffusionDenoiser protocol—shape-agnostic, dimension-agnostic, and supports arbitrary conditioning/guidance
  • Solver ↔ Noise Schedule decoupling: Numerical solvers and noise schedules are now independent, allowing any combination
  • Flexible time-steps: Time-step discretization can optionally be overridden independently of both solver and noise schedule

New Abstractions

Solver Protocol (physicsnemo.diffusion.samplers.solvers)

Defines a minimal interface for numerical integration methods; 4 concrete solver implementations: Euler, Heun, and their respective EDM-stochastic versions.

NoiseScheduler Protocol (physicsnemo.diffusion.noise_schedulers)

Defines minimal interface for training (add_noise, sample_time) and sampling (timesteps, init_latents, get_denoiser). A base class (LinearGaussianNoiseScheduler) implements the protocol for the family of linear-Gaussian schedules; 6 concrete implementation of such noise schedulers: LinearGaussianNoiseScheduler, EDMNoiseScheduler, VENoiseScheduler, VPNoiseScheduler, IDDPMNoiseScheduler, StudentTEDMNoiseScheduler.

DiffusionDenoiser Protocol (physicsnemo.diffusion.base)

Minimal interface for denoisers.

New sample Function (physicsnemo.diffusion.samplers.sample)

Unified entry point for sampling with:

  • Configurable solver (string key or custom instance)
  • Configurable noise scheduler
  • Optional custom time-steps
  • Support for intermediate sample collection

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.

coreyjadams and others added 30 commits November 3, 2025 11:16
phsyicsnemo.utils, launch.config is just gone.  It was empty.
* Move filesystems and version_check to core

* Fix version check tests

* Reorganize distributed, domain_parallel, and begin nn / utils cleanup.

* Move modules and meta to core.  Move registry to core.

No tests fixed yet.

* Add missing init files

* Update build system and specify some deps.

* Reorganize tests.

* Update init files

* Clean up neighbor tools.

* Update testing

* Fix compat tests

* Move core model tests to tests/core/

* Add import lint config

* Relocate layers

* Move graphcast utils into model directory

* Relocating util functionalities.

* Add FIGConvNet to crash example (NVIDIA#1207)

* Add FIGConvNet to crash example.

* Add FIGConvNet to crash example

* Update model config

* propose fix some typos (NVIDIA#1209)

Signed-off-by: John E <jeis4wpi@outlook.com>
Co-authored-by: Corey adams <6619961+coreyjadams@users.noreply.github.com>

* Further clean up and organize tests.

* utils tests are passing now

* Cleaning up distributed tests

* Patching tests working again in nn

* Fix sdf test

* Fix zenith angle tests

* Some organization of tests.  Checkpoints is moved into utils.

* Remove launch.utils and launch.config.  Checkpointing is moved to
phsyicsnemo.utils, launch.config is just gone.  It was empty.

* Most nn tests are passing

* Further cleanup.  Getting there!

* Remove constants file

* Add import linting to pre-commit.

---------

Signed-off-by: John E <jeis4wpi@outlook.com>
Co-authored-by: Alexey Kamenev <alex.kamenev@gmail.com>
Co-authored-by: John Eismeier <42679190+jeis4wpi@users.noreply.github.com>
* unmigrate the insolation utils

* Revert test and compat map

* Update importlinter
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 31, 2026

Additional Comments (1)

physicsnemo/diffusion/noise_schedulers/noise_schedulers.py
1725 lines of noise scheduler implementations without tests. MOD-008a, MOD-008b require comprehensive tests for all 6 scheduler classes.

Add tests verifying:

  • Constructor/attributes with default and custom parameters
  • Non-regression tests for timesteps(), sample_time(), add_noise(), init_latents(), get_denoiser() against reference data
  • Abstract method implementations across configurations

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.

Nice job with this, really only minor comments/clarifications. While I know you have the CI tests as a remaining to-do, would be a good sanity check to make sure piping together the new machinery can reproduce the result from one of the previous more rigid/standalone samplers.

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

Approving to unblock, pending small usability improvements for the get_denoiser + adding (or renaming) a DiffusionOperator call to help clear up type confusion.

@CharlelieLrt CharlelieLrt added the ! - Release PRs or Issues releating to a release label Feb 13, 2026
Signed-off-by: Charlelie Laurent <claurent@nvidia.com>
Signed-off-by: Charlelie Laurent <claurent@nvidia.com>
Signed-off-by: Charlelie Laurent <claurent@nvidia.com>
Signed-off-by: Charlelie Laurent <claurent@nvidia.com>
Signed-off-by: Charlelie Laurent <claurent@nvidia.com>
Signed-off-by: Charlelie Laurent <claurent@nvidia.com>
Signed-off-by: Charlelie Laurent <claurent@nvidia.com>
Signed-off-by: Charlelie Laurent <claurent@nvidia.com>
Signed-off-by: Charlelie Laurent <claurent@nvidia.com>
@CharlelieLrt
Copy link
Collaborator Author

/blossom-ci

@CharlelieLrt CharlelieLrt added this pull request to the merge queue Feb 18, 2026
Merged via the queue into NVIDIA:main with commit 04236a2 Feb 18, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3 - Ready for Review Ready for review by team ! - Release PRs or Issues releating to a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants