FengWu

Model Introduction

FengWu is a global medium-range weather forecast foundation model jointly released by the Shanghai Artificial Intelligence Laboratory and multiple universities. It has been adopted by organizations such as the Hong Kong Observatory for operational weather forecasting.

Paper: FengWu: Pushing the Skillful Global Medium-range Weather Forecast beyond 10 Days Lead

https://arxiv.org/abs/2304.02948

Model Description

The FengWu model is built on a multi-modal and multi-task deep learning approach, without relying on traditional physical equations. It is trained entirely on ERA5 reanalysis data.

Use Cases

Scenario Description
Weather Forecast Training Train FengWu 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/FengWu --local-dir ./FengWu
cd FengWu

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 39 years of ERA5 reanalysis data in the weights/ folder. The weight files will be uploaded soon and are expected to be available in the near future.

Inference

python scripts/inference.py

Inference results will be saved to result/output/.

Evaluation and Visualization

python scripts/result.py

You can specify a date and variable at the end of result.py for visualization.

OneScience Official Information

Citation & License

  • This repository is a reproduction of the original FengWu paper.

中文说明

模型简介

FengWu 是由上海人工智能实验室和多所高校联合发布的全球天气中期预报(medium-range forecast)基础模型。香港天文台等机构已将其用于业务天气预报(weather forecasting)。

论文《FengWu:将有技巧的全球中期预报时效延长至 10 天以上》

https://arxiv.org/abs/2304.02948

模型描述

FengWu 模型基于多模态、多任务深度学习方法,无需依赖传统物理方程,完全使用 ERA5 再分析(reanalysis)数据训练。

使用场景

场景 说明
天气预报训练 使用 ERA5 HDF5 数据训练 FengWu
本地快速验证 使用合成数据验证数据加载、模型训练与推理(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/FengWu --local-dir ./FengWu
cd FengWu

安装运行环境

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/ 文件夹中提供使用 39 年 ERA5 再分析数据训练的权重。权重文件即将上传,预计近期可用。

推理

python scripts/inference.py

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

评估与可视化

python scripts/result.py

可在 result.py 末尾指定要可视化的日期和变量。

OneScience 官方信息

引用与许可证

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

Paper for OneScience-Group/FengWu