UnetDif
Model Introduction
UnetDif uses the paper's bias-targeted multitask U-Net to correct short-range heavy rainfall forecasts.
Paper: Bias-targeted deep learning enhances short-range heavy rainfall forecasts
https://doi.org/10.1038/s41612-026-01366-z
Model Description
The method reproduced by UnetDif was proposed by research teams from Zhejiang Meteorological Observatory, the National Meteorological Center, and Zhejiang University. The paper constructs Yangtze River Delta samples from European Centre for Medium-Range Weather Forecasts (ECMWF) fields, China Meteorological Administration Multi-source Precipitation Analysis (CMPA), and terrain data. The model learns ECMWF - CMPA rainfall bias and corrects three-hour precipitation through a shared U-Net backbone with four heads for dry areas, false alarms, positive bias, and negative bias.
Use Cases
| Use Case | Description |
|---|---|
| Three-hour rainfall-bias correction | Generate corrected ECMWF rainfall from 39-channel inputs on the fixed Yangtze River Delta grid. |
| ModelScope/OneCode execution | Validate synthetic-data generation, six-loss training, inference, evaluation, and visualization in ModelScope or OneCode environments. |
| Hugging Face/OneCode execution | Run the complete engineering workflow in Hugging Face or OneCode environments. |
| Multi-GPU training | Launch distributed data-parallel training with torchrun. |
Usage Instructions
1.OneCode
Experience intelligent, one-click AI4S programming through the OneCode online environment:
Try intelligent, one-click AI4S programming
2. Download and Installation
hf download OneScience-Group/UnetDif --local-dir ./UnetDif
cd UnetDif
Environment Dependencies
Hardware Requirements
- A GPU or DCU is recommended.
- A CPU can be used for connectivity validation with the default small-sample configuration.
- DCU users must install DTK first. DTK 25.04.2 or later, or the OneScience-recommended version matching the cluster, is recommended.
DCU Environment
# Activate DTK and Conda first
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.ai
GPU Environment
# Activate Conda first
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.ai
Training Data
Training data contain ECMWF weather forecasts, CMPA precipitation observations, and static terrain. Each sample uses 39 input channels, with corresponding CMPA precipitation and ECMWF precipitation bias as targets. The data use a 56×56 Yangtze River Delta grid at 0.125° resolution. Each rain day contains eight consecutive three-hour periods, with precipitation in mm/3h. Synthetic data validate training, inference, and evaluation only and do not represent the distributions of ECMWF, CMPA, real terrain, or formal paper performance.
python scripts/fake_data.py
Training
For single-device training, use:
python scripts/train.py
For multi-GPU training, use:
torchrun --nproc_per_node=8 --nnodes=1 --rdzv_id=1000 --rdzv_backend=c10d --max_restarts=0 --master_addr="localhost" --master_port=29500 scripts/train.py
Training learns dry-area, false-alarm, and signed precipitation-bias tasks and saves the model checkpoint and training metrics. Results are saved to:
result/checkpoints/unetdif.pt
result/training/metrics.json
Trained Weights
This repository does not include weights under weight/. The paper does not provide a confirmed official checkpoint, and the engineering checkpoint trained on synthetic data is for workflow validation only and is not claimed to be compatible with external weights.
Inference
python scripts/inference.py
Inference loads the checkpoint and applies all four output heads under bias = ECMWF - CMPA to produce nonnegative corrected rainfall. Results are saved to:
result/output/predictions.npz
Evaluation and Visualization
python scripts/result.py
Evaluation produces categorical and spatial-skill metrics for individual three-hour periods and 24-hour accumulated precipitation and saves structured results. It also generates comparisons of ECMWF, CMPA, corrected precipitation, and errors. Synthetic-data results validate the engineering workflow only and do not represent formal paper performance.
result/evaluation/metrics.json
result/evaluation/comparison.png
Official OneScience Information
| Platform | OneScience Main Repository | Skills Repository |
|---|---|---|
| Gitee | https://gitee.com/onescience-ai/onescience | https://gitee.com/onescience-ai/oneskills |
| GitHub | https://github.com/onescience-ai/OneScience | https://github.com/onescience-ai/oneskills |
Citation and License
This repository is an independent engineering reproduction of the public UnetDif specifications.
Use of this repository's code, official model weights, and data remains subject to the licenses and terms of their respective projects.
中文说明
模型简介
UnetDif 使用论文中针对偏差设计的多任务 U-Net 校正短期强降雨预报。
论文《针对偏差的深度学习改进短期强降雨预报》
https://doi.org/10.1038/s41612-026-01366-z
模型描述
UnetDif 复现的方法由浙江省气象台、国家气象中心及浙江大学的研究团队提出。论文用欧洲中期天气预报中心(ECMWF)的场、中国气象局多源降水分析(CMPA)和地形数据构建长江三角洲样本。模型学习 ECMWF - CMPA 降雨偏差,通过共享 U-Net 主干校正三小时降水,四个输出头分别对应无雨区、空报、正偏差和负偏差。
使用场景
| 使用场景 | 说明 |
|---|---|
| 三小时降雨偏差校正 | 根据固定长江三角洲网格上的 39 通道输入生成校正后的 ECMWF 降雨。 |
| ModelScope/OneCode 运行 | 在 ModelScope 或 OneCode 环境中验证合成数据生成、六种损失训练、推理(inference)、评估及可视化。 |
| Hugging Face/OneCode 运行 | 在 Hugging Face 或 OneCode 环境中运行完整工程流程。 |
| 多 GPU 训练 | 通过 torchrun 启动分布式数据并行训练。 |
使用说明
1.OneCode
通过 OneCode 在线环境体验智能一键 AI4S 编程。
2. 下载与安装
hf download OneScience-Group/UnetDif --local-dir ./UnetDif
cd UnetDif
环境依赖
硬件要求
- 建议使用 GPU 或 DCU。
- 可使用 CPU 在默认小样本配置下验证连通性。
- DCU 用户必须先安装 DTK。建议使用 DTK 25.04.2 或更高版本,或使用 OneScience 推荐的与集群匹配的版本。
DCU 环境
# Activate DTK and Conda first
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.ai
GPU 环境
# Activate Conda first
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.ai
训练数据
训练数据包括 ECMWF 天气预报(weather forecasting)、CMPA 降水观测和静态地形。每个样本使用 39 个输入通道,以相应的 CMPA 降水和 ECMWF 降水偏差为目标。数据使用 56×56 的长江三角洲网格,分辨率为 0.125°。每个降雨日包含八个连续的三小时时段,降水单位为 mm/3h。合成数据仅用于验证训练、推理和评估,不代表 ECMWF、CMPA 和真实地形的分布,也不代表论文的正式性能。
python scripts/fake_data.py
训练
单设备训练使用以下命令。
python scripts/train.py
多 GPU 训练使用以下命令。
torchrun --nproc_per_node=8 --nnodes=1 --rdzv_id=1000 --rdzv_backend=c10d --max_restarts=0 --master_addr="localhost" --master_port=29500 scripts/train.py
训练学习无雨区、空报及带符号的降水偏差任务,并保存模型权重(检查点)(checkpoint)及训练指标。结果保存至以下路径。
result/checkpoints/unetdif.pt
result/training/metrics.json
训练权重
本仓库的 weight/ 中未附带权重。论文未提供经确认的官方模型权重(检查点),在合成数据上训练所得的工程模型权重(检查点)仅用于流程验证,未声明与外部权重兼容。
推理
python scripts/inference.py
推理加载模型权重(检查点),按 bias = ECMWF - CMPA 应用全部四个输出头生成非负的校正雨量。结果保存至以下路径。
result/output/predictions.npz
评估与可视化
python scripts/result.py
评估计算单个三小时时段和 24 小时累积降水的分类及空间技巧指标,并保存结构化结果。评估还生成 ECMWF、CMPA、校正降水和误差的对比图。合成数据结果仅用于验证工程流程,不代表论文的正式性能。
result/evaluation/metrics.json
result/evaluation/comparison.png
OneScience 官方信息
| 平台 | OneScience 主仓库 | Skills 仓库 |
|---|---|---|
| Gitee | https://gitee.com/onescience-ai/onescience | https://gitee.com/onescience-ai/oneskills |
| GitHub | https://github.com/onescience-ai/OneScience | https://github.com/onescience-ai/oneskills |
引用与许可证
本仓库是对公开 UnetDif 规范的独立工程复现。
使用本仓库的代码、官方模型权重和数据仍须遵守各自项目的许可证与条款。
- Downloads last month
- 11