NeuralGCM
Model Introduction
NeuralGCM (Neural General Circulation Models) is an open-source hybrid machine-learning and physics-based atmospheric model developed by Google Research for weather forecasting and climate simulation.
Paper: Neural General Circulation Models for Weather and Climate
https://arxiv.org/abs/2311.07222
Model Description
NeuralGCM is built around a differentiable atmospheric dynamical core. Neural networks represent unresolved physical processes, the encoder, and the decoder, improving forecast efficiency while retaining physical constraints.
| Profile | Resolution | Type | Bundled official checkpoint |
|---|---|---|---|
weather_forecast |
0.7 degrees (512 x 256) |
Deterministic weather forecasting for approximately 2 to 15 days | weight/models_v1_deterministic_0_7_deg.pkl |
climate_scale |
1.4 degrees (256 x 128) |
Deterministic climate-scale simulation | weight/models_v1_deterministic_1_4_deg.pkl |
forecast_2_8_deg |
2.8 degrees (128 x 64) |
Deterministic weather forecasting | weight/models_v1_deterministic_2_8_deg.pkl |
stochastic_1_4_deg |
1.4 degrees (256 x 128) |
Stochastic weather forecasting | weight/models_v1_stochastic_1_4_deg.pkl |
Use Cases
| Scenario | Description |
|---|---|
| Global weather forecasting | Train the 0.7-degree model on ERA5 data for short- to medium-range weather forecasting. |
| Climate-scale simulation | Train the 1.4-degree model on ERA5 data for longer atmospheric simulations. |
| Low-resolution experiments | Use the 2.8-degree data profile for lower-cost weather forecasting experiments. |
| Local quick validation | Generate HDF5 data with the required channel protocol using scripts/fake_data.py and validate the data, model, and checkpoint workflows. |
| ModelScope / OneCode execution | Download the standalone model package, install the OneScience and JAX dependencies, and run the scripts directly. |
| Multi-device training | Run synchronous data-parallel training on multiple local accelerators. |
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.
- A CPU can be used for import checks and small-scale connectivity validation, but full training and inference will be slow.
- DCU users must install DTK in advance. DTK 25.04.2 or later, or the OneScience-recommended version compatible with the current cluster, is recommended.
Download the Model Package
hf download OneScience-Group/NeuralGCM --local-dir ./NeuralGCM
cd NeuralGCM
Install the Runtime Environment
DCU Environment
# Activate DTK and conda first.
conda create -n onescience311 python=3.11 -y
conda activate onescience311
# Installation with uv is also supported.
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
# Installation with uv is also supported.
pip install onescience[earth-gpu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai
Training Data
The OneScience community provides an ERA5 data slice for training. Download it with the following command and confirm that the data path in conf/config.yaml is correct:
hf download --repo-type dataset OneScience-Group/ERA5 --local-dir ./data
Generate Synthetic Data
python scripts/fake_data.py
The script creates yearly HDF5 files under data/data/, writes synthetic static fields to data/static.nc, and saves channel, time-window, and grid metadata to data/metadata/dataset_card.json. The synthetic fields use approximate physical units but are intended only for shape, loading, regridding, and numerical-stability checks.
Training
Single device:
# 0.7-degree deterministic short- to medium-range weather forecasting
python scripts/train_weather_forecast.py
# 1.4-degree deterministic climate-scale simulation
python scripts/train_climate_scale.py
# 2.8-degree deterministic low-resolution weather forecasting
python scripts/train_forecast_2_8_deg.py
# 1.4-degree stochastic weather forecasting
python scripts/train_stochastic_1_4_deg.py
Multiple devices:
# 0.7-degree deterministic short- to medium-range weather forecasting
python scripts/train_weather_forecast.py --devices 8
# 1.4-degree deterministic climate-scale simulation
python scripts/train_climate_scale.py --devices 8
# 2.8-degree deterministic low-resolution weather forecasting
python scripts/train_forecast_2_8_deg.py --devices 8
# 1.4-degree stochastic weather forecasting
python scripts/train_stochastic_1_4_deg.py --devices 8
Fine-tuning
Fine-tuning can start from either a checkpoint produced by local training or the bundled official checkpoint for the selected profile.
# Use the bundled official checkpoint for each profile.
python scripts/train_weather_forecast.py --finetune weight/models_v1_deterministic_0_7_deg.pkl
python scripts/train_climate_scale.py --finetune weight/models_v1_deterministic_1_4_deg.pkl
python scripts/train_forecast_2_8_deg.py --finetune weight/models_v1_deterministic_2_8_deg.pkl
python scripts/train_stochastic_1_4_deg.py --finetune weight/models_v1_stochastic_1_4_deg.pkl
# Alternatively, provide a local checkpoint explicitly.
python scripts/train_weather_forecast.py --finetune ./data/checkpoint/model_bak.pkl
For multi-device fine-tuning, add --devices to the corresponding command.
Pre-trained Weights
This project includes the following official pre-trained checkpoints:
| Local file | Official release path |
|---|---|
weight/models_v1_deterministic_0_7_deg.pkl |
gs://neuralgcm/models/v1/deterministic_0_7_deg.pkl |
weight/models_v1_deterministic_1_4_deg.pkl |
gs://neuralgcm/models/v1/deterministic_1_4_deg.pkl |
weight/models_v1_deterministic_2_8_deg.pkl |
gs://neuralgcm/models/v1/deterministic_2_8_deg.pkl |
weight/models_v1_stochastic_1_4_deg.pkl |
gs://neuralgcm/models/v1/stochastic_1_4_deg.pkl |
Inference
# 0.7-degree deterministic short- to medium-range weather forecasting
python scripts/inference.py --mode weather_forecast --checkpoint weight/models_v1_deterministic_0_7_deg.pkl
# 1.4-degree deterministic climate-scale simulation
python scripts/inference.py --mode climate_scale --checkpoint weight/models_v1_deterministic_1_4_deg.pkl
# 2.8-degree deterministic low-resolution weather forecasting
python scripts/inference.py --mode forecast_2_8_deg --checkpoint weight/models_v1_deterministic_2_8_deg.pkl
# 1.4-degree stochastic weather forecasting
python scripts/inference.py --mode stochastic_1_4_deg --checkpoint weight/models_v1_stochastic_1_4_deg.pkl
Without an explicit --checkpoint, inference first checks ./data/checkpoint/model_bak.pkl. The default output is results/predictions.nc, containing pressure-level variables with their official names and rollout time coordinates.
Evaluation and Visualization
python scripts/result.py
Official OneScience Resources
| 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 a reproduction of the original NeuralGCM paper.
- The repository code is provided under the Apache License 2.0.
- The trained model weights released by Google, including the four checkpoints in this directory, are licensed under the Creative Commons Attribution-ShareAlike 4.0 International license (CC BY-SA 4.0). Redistribution or adaptation of the weights must preserve attribution and use the same license as required by those terms.
中文说明
模型简介
NeuralGCM(Neural General Circulation Models)是 Google Research 开发的开源混合大气模型,结合机器学习和物理方法,用于天气预报(weather forecasting)和气候模拟。
论文:用于天气与气候的神经大气环流模型
https://arxiv.org/abs/2311.07222
模型描述
NeuralGCM 以可微大气动力核心为基础。神经网络表征未解析的物理过程、编码器和解码器,在保留物理约束的同时提高预报效率。
| 配置方案 | 分辨率 | 类型 | 随包提供的官方模型权重(检查点)(checkpoint) |
|---|---|---|---|
weather_forecast |
0.7 degrees (512 x 256) |
约 2 至 15 天的确定性天气预报 | weight/models_v1_deterministic_0_7_deg.pkl |
climate_scale |
1.4 degrees (256 x 128) |
确定性气候尺度模拟 | weight/models_v1_deterministic_1_4_deg.pkl |
forecast_2_8_deg |
2.8 degrees (128 x 64) |
确定性天气预报 | weight/models_v1_deterministic_2_8_deg.pkl |
stochastic_1_4_deg |
1.4 degrees (256 x 128) |
随机天气预报 | weight/models_v1_stochastic_1_4_deg.pkl |
使用场景
| 场景 | 说明 |
|---|---|
| 全球天气预报 | 使用 ERA5 数据训练 0.7-degree 模型,用于短期至中期天气预报(medium-range forecast)。 |
| 气候尺度模拟 | 使用 ERA5 数据训练 1.4-degree 模型,用于更长时间的大气模拟。 |
| 低分辨率实验 | 使用 2.8-degree 数据配置开展成本较低的天气预报实验。 |
| 本地快速验证 | 使用 scripts/fake_data.py 生成符合通道规范的 HDF5 数据,验证数据、模型和模型权重(检查点)流程。 |
| 在 ModelScope / OneCode 中运行 | 下载独立模型包,安装 OneScience 和 JAX 依赖后直接运行脚本。 |
| 多设备训练 | 在多个本地加速器上运行同步数据并行训练。 |
使用指南
1. OneCode 使用方法
通过 OneCode 在线环境体验智能一键 AI4S 编程。
2. 手动安装与使用
硬件要求
- 建议使用 GPU 或 DCU。
- CPU 可用于导入检查和小规模连通性验证,完整训练和推理(inference)速度较慢。
- DCU 用户须提前安装 DTK。建议使用 DTK 25.04.2 或更高版本,或使用 OneScience 推荐的适配当前集群的版本。
下载模型包
hf download OneScience-Group/NeuralGCM --local-dir ./NeuralGCM
cd NeuralGCM
安装运行环境
DCU 环境
# Activate DTK and conda first.
conda create -n onescience311 python=3.11 -y
conda activate onescience311
# Installation with uv is also supported.
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
# Installation with uv is also 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
生成合成数据
python scripts/fake_data.py
脚本在 data/data/ 下生成年份对应的 HDF5 文件,将合成静态场写入 data/static.nc,并将通道、时间窗和网格元数据保存到 data/metadata/dataset_card.json。合成场采用近似物理单位,仅用于检查形状、加载、重网格化及数值稳定性。
训练
单设备
# 0.7-degree deterministic short- to medium-range weather forecasting
python scripts/train_weather_forecast.py
# 1.4-degree deterministic climate-scale simulation
python scripts/train_climate_scale.py
# 2.8-degree deterministic low-resolution weather forecasting
python scripts/train_forecast_2_8_deg.py
# 1.4-degree stochastic weather forecasting
python scripts/train_stochastic_1_4_deg.py
多设备
# 0.7-degree deterministic short- to medium-range weather forecasting
python scripts/train_weather_forecast.py --devices 8
# 1.4-degree deterministic climate-scale simulation
python scripts/train_climate_scale.py --devices 8
# 2.8-degree deterministic low-resolution weather forecasting
python scripts/train_forecast_2_8_deg.py --devices 8
# 1.4-degree stochastic weather forecasting
python scripts/train_stochastic_1_4_deg.py --devices 8
微调(fine-tuning)
微调可从本地训练生成的模型权重(检查点)开始,也可从与所选配置方案对应的随包官方模型权重(检查点)开始。
# Use the bundled official checkpoint for each profile.
python scripts/train_weather_forecast.py --finetune weight/models_v1_deterministic_0_7_deg.pkl
python scripts/train_climate_scale.py --finetune weight/models_v1_deterministic_1_4_deg.pkl
python scripts/train_forecast_2_8_deg.py --finetune weight/models_v1_deterministic_2_8_deg.pkl
python scripts/train_stochastic_1_4_deg.py --finetune weight/models_v1_stochastic_1_4_deg.pkl
# Alternatively, provide a local checkpoint explicitly.
python scripts/train_weather_forecast.py --finetune ./data/checkpoint/model_bak.pkl
执行多设备微调时,在相应命令中添加 --devices。
预训练权重
本项目包含以下官方预训练模型权重(检查点)。
| 本地文件 | 官方发布路径 |
|---|---|
weight/models_v1_deterministic_0_7_deg.pkl |
gs://neuralgcm/models/v1/deterministic_0_7_deg.pkl |
weight/models_v1_deterministic_1_4_deg.pkl |
gs://neuralgcm/models/v1/deterministic_1_4_deg.pkl |
weight/models_v1_deterministic_2_8_deg.pkl |
gs://neuralgcm/models/v1/deterministic_2_8_deg.pkl |
weight/models_v1_stochastic_1_4_deg.pkl |
gs://neuralgcm/models/v1/stochastic_1_4_deg.pkl |
推理
# 0.7-degree deterministic short- to medium-range weather forecasting
python scripts/inference.py --mode weather_forecast --checkpoint weight/models_v1_deterministic_0_7_deg.pkl
# 1.4-degree deterministic climate-scale simulation
python scripts/inference.py --mode climate_scale --checkpoint weight/models_v1_deterministic_1_4_deg.pkl
# 2.8-degree deterministic low-resolution weather forecasting
python scripts/inference.py --mode forecast_2_8_deg --checkpoint weight/models_v1_deterministic_2_8_deg.pkl
# 1.4-degree stochastic weather forecasting
python scripts/inference.py --mode stochastic_1_4_deg --checkpoint weight/models_v1_stochastic_1_4_deg.pkl
如果未显式指定 --checkpoint,推理会先检查 ./data/checkpoint/model_bak.pkl。默认输出为 results/predictions.nc,其中包含采用官方名称的气压层变量和滚动预测的时间坐标。
评估与可视化
python scripts/result.py
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 |
引用与许可证
- 本仓库复现了 NeuralGCM 的原始论文。
- 仓库代码采用 Apache License 2.0 许可证。
- Google 发布的训练模型权重,包括本目录中的四个模型权重(检查点),采用 Creative Commons Attribution-ShareAlike 4.0 International 许可(CC BY-SA 4.0)。根据条款,再分发或改编权重时必须保留署名并采用相同许可证。
- Downloads last month
- 30