Add English model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
tags:
|
| 6 |
+
- OneScience
|
| 7 |
+
- Earth Science
|
| 8 |
+
- WRF
|
| 9 |
+
- Physical Parameterization
|
| 10 |
+
- Radiative Transfer
|
| 11 |
+
- Bidirectional LSTM
|
| 12 |
+
frameworks: PyTorch
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
<p align="center"><strong><span style="font-size: 30px;">WRF-ML</span></strong></p>
|
| 16 |
+
|
| 17 |
+
# Model Introduction
|
| 18 |
+
|
| 19 |
+
WRF-ML bridges WRF v4.3 and Python machine-learning parameterizations. This reproduction focuses on the recommended Model D, using a bidirectional LSTM to emulate RRTMG shortwave and longwave outputs.
|
| 20 |
+
|
| 21 |
+
Paper: WRF–ML v1.0: a bridge between WRF v4.3 and machine learning parameterizations and its application to atmospheric radiative transfer
|
| 22 |
+
https://doi.org/10.5194/gmd-16-199-2023
|
| 23 |
+
|
| 24 |
+
# Model Description
|
| 25 |
+
|
| 26 |
+
The model was proposed by researchers at Alibaba Group's Damo Academy. It was trained with atmospheric-column inputs and RRTMG outputs generated by WRF simulations, with 57 vertical levels per sample. Through layout adaptation and a synchronous request-response protocol, it supports shortwave and longwave flux and heating-rate emulation as an online WRF physical parameterization.
|
| 27 |
+
|
| 28 |
+
# Use Cases
|
| 29 |
+
|
| 30 |
+
| Use Case | Description |
|
| 31 |
+
| :---: | :--- |
|
| 32 |
+
| Radiation emulation | Emulate shortwave and longwave fluxes and heating rates. |
|
| 33 |
+
| WRF parameterization | Validate atmospheric-column batching and output layout restoration. |
|
| 34 |
+
| Offline evaluation | Compute RMSE for six radiation outputs. |
|
| 35 |
+
| Coupling protocol | Demonstrate synchronous blocking request, inference, and response. |
|
| 36 |
+
| ModelScope/OneCode execution | Validate structured data, training, inference, probabilistic precipitation metrics, and visualization in ModelScope or OneCode. |
|
| 37 |
+
| Multi-GPU training | Start multi-process training through `torchrun`. |
|
| 38 |
+
|
| 39 |
+
# Usage Instructions
|
| 40 |
+
|
| 41 |
+
## Download
|
| 42 |
+
|
| 43 |
+
```bash
|
| 44 |
+
hf download OneScience-Group/WRF-ML --local-dir ./WRF-ML
|
| 45 |
+
cd WRF-ML
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
### Environment Dependencies
|
| 49 |
+
|
| 50 |
+
**Hardware Requirements**
|
| 51 |
+
|
| 52 |
+
- A GPU or DCU is recommended.
|
| 53 |
+
- A CPU can run the default small-sample connectivity configuration.
|
| 54 |
+
- DCU users should install DTK 25.04.2 or a compatible OneScience-recommended version first.
|
| 55 |
+
|
| 56 |
+
**DCU Environment**
|
| 57 |
+
|
| 58 |
+
```bash
|
| 59 |
+
# Activate DTK and Conda first
|
| 60 |
+
conda create -n onescience311 python=3.11 -y
|
| 61 |
+
conda activate onescience311
|
| 62 |
+
pip install onescience[earth-dcu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
**GPU Environment**
|
| 66 |
+
|
| 67 |
+
```bash
|
| 68 |
+
# Activate Conda first
|
| 69 |
+
conda create -n onescience311 python=3.11 -y libstdcxx-ng=12 libgcc-ng=12 gcc_linux-64=12 gxx_linux-64=12
|
| 70 |
+
conda activate onescience311
|
| 71 |
+
pip install onescience[earth-gpu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
## Synthetic Data
|
| 75 |
+
|
| 76 |
+
The paper uses a `190x170` horizontal domain, 57 vertical levels, and WRF-RRTMG columns sampled every 30 minutes. Synthetic data preserve 57 levels, WRF layout conversion, and six output semantics while reducing column count, hidden width, and epochs; the ten inputs are explicitly an engineering ledger because the paper does not enumerate all input variables. Results verify the workflow only and do not represent paper performance.
|
| 77 |
+
|
| 78 |
+
```bash
|
| 79 |
+
python scripts/fake_data.py
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
## Training
|
| 83 |
+
|
| 84 |
+
```bash
|
| 85 |
+
python scripts/train.py
|
| 86 |
+
torchrun --nproc_per_node=2 --nnodes=1 --master_addr="localhost" --master_port=29500 scripts/train.py
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
The default synthetic run jointly optimizes 57-level radiation profiles and boundary fluxes, and both single-process and two-process DDP training have been verified. It produces one recoverable Model-D-style checkpoint and records normalized mean squared error. Training results are saved to:
|
| 90 |
+
|
| 91 |
+
```text
|
| 92 |
+
result/checkpoints/wrf_ml.pt
|
| 93 |
+
result/training/metrics.json
|
| 94 |
+
```
|
| 95 |
+
|
| 96 |
+
## Weights
|
| 97 |
+
|
| 98 |
+
The paper's code and data are archived at https://doi.org/10.5281/zenodo.7407487. This reproduction does not link a pretrained checkpoint because a separately licensed official weight artifact was not confirmed.
|
| 99 |
+
|
| 100 |
+
## Inference
|
| 101 |
+
|
| 102 |
+
```bash
|
| 103 |
+
python scripts/inference.py
|
| 104 |
+
```
|
| 105 |
+
|
| 106 |
+
Inference restores the checkpoint, runs the synchronous layout-adapted coupler, and produces 57-level profiles and boundary fluxes. Profile and boundary output shapes are `[6,57,4]` and `[6,2]`, respectively, and both have passed finite-value checks. Inference results are saved to:
|
| 107 |
+
|
| 108 |
+
```text
|
| 109 |
+
result/output/predictions.npz
|
| 110 |
+
```
|
| 111 |
+
|
| 112 |
+
## Evaluation
|
| 113 |
+
|
| 114 |
+
```bash
|
| 115 |
+
python scripts/result.py
|
| 116 |
+
```
|
| 117 |
+
|
| 118 |
+
Evaluation reports RMSE for shortwave and longwave fluxes, heating rates, and boundary shortwave fluxes and creates a vertical-profile comparison. All metrics are finite, and the PNG has passed format and non-empty-pixel checks. Evaluation results are saved to:
|
| 119 |
+
|
| 120 |
+
```text
|
| 121 |
+
result/evaluation/metrics.json
|
| 122 |
+
result/evaluation/comparison.png
|
| 123 |
+
```
|
| 124 |
+
|
| 125 |
+
# Official OneScience Information
|
| 126 |
+
|
| 127 |
+
| Platform | OneScience | OneSkills |
|
| 128 |
+
|---|---|---|
|
| 129 |
+
| Gitee | https://gitee.com/onescience-ai/onescience | https://gitee.com/onescience-ai/oneskills |
|
| 130 |
+
| GitHub | https://github.com/onescience-ai/OneScience | https://github.com/onescience-ai/oneskills |
|
| 131 |
+
|
| 132 |
+
# Citation and License
|
| 133 |
+
|
| 134 |
+
This repository is an independent engineering reproduction of the public WRF-ML specifications, with code licensed under the Apache License 2.0.
|
| 135 |
+
|
| 136 |
+
The original paper is licensed under CC BY 4.0; the paper, WRF, RRTMG, ONNX Runtime, and related data remain subject to their respective licenses and terms.
|