Skip to content

Add configurable CorrDiff regression loss selection - #1877

Open
younes-abid wants to merge 3 commits into
NVIDIA:mainfrom
younes-abid:feature/space42-regression-losses
Open

Add configurable CorrDiff regression loss selection#1877
younes-abid wants to merge 3 commits into
NVIDIA:mainfrom
younes-abid:feature/space42-regression-losses

Conversation

@younes-abid

Copy link
Copy Markdown
Contributor

PhysicsNeMo Pull Request

Description

This PR adds configurable regression loss selection for the CorrDiff training
path when using regression and lt_aware_regression model names.

What changed

  • Added a configurable loss field in CorrDiff regression model configs.
  • Added loss selector wiring in examples/weather/corrdiff/train.py, with
    RegressionLoss as default to preserve existing behavior.
  • Added robust selectable regression loss variants:
    • RegressionHuberLoss
    • RegressionCharbonnierLoss
    • RegressionEdgeAwareLoss
    • RegressionShiftTolerantLoss
    • RegressionHybridStructuralLoss
  • Exported the new loss classes through the diffusion metrics public API.
  • Added tests covering the new selectable regression losses.
  • Added a changelog entry for this user-visible feature.

Why

This improves flexibility for CorrDiff regression training by allowing loss
function selection from config without changing code, while preserving backward
compatibility through the existing default loss.

Checklist

Dependencies

No new runtime dependencies were added.

Review Process

I understand this PR will be reviewed by the PhysicsNeMo team and that
AI-generated comments are advisory.

Signed-off-by: younes.abid <mr.younes.abid@gmail.com>
@copy-pr-bot

copy-pr-bot Bot commented Jul 28, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions

Copy link
Copy Markdown
Contributor

CODEOWNERS review map

Current for commit 27606bef7387. An approval covers every file listed for that owner; one owner is sufficient for shared files.

@CharlelieLrt — 5 file(s)
  • examples/weather/corrdiff/conf/base/model/lt_aware_regression.yaml
  • examples/weather/corrdiff/conf/base/model/regression.yaml
  • examples/weather/corrdiff/train.py
  • physicsnemo/diffusion/metrics/init.py
  • physicsnemo/diffusion/metrics/legacy_losses.py

No CODEOWNER

  • CHANGELOG.md
  • test/metrics/diffusion/test_losses.py

Comment /codeowners-info to refresh.

Comment thread physicsnemo/diffusion/metrics/legacy_losses.py Outdated
@greptile-apps

greptile-apps Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds configurable CorrDiff regression-loss selection while preserving RegressionLoss as the default.

  • Introduces Huber, Charbonnier, edge-aware, shift-tolerant, and hybrid structural regression losses.
  • Exports the new losses through the diffusion metrics API and wires them into CorrDiff training configuration.
  • Adds basic invocation and output-shape coverage for each selectable loss.
  • Documents the selectable variants in the model configurations and changelog.

Important Files Changed

Filename Overview
physicsnemo/diffusion/metrics/legacy_losses.py Adds shared regression forwarding helpers and five robust or structural losses; the shift-tolerant variant performs independent per-pixel shift selection rather than coherent alignment.
examples/weather/corrdiff/train.py Resolves configured regression loss names through a fixed allowlist and retains the original loss as the backward-compatible default.
test/metrics/diffusion/test_losses.py Adds basic callability, tensor-type, and output-shape coverage, but does not distinguish coherent shift alignment from per-pixel matching.
physicsnemo/diffusion/metrics/init.py Exposes the new regression losses through the existing diffusion metrics public API.
examples/weather/corrdiff/conf/base/model/regression.yaml Adds the default regression loss setting and documents available selectors.
examples/weather/corrdiff/conf/base/model/lt_aware_regression.yaml Adds the same backward-compatible loss selection to lead-time-aware regression.

Reviews (1): Last reviewed commit: "Add configurable CorrDiff regression los..." | Re-trigger Greptile

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.

1 participant