Skip to content

Fix missing num_steps parameter for stochastic sampler#1364

Open
younes-abid wants to merge 1 commit intoNVIDIA:mainfrom
younes-abid:fix/stochastic-sampler-num-steps
Open

Fix missing num_steps parameter for stochastic sampler#1364
younes-abid wants to merge 1 commit intoNVIDIA:mainfrom
younes-abid:fix/stochastic-sampler-num-steps

Conversation

@younes-abid
Copy link

@younes-abid younes-abid commented Feb 2, 2026

  • Add missing num_steps=cfg.sampler.num_steps parameter to stochastic_sampler partial() call
  • This bug caused stochastic sampler to always use default 18 steps instead of configured num_steps
  • Fixes inconsistency with deterministic sampler which correctly passes num_steps parameter
  • Improves performance when using different diffusion num_steps

PhysicsNeMo Pull Request

Description

This PR fixes a bug in the CorrDiff generation pipeline where the stochastic sampler was ignoring the configured num_steps
parameter and always using the default value of 18 steps, causing performance issues.

Problem: In generate.py, the partial() call for stochastic_sampler was missing the num_steps parameter, while the deterministic sampler correctly included it.

Solution: Added the missing num_steps=cfg.sampler.num_steps parameter to the stochastic sampler configuration.

Checklist

Dependencies

No new dependencies required.

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.

- Add missing num_steps=cfg.sampler.num_steps parameter to stochastic_sampler partial() call
- This bug caused stochastic sampler to always use default 18 steps instead of configured num_steps
- Fixes inconsistency with deterministic sampler which correctly passes num_steps parameter
- Improves performance when using fewer diffusion steps (e.g., num_steps=2)
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 2, 2026

Greptile Overview

Greptile Summary

Fixes a bug in the CorrDiff generation pipeline where the stochastic sampler was ignoring the configured num_steps parameter and always using the default value of 18 steps.

Changes:

  • Added num_steps=cfg.sampler.num_steps parameter to the stochastic_sampler partial() call on line 195
  • Brings stochastic sampler configuration in line with deterministic sampler (line 189) which already included this parameter
  • Allows users to configure different diffusion step counts for improved performance tuning

Impact:
This is a clean, focused bug fix that resolves a configuration inconsistency. Both sampler functions have num_steps: int = 18 as a default parameter, so the fix ensures the configured value is properly passed through.

Important Files Changed

Filename Overview
examples/weather/corrdiff/generate.py Added missing num_steps parameter to stochastic sampler configuration, fixing bug where it always used default 18 steps

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.

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

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

LGTM, thanks for the fix!

@CharlelieLrt
Copy link
Collaborator

/blossom-ci

@CharlelieLrt
Copy link
Collaborator

/blossom-ci

@CharlelieLrt
Copy link
Collaborator

@younes-abid the CI tests are failing because of code-formatting issues. Did you have pre-commit installed as detailed in the contributing guidelines? If not, you need to ruff-format your files

@CharlelieLrt
Copy link
Collaborator

@younes-abid following up on this. Could you please format your modified file such that we can then merge your PR? Thanks!

@younes-abid
Copy link
Author

ok
I will reformat it

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