FuXi

Model Introduction

FuXi is a global weather forecast foundation model jointly developed by Fudan University and multiple institutions. It is the first end-to-end machine learning framework capable of independently performing data assimilation (DA) and cyclic forecasting.

Paper: FuXi: A cascade machine learning forecasting system for 15-day global weather forecast

https://arxiv.org/abs/2306.12873

Model Description

The FuXi model is trained through a three-stage cascaded approach: short → medium → long. Its training input primarily consists of ERA5 reanalysis data.

Use Cases

Scenario Description
Weather Forecast Training Train FuXi (short/medium/long three stages) 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/FuXi --local-dir ./FuXi
cd FuXi

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

FuXi consists of 3 stages and must be executed in order. The inference result of each stage serves as the input for the next stage:

short (train) → short (inference) → medium (train) → medium (inference) → long (train) → long (inference)

1) Train the short model (train from scratch, as the starting entry point)

Single GPU:

python scripts/train_short.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_short.py

2) Short inference (generate input data for medium)

python scripts/inference.py short

3) Train the medium model (requires short weights + short inference results)

python scripts/train_medium.py

4) Medium inference (generate input data for long)

python scripts/inference.py medium

5) Train the long model (requires medium weights + medium inference results)

python scripts/train_long.py

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

Each stage can perform inference independently:

python scripts/inference.py short
python scripts/inference.py medium
python scripts/inference.py long

Inference results will be saved to result/output/<stage>/.

Evaluation and Visualization

python scripts/result.py short
python scripts/result.py medium
python scripts/result.py long

OneScience Official Information

Citation & License

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

中文说明

模型简介

FuXi 是由复旦大学联合多家机构开发的全球天气预报(weather forecasting)基础模型。它是首个可独立执行资料同化(data assimilation,DA)和循环预报的端到端机器学习框架。

论文《FuXi:用于 15 天全球天气预报的级联机器学习预报系统》

https://arxiv.org/abs/2306.12873

模型描述

FuXi 模型通过 short → medium → long 三阶段级联方式训练。训练输入主要由 ERA5 再分析(reanalysis)数据组成。

使用场景

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

安装运行环境

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

训练

FuXi 由 3 个阶段组成,必须按顺序执行。每个阶段的推理结果作为下一阶段的输入。

short(训练)→ short(推理)→ medium(训练)→ medium(推理)→ long(训练)→ long(推理)

1) 训练 short 模型(从头训练,作为起始入口)

单 GPU

python scripts/train_short.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_short.py

2) short 推理(生成 medium 的输入数据)

python scripts/inference.py short

3) 训练 medium 模型(需要 short 权重和 short 推理结果)

python scripts/train_medium.py

4) medium 推理(生成 long 的输入数据)

python scripts/inference.py medium

5) 训练 long 模型(需要 medium 权重和 medium 推理结果)

python scripts/train_long.py

训练权重

本仓库在 weights/ 文件夹中提供使用 39 年 ERA5 再分析数据训练的权重。权重文件即将上传,预计近期可用。

推理

每个阶段均可独立执行推理。

python scripts/inference.py short
python scripts/inference.py medium
python scripts/inference.py long

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

评估与可视化

python scripts/result.py short
python scripts/result.py medium
python scripts/result.py long

OneScience 官方信息

引用与许可证

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

Paper for OneScience-Group/FuXi