Pangu-Weather

Model Introduction

Pangu-Weather is a global medium-range weather forecast model proposed by Huawei Cloud, capable of rapidly predicting surface variables and multi-pressure-level upper-air variables.

Paper: Accurate medium-range global weather forecasting with 3D neural networks
https://www.nature.com/articles/s41586-023-06185-3

Model Description

Pangu-Weather is based on a 3D Earth-Specific Transformer architecture, trained on ERA5 data, and designed for short-to-medium-range weather forecasting.

Use Cases

Scenario Description
Weather Forecast Training Train Pangu-Weather using ERA5 HDF5 data
Local Quick Validation Use synthetic data to verify data loading, model training & inference, and inference result visualization.
ModelScope / OneCode Execution Download as a standalone model package, install dependencies, and run scripts directly.
Multi-GPU Training Launch multi-process training via torchrun.

Usage Guide

1. OneCode Usage

Experience intelligent one-click AI4S programming through the OneCode online environment:

Click to Experience Intelligent One-Click AI4S Programming

2. Manual Installation and Usage

Hardware Requirements

  • A GPU or DCU is recommended.
  • CPU can be used for import and small-scale connectivity verification; full training and inference will be slow.
  • DCU users must install DTK in advance. DTK 25.04.2 or above, or the OneScience recommended version matching your cluster, is recommended.

Download the Model Package

hf download OneScience-Group/Pangu-Weather --local-dir ./pangu_weather
cd pangu_weather

Install the Runtime Environment

DCU Environment

# Please activate DTK and CONDA first
conda create -n onescience311 python=3.11 -y
conda activate onescience311
# uv installation is supported
pip install onescience[earth-dcu] -i http://mirrors.onescience.ai:3141/pypi/simple/  --trusted-host mirrors.onescience.ai

GPU Environment

# Please 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
# uv installation is supported
pip install onescience[earth-gpu] -i http://mirrors.onescience.ai:3141/pypi/simple/  --trusted-host mirrors.onescience.ai

Training Data Introduction

The OneScience community provides ERA5 data for training (due to file size limits, the current repository contains a slice of the full dataset). Users can download it with the command below and confirm that the data path in conf/config.yaml is set correctly:

hf download --repo-type dataset OneScience-Group/ERA5 --local-dir ./data

Training

Single GPU:

python scripts/train.py

Multi-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

Training will save model_bak.pth under data/checkpoints/.

Training Weights

This repository provides weights trained on ERA5 data from 1979 to 2025 in the weights/ folder. At the 6-hour forecast lead time, these weights outperform the official open-source ONNX weights.

Inference

python scripts/inference.py

Inference results will be saved to result/output/.

Evaluation and Visualization

python scripts/result.py

OneScience Official Information

Citation & License

  • This repository is a reproduction of the original Pangu-Weather paper.

中文说明

模型简介

Pangu-Weather 是华为云提出的全球中期天气预报(medium-range forecast)模型,可快速预测地表变量和多个气压层上的高空变量。

论文:使用 3D 神经网络实现精准的全球中期天气预报(weather forecasting)
https://www.nature.com/articles/s41586-023-06185-3

模型描述

Pangu-Weather 基于 3D Earth-Specific Transformer 架构,使用 ERA5 数据训练,面向短期至中期天气预报。

使用场景

场景 说明
天气预报模型训练 使用 ERA5 HDF5 数据训练 Pangu-Weather
本地快速验证 使用合成数据验证数据加载、模型训练与推理(inference),以及推理结果可视化。
在 ModelScope / OneCode 中运行 下载独立模型包,安装依赖后直接运行脚本。
多 GPU 训练 通过 torchrun 启动多进程训练。

使用指南

1. OneCode 使用方法

通过 OneCode 在线环境体验智能一键 AI4S 编程。

点击体验智能一键 AI4S 编程

2. 手动安装与使用

硬件要求

  • 建议使用 GPU 或 DCU。
  • CPU 可用于导入和小规模连通性验证,完整训练和推理速度较慢。
  • DCU 用户必须提前安装 DTK。建议使用 DTK 25.04.2 或更高版本,或使用 OneScience 推荐的与所在集群匹配的版本。

下载模型包

hf download OneScience-Group/Pangu-Weather --local-dir ./pangu_weather
cd pangu_weather

安装运行环境

DCU 环境

# Please activate DTK and CONDA first
conda create -n onescience311 python=3.11 -y
conda activate onescience311
# uv installation is supported
pip install onescience[earth-dcu] -i http://mirrors.onescience.ai:3141/pypi/simple/  --trusted-host mirrors.onescience.ai

GPU 环境

# Please 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
# uv installation is supported
pip install onescience[earth-gpu] -i http://mirrors.onescience.ai:3141/pypi/simple/  --trusted-host mirrors.onescience.ai

训练数据简介

OneScience 社区提供用于训练的 ERA5 数据(受文件大小限制,当前仓库仅包含完整数据集的一部分)。用户可以通过以下命令下载数据,并确认 conf/config.yaml 中的数据路径设置正确。

hf download --repo-type dataset OneScience-Group/ERA5 --local-dir ./data

训练

单 GPU

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

训练将 model_bak.pth 保存到 data/checkpoints/ 下。

训练权重

本仓库在 weights/ 文件夹中提供使用 1979 至 2025 年的 ERA5 数据训练的权重。对于 6-hour 预报时效,这些权重的表现优于官方开源 ONNX 权重。

推理

python scripts/inference.py

推理结果将保存到 result/output/。

评估与可视化

python scripts/result.py

OneScience 官方信息

引用与许可证

  • 本仓库复现了 Pangu-Weather 的原始论文。
Downloads last month
10
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support