Spherical DYffusion

Model Introduction

Spherical DYffusion was proposed by Salva Ruhling Cachay and collaborators for probabilistic simulation of a global climate model.

Paper: Probabilistic Emulation of a Global Climate Model with Spherical DYffusion

https://arxiv.org/abs/2406.14798

Model Description

The original method models spherical dynamics with an SFNO and uses the DYffusion interpolator and forecaster in a two-stage training procedure for probabilistic ensemble simulation. This repository contains a compact local implementation that preserves the project's tensor and data contracts for smoke testing; it is not a full paper-scale SFNO/DYffusion implementation.

Use Cases

Scenario Description
Local pipeline validation Use synthetic 37-channel global-grid data to check training, inference, and visualization.
FV3GFS protocol checks Validate NetCDF variables, spatial dimensions, and consecutive time frames.
ModelScope / OneCode execution Download the standalone model package and run the compact local pipeline.
Multi-GPU training Launch PyTorch DistributedDataParallel with 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/Spherical_DYffusion --local-dir ./Spherical_DYffusion
cd Spherical_DYffusion

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

Generate Synthetic Data

Generate a deterministic NetCDF FV3GFS-contract fixture at data/data/synthetic_fv3gfs.nc:

python scripts/fake_data.py

The fixture contains 37 protocol variables, including surface pressure and temperature, eight vertical levels of temperature, total water, and wind components, plus DSWRFtoa, HGTsfc, and ocean_fraction. It is intended only for protocol checks. The local training pipeline creates its own learnable data/data/virtual_fv3gfs.npz fixture.

Training

Single GPU:

python scripts/train.py

Multi-GPU:

torchrun --nproc_per_node=8 scripts/train.py

Training starts from random initialization and saves data/checkpoint/model_bak.pt and data/checkpoint/last.pt.

The complete local smoke workflow can also be run with:

python scripts/local_pipeline.py all

Training Weights

This repository provides a weight/ directory for FV3GFS-compatible checkpoints. The weight files will be uploaded soon and are expected to be available in the near future.

Inference

Inference reads data/checkpoint/model_bak.pt and writes output/inference/prediction.npz:

python scripts/inference.py

Evaluation and Visualization

python scripts/result.py

The script computes per-variable and overall diagnostics and writes output/visualization/diagnostic_dashboard.png and output/visualization/variable_metrics.png, with machine-readable summaries under output/metrics/.

Official OneScience Resources

Citation and License

  • This repository is a compact local reproduction of the original Spherical DYffusion paper and does not claim to reproduce the paper-scale training setup or metrics.

中文说明

模型简介

Spherical DYffusion 由 Salva Ruhling Cachay 及合作者提出,用于全球气候模式的概率模拟。

论文《使用 Spherical DYffusion 对全球气候模式进行概率模拟》

https://arxiv.org/abs/2406.14798

模型描述

原方法以 SFNO 建模球面动力学,通过两阶段训练流程使用 DYffusion 插值器与预报器进行概率集合模拟。本仓库包含精简的本地实现,保留项目的张量和数据约定以进行冒烟测试,未实现完整论文规模的 SFNO/DYffusion。

使用场景

场景 说明
本地流程验证 使用合成的 37 通道全球网格数据检查训练、推理(inference)和可视化。
FV3GFS 规约检查 验证 NetCDF 变量、空间维度与连续时间帧。
在 ModelScope / OneCode 中运行 下载独立模型包,运行精简的本地流程。
多 GPU 训练 使用 torchrun 启动 PyTorch DistributedDataParallel。

使用指南

1. 使用 OneCode

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

点击体验智能一键 AI4S 编程

2. 手动安装与使用

硬件要求

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

下载模型包

hf download OneScience-Group/Spherical_DYffusion --local-dir ./Spherical_DYffusion
cd Spherical_DYffusion

安装运行环境

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

生成合成数据

在 data/data/synthetic_fv3gfs.nc 生成符合 FV3GFS 数据约定的确定性 NetCDF 测试数据。

python scripts/fake_data.py

测试数据包含 37 个规约变量,包括地面气压和温度、八个垂直层次的温度、总水量及风分量,以及 DSWRFtoa、HGTsfc 和 ocean_fraction。这些数据仅用于检查规约。本地训练流程会另外生成可学习的 data/data/virtual_fv3gfs.npz 测试数据。

训练

单 GPU

python scripts/train.py

多 GPU

torchrun --nproc_per_node=8 scripts/train.py

训练从随机初始化开始,保存 data/checkpoint/model_bak.pt 和 data/checkpoint/last.pt。

也可以使用以下命令运行完整本地冒烟测试流程。

python scripts/local_pipeline.py all

训练权重

本仓库提供 weight/ 目录,用于存放兼容 FV3GFS 的模型权重(检查点)(checkpoint)。权重文件即将上传,预计近期可用。

推理

推理读取 data/checkpoint/model_bak.pt,并写入 output/inference/prediction.npz。

python scripts/inference.py

评估与可视化

python scripts/result.py

脚本计算逐变量及总体诊断结果,写入 output/visualization/diagnostic_dashboard.png 和 output/visualization/variable_metrics.png,并将机器可读摘要存至 output/metrics/。

OneScience 官方资源

引用与许可证

  • 本仓库对 Spherical DYffusion 原始论文进行精简本地复现,未声明复现论文规模的训练设置或指标。
Downloads last month
8
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Paper for OneScience-Group/Spherical_DYffusion