maxxxzdn commited on
Commit
2bf275e
·
verified ·
1 Parent(s): b2ac1e4

Reorganize bundled assets into checkpoints/ and data/ folders

Browse files
.gitignore CHANGED
@@ -9,9 +9,9 @@ build/
9
 
10
  # Model checkpoints are not stored in git — fetch from Hugging Face
11
  # (huggingface.co/maxxxzdn/mosaic) instead. On HF they live as LFS objects.
12
- *.pt
13
- *.pth
14
- *.ckpt
15
 
16
  # Generated forecast outputs (kept out of git but bundled .npz assets are tracked)
17
  verify_*.npz
 
9
 
10
  # Model checkpoints are not stored in git — fetch from Hugging Face
11
  # (huggingface.co/maxxxzdn/mosaic) instead. On HF they live as LFS objects.
12
+ checkpoints/*.pt
13
+ checkpoints/*.pth
14
+ checkpoints/*.ckpt
15
 
16
  # Generated forecast outputs (kept out of git but bundled .npz assets are tracked)
17
  verify_*.npz
README.md CHANGED
@@ -112,7 +112,7 @@ pip install gcsfs
112
 
113
  ## Getting the weights
114
 
115
- If you installed via Hugging Face (`huggingface-cli download maxxxzdn/mosaic --local-dir .`), the checkpoints (`era5_best.pt`, `hres_best.pt`) and normalization stats are already bundled and `inference.py` finds them in the working directory.
116
 
117
  If you cloned this repo from GitHub instead, the weights are not in the git tree (they live on the [Hugging Face mirror](https://huggingface.co/maxxxzdn/mosaic) as LFS objects). Fetch them with:
118
 
@@ -208,11 +208,11 @@ gs://weatherbench2/datasets/hres_t0/2016-2022-6h-240x121_equiangular_with_poles_
208
  | `base.py` | `WeatherModel` wrapper |
209
  | `config.py` | Variable / level definitions |
210
  | `dataset.py` | Metadata dataclasses |
211
- | `norm_stats_era5.npz` | Normalization statistics for the `era5` variant |
212
- | `norm_stats_hres.npz` | Normalization statistics for the `hres` variant |
213
- | `static_vars.npz` | Static fields (orography, land–sea mask, soil type) — shared between variants |
214
- | `era5_best.pt` | Trained checkpoint, `era5` variant (~1.7 GB) |
215
- | `hres_best.pt` | Trained checkpoint, `hres` variant (~1.7 GB) |
216
  | `figures_weather/` | Figures from the paper |
217
 
218
  ## Limitations
 
112
 
113
  ## Getting the weights
114
 
115
+ If you installed via Hugging Face (`huggingface-cli download maxxxzdn/mosaic --local-dir .`), the checkpoints (`checkpoints/era5_best.pt`, `checkpoints/hres_best.pt`) and normalization stats (`data/*.npz`) are already in place and `inference.py` finds them automatically.
116
 
117
  If you cloned this repo from GitHub instead, the weights are not in the git tree (they live on the [Hugging Face mirror](https://huggingface.co/maxxxzdn/mosaic) as LFS objects). Fetch them with:
118
 
 
208
  | `base.py` | `WeatherModel` wrapper |
209
  | `config.py` | Variable / level definitions |
210
  | `dataset.py` | Metadata dataclasses |
211
+ | `data/norm_stats_era5.npz` | Normalization statistics for the `era5` variant |
212
+ | `data/norm_stats_hres.npz` | Normalization statistics for the `hres` variant |
213
+ | `data/static_vars.npz` | Static fields (orography, land–sea mask, soil type) — shared between variants |
214
+ | `checkpoints/era5_best.pt` | Trained checkpoint, `era5` variant (~1.7 GB) — Hugging Face only |
215
+ | `checkpoints/hres_best.pt` | Trained checkpoint, `hres` variant (~1.7 GB) — Hugging Face only |
216
  | `figures_weather/` | Figures from the paper |
217
 
218
  ## Limitations
norm_stats_era5.npz → data/norm_stats_era5.npz RENAMED
File without changes
norm_stats_hres.npz → data/norm_stats_hres.npz RENAMED
File without changes
static_vars.npz → data/static_vars.npz RENAMED
File without changes
era5_best.pt DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:187df31a0caef3e934e4eb8a11506c9fea518ff0e02ce6d1f804fc6c8a78a940
3
- size 1713557607
 
 
 
 
hres_best.pt DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:6e0bc244382fa1b0f09ecdbd527c601d352cc5989697149742e8983f38a25e5e
3
- size 1714571315
 
 
 
 
inference.py CHANGED
@@ -102,15 +102,15 @@ class Preset:
102
  PRESETS = {
103
  "era5": Preset(
104
  step_stride=4, num_history_steps=2, k_neighbors=24,
105
- default_checkpoint="era5_best.pt",
106
- default_norm_stats="norm_stats_era5.npz",
107
  stage_cfgs=_STAGE_CFGS_COMMON,
108
  bottleneck_cfg=_BOTTLENECK_CFG_COMMON,
109
  ),
110
  "hres": Preset(
111
  step_stride=1, num_history_steps=4, k_neighbors=20,
112
- default_checkpoint="hres_best.pt",
113
- default_norm_stats="norm_stats_hres.npz",
114
  stage_cfgs=_STAGE_CFGS_COMMON,
115
  bottleneck_cfg=_BOTTLENECK_CFG_COMMON,
116
  ),
@@ -247,8 +247,8 @@ def build_model(
247
  longitude: np.ndarray,
248
  latitude: np.ndarray,
249
  preset: Preset,
250
- norm_stats_path: str = "norm_stats.npz",
251
- static_vars_path: str = "static_vars.npz",
252
  device: str = "cuda",
253
  ):
254
  """Build and return the WeatherModel with loaded checkpoint and metadata."""
@@ -412,8 +412,8 @@ def main():
412
  help="Output file path (default: forecast.npz)")
413
  parser.add_argument("--norm-stats", type=str, default=None,
414
  help="Path to norm_stats .npz. Default: preset's default_norm_stats")
415
- parser.add_argument("--static-vars", type=str, default="static_vars.npz",
416
- help="Path to static_vars.npz (default: static_vars.npz in current dir)")
417
  parser.add_argument("--k-neighbors", type=int, default=None,
418
  help="Override preset's k_neighbors (advanced — for ablation only)")
419
  parser.add_argument("--no-compile", action="store_true",
 
102
  PRESETS = {
103
  "era5": Preset(
104
  step_stride=4, num_history_steps=2, k_neighbors=24,
105
+ default_checkpoint="checkpoints/era5_best.pt",
106
+ default_norm_stats="data/norm_stats_era5.npz",
107
  stage_cfgs=_STAGE_CFGS_COMMON,
108
  bottleneck_cfg=_BOTTLENECK_CFG_COMMON,
109
  ),
110
  "hres": Preset(
111
  step_stride=1, num_history_steps=4, k_neighbors=20,
112
+ default_checkpoint="checkpoints/hres_best.pt",
113
+ default_norm_stats="data/norm_stats_hres.npz",
114
  stage_cfgs=_STAGE_CFGS_COMMON,
115
  bottleneck_cfg=_BOTTLENECK_CFG_COMMON,
116
  ),
 
247
  longitude: np.ndarray,
248
  latitude: np.ndarray,
249
  preset: Preset,
250
+ norm_stats_path: str = "data/norm_stats_era5.npz",
251
+ static_vars_path: str = "data/static_vars.npz",
252
  device: str = "cuda",
253
  ):
254
  """Build and return the WeatherModel with loaded checkpoint and metadata."""
 
412
  help="Output file path (default: forecast.npz)")
413
  parser.add_argument("--norm-stats", type=str, default=None,
414
  help="Path to norm_stats .npz. Default: preset's default_norm_stats")
415
+ parser.add_argument("--static-vars", type=str, default="data/static_vars.npz",
416
+ help="Path to static_vars.npz (default: data/static_vars.npz)")
417
  parser.add_argument("--k-neighbors", type=int, default=None,
418
  help="Override preset's k_neighbors (advanced — for ablation only)")
419
  parser.add_argument("--no-compile", action="store_true",