Repository navigation
Add Corrdiff-era5-hrrr #2088
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Dibyajyoti-Chakraborty
wants to merge
12
commits into
NVIDIA:main
Choose a base branch
from
Dibyajyoti-Chakraborty:corrdiff-era5-hrrr
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add Corrdiff-era5-hrrr #2088
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
b0d4b81
Corrdiff-era5-hrrr initial commit
398c301
Fixed greptile comments
dcea286
Merge branch 'main' into corrdiff-era5-hrrr
Dibyajyoti-Chakraborty b2ae0d9
Merge branch 'main' into corrdiff-era5-hrrr
Dibyajyoti-Chakraborty c8b9acf
Merge branch 'NVIDIA:main' into corrdiff-era5-hrrr
Dibyajyoti-Chakraborty b3f0255
Adds the CorrDiff-ERA5-HRRR downscaling recipe to the
1b6094b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 8624f0f
Bug fixes for tests
171729a
Merge branch 'main' into corrdiff-era5-hrrr
Dibyajyoti-Chakraborty 22a1600
Multi gpu tests. Readme updates
6981554
Merge branch 'main' into corrdiff-era5-hrrr
Dibyajyoti-Chakraborty db90c68
Updated changelog
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,4 +2,4 @@ | |
| *.png | ||
| *.pt | ||
| *.tfevents* | ||
| *wandb/ | ||
| *wandb/*.nc | ||
Large diffs are not rendered by default.
Oops, something went wrong.
75 changes: 75 additions & 0 deletions
75
examples/weather/regional_weather_diffusion/config/corrdiff_era5_hrrr.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2023 - 2026 NVIDIA CORPORATION & AFFILIATES. | ||
| # SPDX-FileCopyrightText: All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # Defaults | ||
|
|
||
| # CorrDiff-ERA5-HRRR: kilometer-scale downscaling of ERA5 to the 3 km HRRR grid | ||
| # over the contiguous US with x-prediction rectified flow matching: | ||
| # - noisy states x_t = (1 - t) x0 + t eps with t drawn uniformly from [0, 1] | ||
| # - the DiT predicts the clean HRRR state x0, the loss is ||x0_hat - x0||^2 | ||
| # - trained on random 256 x 256 patches of the 1024 x 1792 HRRR domain | ||
|
|
||
| defaults: | ||
|
|
||
| # Dataset | ||
| - dataset/corrdiff_era5_hrrr | ||
|
|
||
| # Model | ||
| - model/corrdiff_era5_hrrr | ||
|
|
||
| # Training | ||
| - training/default | ||
|
|
||
| # Sampler | ||
| - sampler/rectified_flow | ||
|
|
||
| # Hydra | ||
| - hydra/default | ||
|
|
||
| - _self_ | ||
|
|
||
| training: | ||
| experiment_name: 'corrdiff-era5-hrrr' | ||
| num_data_workers: 8 | ||
|
|
||
| checkpoint_freq: 7812 # How often to save the checkpoints (8 GB each), measured in number of training steps (7812 steps = 0.5M samples) | ||
| validation_freq: 1562 # How often to record the validation loss, measured in number of training steps (1562 steps = 100k samples) | ||
| validation_steps: 8 | ||
| validation_plot_variables: ["u10m", "v10m", "t2m", "refc"] | ||
| validation_plot_background_channels: ["u10m", "t2m"] | ||
|
|
||
| batch_size: 64 | ||
| batch_size_per_gpu: 2 # 2 samples per GPU use about 68 GB; gradients are accumulated on fewer than 32 GPUs | ||
| total_train_steps: 781250 # 781250 steps with batch size 64 = 50M samples | ||
| clip_grad_norm: 1.0 | ||
|
|
||
| perf: | ||
| fp_optimizations: amp-bf16 | ||
|
|
||
| optimizer: | ||
| name: "adamw" | ||
| lr: 1.0E-4 | ||
| betas: [0.9, 0.99] | ||
| weight_decay: 0.0 | ||
|
|
||
| scheduler: | ||
| name: "CosineAnnealingLR" # cosine decay to zero at total_train_steps after the warmup | ||
| lr_rampup_steps: 1000 | ||
|
|
||
| loss: | ||
| type: 'flow_matching' | ||
| prediction_type: 'x0' # the network predicts the clean state (x-prediction) | ||
| t_min: 0.0 # Lowest time (clean data) | ||
| t_max: 1.0 # Highest time (pure noise), where the sampling starts |
40 changes: 40 additions & 0 deletions
40
examples/weather/regional_weather_diffusion/config/dataset/corrdiff_era5_hrrr.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2023 - 2026 NVIDIA CORPORATION & AFFILIATES. | ||
| # SPDX-FileCopyrightText: All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # Defaults | ||
| name: data_loader_corrdiff_era5_hrrr.CorrDiffEra5HrrrDataset # Dataset class module and name, in any module in `datasets` folder | ||
|
|
||
| # Main dataset, see datasets/data_loader_corrdiff_era5_hrrr.py for the expected layout | ||
| data_path: 'data' # Path to the dataset | ||
| years: [2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025] # Years of data to load | ||
|
|
||
| # Temporal selection: data starts at the HRRR version change in 2018, | ||
| # missing samples are automatically excluded | ||
| time_range_train: ["2018-07-01T00:00:00", "2025-10-01T00:00:00"] | ||
| time_range_valid: ["2025-10-01T00:00:00", "2026-01-01T00:00:00"] | ||
|
|
||
| # Domain | ||
| crop_window: [[17, 1041], [3, 1795]] # [[y0, y1], [x0, x1]] window of the HRRR grid, 1024 x 1792 pixels | ||
| patch_shape: [256, 256] # Shape of the random training patches; null for the full domain | ||
|
|
||
| # Static fields appended to the background channels | ||
| invariant_variables: ["elev_mean", "elev_std", "lsm_mean"] | ||
|
|
||
| # Droppable inputs: during training, each listed ERA5 variable is independently | ||
| # replaced by its climatological mean with probability drop_prob. A presence | ||
| # flag per variable (1 = kept, 0 = dropped) is passed to the model with the | ||
| # scalar conditions, so the model can also run without these inputs. | ||
| drop_variables: ["tcwv", "sp"] | ||
| drop_prob: 0.5 | ||
49 changes: 49 additions & 0 deletions
49
examples/weather/regional_weather_diffusion/config/model/corrdiff_era5_hrrr.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2023 - 2026 NVIDIA CORPORATION & AFFILIATES. | ||
| # SPDX-FileCopyrightText: All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # Defaults | ||
|
|
||
| # Diffusion transformer (DiT) of CorrDiff-ERA5-HRRR: 678M parameters, | ||
| # neighborhood attention with 2D rotary position embeddings, trained with | ||
| # x-prediction rectified flow matching (training.loss.type: flow_matching). | ||
| # These settings match the released checkpoint. | ||
|
|
||
| # Model name | ||
| model_name: 'diffusion' | ||
|
|
||
| architecture: dit | ||
|
|
||
| # Preconditioner: the times are multiplied by time_scale before the DiT | ||
| # timestep embedding, the network output is the prediction itself | ||
| preconditioner: time_scaled | ||
|
pzharrington marked this conversation as resolved.
Resolved
|
||
| time_scale: 999.0 # Flow-matching times in [0, 1] are multiplied by this | ||
|
|
||
| # Model conditions: pure downscaling, the low-resolution ERA5 fields (with the | ||
| # static fields appended by the dataset) condition the model | ||
| regression_conditions: [] | ||
| diffusion_conditions: ["background"] | ||
|
|
||
| # Model hyperparameters | ||
| hyperparameters: | ||
| hidden_size: 1152 # Number of channels in the transformer blocks | ||
| depth: 28 # Number of transformer blocks | ||
| num_heads: 18 # Number of attention heads | ||
| patch_size: 2 # Size of the patches embedded as tokens | ||
| attn_kernel_size: 31 # Neighborhood size of the attention, in tokens | ||
| attention_backend: natten2d_rope # Neighborhood attention with 2D rotary position embeddings | ||
| layernorm_backend: torch # Layer normalization backend of the blocks, "torch" or "apex" | ||
| attn_kwargs: | ||
| qk_norm: true # Normalize the attention queries and keys, stabilizes bf16 training | ||
| norm_layer: apex # Apex LayerNorm keeps the bf16 dtype that NATTEN needs for queries, keys, and values | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
examples/weather/regional_weather_diffusion/config/sampler/rectified_flow.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2023 - 2026 NVIDIA CORPORATION & AFFILIATES. | ||
| # SPDX-FileCopyrightText: All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # Defaults | ||
|
|
||
| # Sampler args for physicsnemo.diffusion.samplers.sample with a rectified-flow | ||
| # model (training.loss.type: flow_matching): integrates the rectified-flow ODE | ||
| # dx/dt = (x_t - x0_hat) / t from pure noise (t = 1) to t = 0. | ||
|
|
||
| name: 'Rectified flow' | ||
| args: | ||
| num_steps: 18 # Number of solver steps | ||
| solver: heun # "heun" (2nd order, 2 model evaluations per step) or "euler" (1st order) | ||
| time_shift: 1.0 # Time shift a, t -> a t / (1 + (a - 1) t); use a > 1 to sample a larger domain than the training patches | ||
| S_churn: 0. # Set > 0 for stochastic sampling (EDM-style churn, see the EDM paper); the churn of the solvers assumes alpha = 1 and is an approximation for rectified flow | ||
| S_min: 0. | ||
| S_max: .inf | ||
| S_noise: 1 |
78 changes: 78 additions & 0 deletions
78
examples/weather/regional_weather_diffusion/config/test_flow_matching.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2023 - 2026 NVIDIA CORPORATION & AFFILIATES. | ||
| # SPDX-FileCopyrightText: All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # Defaults | ||
|
|
||
| # Tiny DiT downscaling model trained with flow matching on mock data, used by | ||
| # test_training.py | ||
|
|
||
| # Defaults | ||
| defaults: | ||
|
|
||
| # Dataset | ||
| - dataset/mock | ||
|
|
||
| # Model | ||
| - model/corrdiff_era5_hrrr | ||
|
|
||
| # Training | ||
| - training/default | ||
|
|
||
| # Sampler | ||
| - sampler/rectified_flow | ||
|
|
||
| # Hydra | ||
| - hydra/default | ||
|
|
||
| - _self_ | ||
|
|
||
| training: | ||
| num_data_workers: 1 | ||
| validation_plot_variables: ["state_0"] | ||
| log_to_wandb: True | ||
| wandb_mode: "offline" # not using online logging while testing | ||
| log_to_tensorboard: True | ||
|
|
||
| print_progress_freq: 5 # How often to print progress, measured in number of training steps | ||
| checkpoint_freq: 5 # How often to save the checkpoints, measured in number of training steps | ||
| validation_freq: 5 # how often to record the validation loss, measured in number of training steps | ||
| batch_size: 1 | ||
| total_train_steps: 10 | ||
|
|
||
| optimizer: | ||
| name: "adamw" | ||
| betas: [0.9, 0.99] | ||
|
|
||
| scheduler: | ||
| name: null | ||
|
|
||
| loss: | ||
| type: 'flow_matching' | ||
| prediction_type: 'x0' | ||
|
|
||
| sampler: | ||
| args: | ||
| num_steps: 2 | ||
|
|
||
| dataset: | ||
| num_samples: 20 | ||
| model_type: downscaling | ||
|
|
||
| model: | ||
| hyperparameters: | ||
| depth: 2 | ||
| hidden_size: 32 | ||
| num_heads: 1 | ||
| attn_kernel_size: 7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.