-
Notifications
You must be signed in to change notification settings - Fork 94
feat!: aggregate losses for temporal downscaler #1069
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
mc4117
wants to merge
105
commits into
main
Choose a base branch
from
feat/aggregate_loss
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
Changes from all commits
Commits
Show all changes
105 commits
Select commit
Hold shift + click to select a range
6301adb
first attempt at implementing aggregate loss
mc4117 471f7f3
Merge branch 'main' into feat/aggregate_loss
mc4117 b83e921
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 6377c1a
tidy up doc string
mc4117 3b8769b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] eef75dd
fix tests
mc4117 97e5af7
Merge branch 'feat/aggregate_loss' of https://github.com/ecmwf/anemoi…
mc4117 febab85
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] ebd75f9
update schema
mc4117 a5168d5
Merge branch 'feat/aggregate_loss' of https://github.com/ecmwf/anemoi…
mc4117 63a0ff7
update name
mc4117 af56b79
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] d743272
Rename AggregateLossWrapper to TimeAggregateLossWrapper
mc4117 04ba026
Merge branch 'main' into feat/aggregate_loss
mc4117 aa68344
fix schema
mc4117 eb43110
Merge branch 'feat/aggregate_loss' of https://github.com/ecmwf/anemoi…
mc4117 3746fb3
fix schema and add restriction
mc4117 fd94837
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] e137d26
fix configs
mc4117 913bad3
rm unnecessary test
mc4117 399d142
Merge branch 'feat/aggregate_loss' of https://github.com/ecmwf/anemoi…
mc4117 7583dff
fix failing tests
mc4117 e795398
fix integration test
mc4117 3cb9aee
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 0110498
Remove extra Config class from training schema
mc4117 8a8a788
different approach
mc4117 d1cb040
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 459d117
fix tests
mc4117 516fd0c
Merge branch 'feat/aggregate_loss' of https://github.com/ecmwf/anemoi…
mc4117 e043045
update tests
mc4117 5756e88
fix schema
mc4117 d12f446
update schema
mc4117 cb276f4
making time aggregate losses work for multi datasets
mc4117 e9e8476
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] e89565c
update losses in config
mc4117 6e5d9f0
Merge branch 'feat/aggregate_loss' of https://github.com/ecmwf/anemoi…
mc4117 927d9c9
Merge branch 'main' into feat/aggregate_loss
mc4117 f445b21
different approach adding loss folders
mc4117 d7a0ff6
fix merge
mc4117 59c0e11
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 6cb6e87
rename losses
mc4117 bc392ea
Merge branch 'feat/aggregate_loss' of https://github.com/ecmwf/anemoi…
mc4117 fd08cc4
rm folder
mc4117 c98565e
update configs
mc4117 c9d7748
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 9d5cc64
Clean up single.yaml by removing loss functions comments
mc4117 6390053
Remove commented-out loss function section
mc4117 3ad6f9e
ensemle loss
mc4117 dadbc78
merge
mc4117 ba4aeee
fix integration
mc4117 3d23170
fix pre commit
mc4117 3b0d59e
fix integration tests
mc4117 426891e
revert change to base loss
mc4117 9384302
fix failing test
mc4117 8981866
update documentation
mc4117 6df1df5
Merge branch 'main' into feat/aggregate_loss
mc4117 009e07f
feat: add BaseLossWrapper as transparent loss wrapper base class (#1082)
VeraChristina d246cec
preserve inner loss squash mode when defaults are used ; use amin amax
ssmmnn11 8b67732
change loss calculation
mc4117 0aaf41c
revert change mod
mc4117 b84c7ca
fix merge conflict
mc4117 c0e88d5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 3f7dab5
rm configs
mc4117 c8d24a1
merge
mc4117 b0e7a7c
fix failing schema
mc4117 99497a0
fix failing tests
mc4117 e726b5c
fix pre commit
mc4117 b72f0f9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] b83c8aa
change scalings
mc4117 f2d26c9
Merge branch 'feat/aggregate_loss' of https://github.com/ecmwf/anemoi…
mc4117 79f690d
fix failing tests
mc4117 a4c5df3
fix schema
mc4117 043a14b
fix ensemble crps
mc4117 341c1c6
Merge branch 'main' into feat/aggregate_loss
mc4117 75e9373
fix failing tests
mc4117 08f70ac
fix tests
mc4117 570f638
rename to composite loss
mc4117 abb61f5
update docs
mc4117 061c01c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 9d4b4ef
rename
mc4117 f1ff222
fix failing test
mc4117 db62241
Merge branch 'main' into feat/aggregate_loss
mc4117 ff44365
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 421e6c0
fix scalers
mc4117 e95d0e8
Merge branch 'feat/aggregate_loss' of https://github.com/ecmwf/anemoi…
mc4117 503436d
update combined loss
mc4117 eb6a41c
update tests
mc4117 0d36005
fix merge conflict
mc4117 4a62954
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] aaff297
fix failing tests
mc4117 de95899
Merge branch 'feat/aggregate_loss' of https://github.com/ecmwf/anemoi…
mc4117 f0643ac
pre commit hook
mc4117 5c409a3
update behaviour
mc4117 4427846
fix pre commit
mc4117 df2098e
fix tests
mc4117 edf05b4
merge conflict
mc4117 056d047
add per timestep callback
mc4117 e550145
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] de82ddf
fix unit tests
mc4117 5ae450f
Merge branch 'feat/aggregate_loss' of https://github.com/ecmwf/anemoi…
mc4117 b04654c
tests
mc4117 210f5d1
Merge branch 'main' into feat/aggregate_loss
mc4117 e7db74f
tests
mc4117 b2b51b3
Merge branch 'feat/aggregate_loss' of https://github.com/ecmwf/anemoi…
mc4117 31ee3a0
update config
mc4117 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
Binary file not shown.
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
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
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 |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| --- | ||
| defaults: | ||
| - scalers: global | ||
| - training_loss: single | ||
| - optimization: default | ||
| - weight_averaging: null | ||
|
|
||
|
|
||
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
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
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
22 changes: 22 additions & 0 deletions
22
training/src/anemoi/training/config/training/training_loss/ensemble.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,22 @@ | ||
| # loss function for the model | ||
| # To train without multiscale loss, set it to the desired loss directly | ||
| datasets: | ||
| data: # user-defined key in data | ||
| # loss class to initialise, can be anything subclassing torch.nn.Module | ||
| _target_: anemoi.training.losses.MultiscaleLossWrapper | ||
| # Disk mode: multiscale_config: {loss_matrices_path: /path, loss_matrices: ["file.npz", null]} | ||
| # On-the-fly: multiscale_config: {num_scales: 4, base_num_nearest_neighbours: 16, base_sigma: 0.01570} | ||
| multiscale_config: null # null = single scale, no smoothing | ||
| weights: [1.0] | ||
| per_scale_loss: | ||
| _target_: anemoi.training.losses.CRPS | ||
| scalers: ['pressure_level', 'general_variable', 'nan_mask_weights', 'node_weights', 'time_steps'] | ||
|
|
||
| # Scalers to include in loss calculation | ||
| # A selection of available scalers are listed in training/scalers. | ||
| # '*' is a valid entry to use all `scalers` given, if a scaler is to be excluded | ||
| # add `!scaler_name`, i.e. ['*', '!scaler_1'], and `scaler_1` will not be added. | ||
| # scalers: ['pressure_level', 'general_variable', 'nan_mask_weights', 'node_weights'] | ||
| ignore_nans: False | ||
| no_autocast: True | ||
| alpha: 0.95 |
27 changes: 27 additions & 0 deletions
27
...ng/src/anemoi/training/config/training/training_loss/ensemble_multiscale_aggregation.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,27 @@ | ||
| datasets: | ||
| data: | ||
| _target_: anemoi.training.losses.combined.CombinedLoss | ||
| ignore_nans: False | ||
| # loss_weights: [n_timesteps / (n_timesteps + n_agg_ops), n_agg_ops / (n_timesteps + n_agg_ops)] | ||
| # Each sub-loss averages internally (raw over timesteps, aggregate over agg ops). | ||
| # These weights re-scale so the total matches: sum_all / (n_timesteps + n_agg_ops). | ||
| # Example for 6 timesteps and 4 agg ops: [0.6, 0.4] | ||
| loss_weights: [0.6, 0.4] | ||
| losses: | ||
| - _target_: anemoi.training.losses.MultiscaleLossWrapper | ||
| multiscale_config: null # null = single scale, no smoothing | ||
| weights: [1.0] | ||
| per_scale_loss: | ||
| _target_: anemoi.training.losses.CRPS | ||
| scalers: ['pressure_level', 'general_variable', 'nan_mask_weights', 'node_weights', 'time_steps'] | ||
| ignore_nans: False | ||
| no_autocast: True | ||
| alpha: 0.95 | ||
| - _target_: anemoi.training.losses.aggregate.TimeAggregateLossWrapper | ||
| scalers: ['pressure_level', 'general_variable', 'nan_mask_weights', 'node_weights'] | ||
| time_aggregation_types: [mean, max, min, diff] | ||
| loss_fn: | ||
| _target_: anemoi.training.losses.CRPS | ||
| ignore_nans: False | ||
| no_autocast: True | ||
| alpha: 0.95 | ||
9 changes: 9 additions & 0 deletions
9
training/src/anemoi/training/config/training/training_loss/single.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,9 @@ | ||
| datasets: | ||
| data: | ||
| _target_: anemoi.training.losses.MSELoss | ||
| # Scalers to include in loss calculation | ||
| # A selection of available scalers are listed in training/scalers. | ||
| # '*' is a valid entry to use all `scalers` given, if a scaler is to be excluded | ||
| # add `!scaler_name`, i.e. ['*', '!scaler_1'], and `scaler_1` will not be added. | ||
| scalers: ['pressure_level', 'general_variable', 'node_weights', 'time_steps'] | ||
| ignore_nans: False |
19 changes: 19 additions & 0 deletions
19
training/src/anemoi/training/config/training/training_loss/single_MSE_aggregation.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,19 @@ | ||
| datasets: | ||
|
mc4117 marked this conversation as resolved.
|
||
| data: | ||
| _target_: anemoi.training.losses.combined.CombinedLoss | ||
| ignore_nans: False | ||
| # loss_weights: [n_timesteps / (n_timesteps + n_agg_ops), n_agg_ops / (n_timesteps + n_agg_ops)] | ||
| # Each sub-loss averages internally (raw over timesteps, aggregate over agg ops). | ||
| # These weights re-scale so the total matches: sum_all / (n_timesteps + n_agg_ops). | ||
| # Example for 6 timesteps and 4 agg ops: [0.6, 0.4] | ||
| loss_weights: [0.6, 0.4] | ||
| losses: | ||
| - _target_: anemoi.training.losses.MSELoss | ||
| scalers: ['pressure_level', 'general_variable', 'node_weights', 'time_steps'] | ||
| ignore_nans: False | ||
| - _target_: anemoi.training.losses.aggregate.TimeAggregateLossWrapper | ||
| scalers: ['pressure_level', 'general_variable', 'node_weights'] | ||
| time_aggregation_types: [mean, max, min, diff] | ||
| loss_fn: | ||
| _target_: anemoi.training.losses.MSELoss | ||
| ignore_nans: False | ||
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.