-
Notifications
You must be signed in to change notification settings - Fork 3
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
2d flow #2301
Open
cynicalsavant
wants to merge
9
commits into
feature/diff-code
Choose a base branch
from
feature/diff-code-prakhar
base: feature/diff-code
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
2d flow #2301
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
39f6734
added 2d flow, manual weights to losses, l2 diffusion loss, same hp f…
57dad55
rollout code
0e8c6af
logscale support for quick load, appropriate changes in val loop
40989d3
refactor : 2d, 3d flow in one file, switches for logscale, multichann…
e504606
fixing default config params
ce63134
scripts to get data from bucket
134c003
fixing bugs after refactor
acec524
xarray dataloaders, ensemble dataloading, schedulers, histogram match…
b0aef29
Latest versions fixed for sampling, rvrt sampling still buggy, rvrt-i…
cynicalsavant 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 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 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,44 @@ | ||
from ml_collections import config_dict | ||
|
||
config = config_dict.ConfigDict() | ||
|
||
config.dim = 64 | ||
config.dim_mults = (1, 1, 2, 2, 3, 4) | ||
config.learned_sinusoidal_cond = True, | ||
config.random_fourier_features = True, | ||
config.learned_sinusoidal_dim = 32 | ||
config.diffusion_steps = 1500 | ||
config.sampling_steps = 20 | ||
config.loss = "focal" | ||
config.objective = "pred_v" | ||
config.lr = 1e-4 | ||
config.steps = 700000 | ||
config.grad_acc = 1 | ||
config.val_num_of_batch = 5 | ||
config.save_and_sample_every = 20000 | ||
config.ema_decay = 0.995 | ||
config.amp = False | ||
config.split_batches = True | ||
config.additional_note = "2d-multi-ls-focal-ensemble" | ||
config.eval_folder = "./evaluate" | ||
config.results_folder = "./results" | ||
config.tensorboard_dir = "./tensorboard" | ||
config.milestone = 1 | ||
config.rollout = None | ||
config.rollout_batch = None | ||
|
||
config.batch_size = 1 | ||
config.data_config = config_dict.ConfigDict({ | ||
"dataset_name": "c384", | ||
"length": 7, | ||
"channels": ["PRATEsfc_coarse"], | ||
"img_channel": 1, | ||
"img_size": 384, | ||
"logscale": True, | ||
"multi": True, | ||
"flow": "2d", | ||
"minipatch": False | ||
}) | ||
|
||
config.data_name = f"{config.data_config['dataset_name']}-{config.data_config['channels']}-{config.objective}-{config.loss}-d{config.dim}-t{config.diffusion_steps}{config.additional_note}" | ||
config.model_name = f"c384-{config.data_config['channels']}-{config.objective}-{config.loss}-d{config.dim}-t{config.diffusion_steps}{config.additional_note}" |
This file contains 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 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,37 @@ | ||
from ml_collections import config_dict | ||
|
||
config = config_dict.ConfigDict() | ||
|
||
config.lr = 1e-4 | ||
config.steps = 700000 | ||
config.grad_acc = 1 | ||
config.val_num_of_batch = 5 | ||
config.save_and_sample_every = 20000 | ||
config.ema_decay = 0.995 | ||
config.amp = False | ||
config.split_batches = True | ||
config.additional_note = "isr" | ||
config.eval_folder = "./evaluate" | ||
config.results_folder = "./results" | ||
config.tensorboard_dir = "./tensorboard" | ||
config.milestone = 1 | ||
config.rollout = None | ||
config.rollout_batch = None | ||
|
||
config.batch_size = 1 | ||
config.data_config = config_dict.ConfigDict({ | ||
"dataset_name": "c384", | ||
"length": 7, | ||
#"channels": ["UGRD10m_coarse","VGRD10m_coarse"], | ||
"channels": ["PRATEsfc_coarse"], | ||
#"img_channel": 2, | ||
"img_channel": 1, | ||
"img_size": 384, | ||
"logscale": True, | ||
"multi": True, | ||
"flow": "2d", | ||
"minipatch": False | ||
}) | ||
|
||
config.data_name = f"{config.data_config['dataset_name']}-{config.data_config['channels']}-{config.additional_note}" | ||
config.model_name = f"c384-{config.data_config['channels']}-{config.additional_note}" |
This file contains 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,37 @@ | ||
from ml_collections import config_dict | ||
|
||
config = config_dict.ConfigDict() | ||
|
||
config.lr = 1e-4 | ||
config.steps = 700000 | ||
config.grad_acc = 1 | ||
config.val_num_of_batch = 5 | ||
config.save_and_sample_every = 20000 | ||
config.ema_decay = 0.995 | ||
config.amp = False | ||
config.split_batches = True | ||
config.additional_note = "isr" | ||
config.eval_folder = "./evaluate" | ||
config.results_folder = "./results" | ||
config.tensorboard_dir = "./tensorboard" | ||
config.milestone = 2 | ||
config.rollout = 'partial' | ||
config.rollout_batch = 25 | ||
|
||
config.batch_size = 1 | ||
config.data_config = config_dict.ConfigDict({ | ||
"dataset_name": "c384", | ||
"length": 7, | ||
#"channels": ["UGRD10m_coarse","VGRD10m_coarse"], | ||
"channels": ["PRATEsfc_coarse"], | ||
#"img_channel": 2, | ||
"img_channel": 1, | ||
"img_size": 384, | ||
"logscale": True, | ||
"multi": True, | ||
"flow": "2d", | ||
"minipatch": False | ||
}) | ||
|
||
config.data_name = f"{config.data_config['dataset_name']}-{config.data_config['channels']}-{config.additional_note}" | ||
config.model_name = f"c384-{config.data_config['channels']}-{config.additional_note}" |
This file contains 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,50 @@ | ||
from ml_collections import config_dict | ||
|
||
#batch_size = 4 | ||
config = config_dict.ConfigDict() | ||
|
||
config.dim = 120 | ||
config.num_blocks = 6 | ||
config.num_heads = 8 | ||
config.depth = 8 | ||
config.time_emb_dim = 32 | ||
config.learned_sinusoidal_cond = True | ||
config.diffusion_steps = 1500 | ||
config.sampling_steps = 20 | ||
# config.loss = "l2" | ||
config.loss = "charbonnier" | ||
config.objective = "pred_x0" | ||
# config.lr = 8e-5 | ||
config.lr = 1e-4 | ||
# config.steps = 500000 | ||
config.steps = 700000 | ||
config.grad_acc = 1 | ||
config.val_num_of_batch = 5 | ||
config.save_and_sample_every = 20000 | ||
config.ema_decay = 0.999 | ||
config.amp = False | ||
config.split_batches = True | ||
config.additional_note = "rvrt_full" | ||
config.eval_folder = "./evaluate" | ||
config.results_folder = "./results" | ||
config.tensorboard_dir = "./tensorboard" | ||
config.milestone = 1 | ||
config.rollout = None | ||
config.rollout_batch = None | ||
|
||
config.batch_size = 1 | ||
config.data_config = config_dict.ConfigDict({ | ||
"dataset_name": "c384", | ||
"length": 6, | ||
#"channels": ["UGRD10m_coarse","VGRD10m_coarse"], | ||
"channels": ["PRATEsfc_coarse"], | ||
#"img_channel": 2, | ||
"img_channel": 1, | ||
"img_size": 384, | ||
"logscale": True, | ||
"multi": True, | ||
"minipatch": False | ||
}) | ||
|
||
config.data_name = f"{config.data_config['dataset_name']}-{config.data_config['channels']}-{config.additional_note}" | ||
config.model_name = f"c384-{config.data_config['channels']}-{config.additional_note}" |
This file contains 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,50 @@ | ||
from ml_collections import config_dict | ||
|
||
#batch_size = 4 | ||
config = config_dict.ConfigDict() | ||
|
||
config.dim = 120 | ||
config.num_blocks = 6 | ||
config.num_heads = 8 | ||
config.depth = 8 | ||
config.time_emb_dim = 32 | ||
config.learned_sinusoidal_cond = True | ||
config.diffusion_steps = 1500 | ||
config.sampling_steps = 20 | ||
# config.loss = "l2" | ||
config.loss = "charbonnier" | ||
config.objective = "pred_x0" | ||
# config.lr = 8e-5 | ||
config.lr = 1e-4 | ||
# config.steps = 500000 | ||
config.steps = 700000 | ||
config.grad_acc = 1 | ||
config.val_num_of_batch = 5 | ||
config.save_and_sample_every = 20000 | ||
config.ema_decay = 0.999 | ||
config.amp = False | ||
config.split_batches = True | ||
config.additional_note = "rvrt_full" | ||
config.eval_folder = "./evaluate" | ||
config.results_folder = "./results" | ||
config.tensorboard_dir = "./tensorboard" | ||
config.milestone = 2 | ||
config.rollout = 'partial' | ||
config.rollout_batch = 22 | ||
|
||
config.batch_size = 1 | ||
config.data_config = config_dict.ConfigDict({ | ||
"dataset_name": "c384", | ||
"length": 6, | ||
#"channels": ["UGRD10m_coarse","VGRD10m_coarse"], | ||
"channels": ["PRATEsfc_coarse"], | ||
#"img_channel": 2, | ||
"img_channel": 1, | ||
"img_size": 384, | ||
"logscale": True, | ||
"multi": True, | ||
"minipatch": False | ||
}) | ||
|
||
config.data_name = f"{config.data_config['dataset_name']}-{config.data_config['channels']}-{config.additional_note}" | ||
config.model_name = f"c384-{config.data_config['channels']}-{config.additional_note}" |
This file contains 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,29 @@ | ||
import xarray as xr | ||
import numpy as np | ||
from pathlib import Path | ||
|
||
channel_folder = Path('./more_channels') | ||
channel_folder.mkdir(exist_ok = True, parents = True) | ||
|
||
c384 = xr.open_zarr("gs://vcm-ml-raw-flexible-retention/2021-07-19-PIRE/C3072-to-C384-res-diagnostics/pire_atmos_phys_3h_coarse.zarr").rename({"grid_xt_coarse": "x", "grid_yt_coarse": "y"}) | ||
c48 = xr.open_zarr("gs://vcm-ml-intermediate/2021-10-12-PIRE-c48-post-spinup-verification/pire_atmos_phys_3h_coarse.zarr").rename({"grid_xt": "x", "grid_yt": "y"}) | ||
|
||
channels = ["UGRD10m_coarse", "VGRD10m_coarse", "tsfc_coarse", "CPRATEsfc_coarse"] | ||
c384_np = np.stack([c384[channel].values for channel in channels], axis = 2) | ||
c48_np = np.stack([c48[channel].values for channel in channels], axis = 2) | ||
|
||
split = int(c384_np.shape[1] * 0.8) | ||
|
||
# compute statistics on training set | ||
c384_min, c384_max, c48_min, c48_max = c384_np[:, :split, :, :, :].min(axis=(0,1,3,4)).reshape(1,1,4,1,1), c384_np[:, :split, :, :, :].max(axis=(0,1,3,4)).reshape(1,1,4,1,1), c48_np[:, :split, :, :, :].min(axis=(0,1,3,4)).reshape(1,1,4,1,1), c48_np[:, :split, :, :, :].max(axis=(0,1,3,4)).reshape(1,1,4,1,1) | ||
|
||
# normalize | ||
c384_norm= (c384_np - c384_min) / (c384_max - c384_min) | ||
c48_norm = (c48_np - c48_min) / (c48_max - c48_min) | ||
|
||
np.save('more_channels/c384_min.npy', c384_min) | ||
np.save('more_channels/c384_max.npy', c384_max) | ||
np.save('more_channels/c48_min.npy', c48_min) | ||
np.save('more_channels/c48_max.npy', c48_max) | ||
np.save('more_channels/c48_norm.npy', c48_norm) | ||
np.save('more_channels/c384_norm.npy', c384_norm) |
This file contains 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,13 @@ | ||
#! /bin/sh | ||
channel='c48_atmos_ave' | ||
file='atmos_8xdaily_ave_coarse.zarr' | ||
for member in $(seq -f "%04g" 1 11) | ||
do | ||
mkdir -p /data/prakhars/ensemble/$channel/$member | ||
gsutil -m cp -r gs://vcm-ml-raw-flexible-retention/2023-08-14-C384-reference-ensemble/ic_$member/diagnostics/$file /data/prakhars/ensemble/$channel/$member | ||
done | ||
# channel --> file | ||
# c384_precip_ave --> sfc_8xdaily_ave.zarr | ||
# c48_precip_plus_more_ave --> sfc_8xdaily_ave_coarse.zarr | ||
# c384_topo --> atmos_static.zarr | ||
# c48_atmos_ave --> atmos_8xdaily_ave_coarse.zarr |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a major change. It would be great if there was a clearly defined experiment behind this choice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran a couple of experiments with less number of epochs. But it was cluttering the project space of wandb so I deleted them