OneScience-Group/metnet-3
<p align="center"> <strong><span style="font-size: 30px;">MetNet-3 Compact</span></strong> </p>
Model Overview
MetNet-3 is a regional high-resolution weather forecasting model designed for sparse observations, capable of predicting variables such as precipitation, temperature, dew point, and wind.
Paper: Deep Learning for Day Forecasts from Sparse Observations
https://arxiv.org/abs/2306.06079
Model Description
This directory provides an independent compact smoke implementation based on the paper, preserving multi-source input interfaces, lead-time conditioning, a sparse OMO mask, probabilistic outputs, and HRRR auxiliary regression. The input scale, temporal fusion, MaxViT backbone, and output resolution have all been simplified.
The current model is intended for functional verification only; it is not the official Google implementation and does not provide official pre-trained weights.
Use Cases
Usage
1. OneCode
Click to experience intelligent one-click AI4S programming
2. Manual Installation & Usage
Hardware Requirements
- CPU can run the current compact configuration.
- GPU is recommended for real data and larger configurations.
Download the Model Package
hf download OneScience-Group/MetNet-3 --local-dir ./MetNet-3
cd MetNet-3Set Up the Runtime Environment
DCU Environment
conda create -n onescience311 python=3.11 -y
conda activate onescience311
pip install onescience[earth-dcu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.aiGPU Environment
conda create -n onescience311 python=3.11 -y libstdcxx-ng=12 libgcc-ng=12 gcc_linux-64=12 gxx_linux-64=12
conda activate onescience311
pip install onescience[earth-gpu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.aiData
The current model/fake_data.py provides an indexable fake Dataset that generates MRMS, OMO, HRRR proxy, GOES proxy, topography, coordinates, time, and lead-time data and requires no additional download. Each sample excludes the batch dimension; the DataLoader concatenates samples into batches.
Training
python scripts/train.pyThe script performs multi-epoch multi-task training, independent validation, learning rate scheduling, and early stopping:
- Generates train/validation fake Datasets and multi-task targets;
- Validates the input schema on each batch;
- Computes precipitation cross-entropy, surface-variable cross-entropy, and HRRR MSE, and updates parameters;
- Computes validation loss on an independent validation Dataset;
- Saves latest/best checkpoints and history; supports
--resume; - The inference stage reads
weight/model.pth.
python scripts/train.py --epochs 10
python scripts/train.py --resume weight/training/latest.pth --epochs 20Checkpoint outputs:
weight/model.pth
weight/training/latest.pth
weight/training/best.pth
weight/training/history.jsonInference
python scripts/inference.pyInference results:
result/prediction.pt
result/target.pt
result/inference.jsonResult Inspection
python scripts/result.pyThe current output is generated from fake data and is intended only to verify that the model runs; it does not represent the paper's forecast skill metrics.
The result script generates result/metrics.json and result/comparison.png, reporting precipitation/surface MAE in normalized bin space, HRRR proxy RMSE, and probability normalization error — not the paper's CRPS, CSI, or physical-unit MAE.
Paper vs. Current Implementation I/O
The complete execution flow is train.py -> inference.py -> result.py. Individual fake Dataset samples have input shape [T,C,H,W] and targets as a corresponding multi-task dictionary, with a default spatial size of 8×8; current_time and lead_time are each [1], becoming [B,1] after the DataLoader. The checkpoint is always written to weight/model.pth, and training history with latest/best checkpoints is written to weight/training/. The model package is distributed without these local training weights or result/ artifacts.
Real Data
Real-data training requires MRMS instantaneous/accumulated precipitation, OMO/ASOS station observations, HRRR 617 channels and stale-age, GOES 16 channels, elevation, a common projection, QC, missing-value handling, and normalization statistics.
OneScience Official Information
Citation & License
- This directory is an independent compact reproduction built according to the MetNet-3 paper.
- Paper materials, code, and subsequent real data are each subject to their respective licenses.
