|
Download README.md from OneScience-Group/AtmoRep: direct link, hf CLI and curl.
- Browser
- Download file 12.3 kB
-
https://huggingface.co/OneScience-Group/AtmoRep/resolve/main/README.md
- Command line
-
hf download hf://OneScience-Group/AtmoRep/README.md
-
curl -L -o README.md https://huggingface.co/OneScience-Group/AtmoRep/resolve/main/README.md
12.3 kB
| license: other | |
| language: | |
| - en | |
| - zh | |
| tags: | |
| - OneScience | |
| - Earth Science | |
| - Weather Forecasting | |
| - ERA5 | |
| - Representation Learning | |
| frameworks: PyTorch | |
| datasets: | |
| - OneScience/ERA5 | |
| <p align="center"> | |
| <strong><span style="font-size: 30px;">AtmoRep</span></strong> | |
| </p> | |
| # Model Overview | |
| AtmoRep is a stochastic atmospheric dynamics model based on large-scale representation learning that captures the distribution of atmospheric states through masked-token training and ensemble outputs. | |
| Paper: *AtmoRep: A stochastic model of atmosphere dynamics using large scale representation learning* | |
| https://arxiv.org/abs/2308.13280 | |
| # Model Description | |
| This directory retains the official vorticity single-field model weights, configuration, and normalization, and provides a tiny AtmoRep-style model for local training and inference verification. | |
| # Use Cases | |
| | Scenario | Description | | |
| | :---: | :--- | | |
| | Official Resource Validation | Load official `.mod` weights and verify configuration. | | |
| | Local Rapid Verification | Run masked-token training and inference with the tiny model. | | |
| | ERA5 Atmospheric Representation Learning | Subsequently interface with official GRIB or Zarr data. | | |
| # Usage | |
| ## 1. OneCode | |
| [Click to experience intelligent one-click AI4S programming](https://web-2069360198568017922-iaaj.ksai.scnet.cn:58043/home) | |
| ## 2. Manual Installation & Usage | |
| **Hardware Requirements** | |
| - The tiny model runs on CPU. | |
| - GPU is recommended for the official model and real-data inference. | |
| ### Download the Model Package | |
| ```bash | |
| hf download OneScience-Group/AtmoRep --local-dir ./AtmoRep | |
| cd AtmoRep | |
| ``` | |
| ### Set Up the Runtime Environment | |
| **DCU Environment** | |
| ```bash | |
| conda create -n onescience311 python=3.11 -y | |
| conda activate onescience311 | |
| pip install onescience[earth-dcu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai | |
| ``` | |
| **GPU Environment** | |
| ```bash | |
| 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 | |
| pip install onescience[earth-gpu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai | |
| ``` | |
| If dependencies are missing from the official paths, install them with: | |
| ```bash | |
| pip install zarr wandb cfgrib xarray dask netCDF4 torchinfo | |
| ``` | |
| ### Weights & Data | |
| The current directory preserves: | |
| ```text | |
| resources/id4nvwbetz/AtmoRep_id4nvwbetz.mod | |
| resources/id4nvwbetz/model_id4nvwbetz.json | |
| resources/data/normalization/vorticity/ | |
| ``` | |
| Before re-downloading official resources please note: the current vendor snapshot is not a Git checkout, and the existing download script cannot re-clone into a non-empty `vendor/atmorep-official`. The resources bundled with this package do not require re-downloading; the script is only suitable for an empty target directory. | |
| ```bash | |
| bash scripts/download_official_resources.sh . | |
| ``` | |
| ### Tiny Training | |
| ```bash | |
| python scripts/train.py | |
| ``` | |
| This command performs multi-epoch masked-token training using independent train/validation fake Datasets, including DataLoader, AdamW, validation, learning rate scheduling, early stopping, best/latest checkpointing, and training history. Default parameters reside in `conf/config.yaml`. | |
| Resuming training: | |
| ```bash | |
| python scripts/train.py --resume weight/training/latest.pth --epochs 20 | |
| ``` | |
| Training artifacts are `weight/training/latest.pth`, `best.pth`, and `history.json`; the inference-compatible weights `weight/tiny_atmorep.pth` are also updated. Each Dataset sample consists of `fields [T,V,H,W]` and a non-empty `mask [N]`; train/validation use different seeds. This is a complete training pipeline for the tiny model, not a reproduction of the paper's 3.5-billion-parameter official model training. | |
| ### Tiny Inference | |
| ```bash | |
| python scripts/inference.py | |
| ``` | |
| Inference results are saved as: | |
| ```text | |
| result/prediction.pt | |
| result/target.pt | |
| ``` | |
| These include the ensemble, ensemble mean, ensemble std, and mask. | |
| ### Result Inspection | |
| ```bash | |
| python scripts/result.py | |
| ``` | |
| This command generates `result/metrics.json` and `result/comparison.png`. The reported metrics are ensemble/mean/spread RMSE in normalized token space, not the paper's physical-unit RMSE, ACC, CRPS, or spread-skill. | |
| ### Paper vs. Current Implementation I/O | |
| | Item | Paper / Official Model | Tiny Smoke Model | | |
| | --- | --- | --- | | |
| | Input | ERA5 local 4D neighborhoods, 5 mode levels, multiple physical fields | `[B,4,1,8,8]` single-field random tensor | | |
| | Token | Variable-correlated 4D tokens with absolute space-time and level conditioning | `1×4×4` patches, 16 tokens, relative coordinates with single-level conditioning | | |
| | Output | Multi-head ensembles supporting reconstruction, nowcasting, and interpolation | 4-member masked-token ensemble | | |
| | Training | Large-scale masked-token distribution learning | Multi-epoch Dataset training with independent validation and checkpoint resumption | | |
| | Weights | `resources/id4nvwbetz` official vorticity weights | `weight/tiny_atmorep.pth`; the two are mutually incompatible | | |
| The complete tiny execution flow is `train.py -> inference.py -> result.py`. The result analysis reads `weight/training/history.json` when present; inference output includes `ensemble`, `ensemble_mean`, `ensemble_std`, `mask`, and `target`. Random data is generated by the Dataset by index; there is currently no independent fake dataset that can be used with the official Zarr sampler. The model package is distributed without local training weights or `result/` artifacts — these are created at the paths described above after running the commands. | |
| ### Official Real-Data Inference | |
| A directly runnable official real-data inference command is not yet available. It further requires ERA5 vorticity GRIB/Zarr data, the ecCodes environment, and parameterization of the file paths in the official `evaluate.py`. | |
| ### Real Data | |
| The official vorticity model requires ERA5 vorticity, model levels 96/105/114/123/137, hourly temporal axes, and 0.25° global GRIB/Zarr data. | |
| # OneScience Official Information | |
| | 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 & License | |
| - Official code is MIT License. | |
| - Official model weights are declared CC BY 4.0. | |
| - ERA5 is subject to Copernicus/ECMWF data terms. | |
| --- | |
| # 中文说明 | |
| ## 模型概览 | |
| AtmoRep 是一种基于大规模表征学习的随机大气动力学模型,通过掩码 token 训练和集合输出来捕获大气状态分布。 | |
| 论文:*AtmoRep:基于大规模表征学习的随机大气动力学模型* | |
| https://arxiv.org/abs/2308.13280 | |
| ## 模型描述 | |
| 本目录保留官方涡度单场模型权重、配置和归一化统计量,并提供一个 AtmoRep 风格的小型模型,用于验证本地训练和推理(inference)。 | |
| ## 使用场景 | |
| | 场景 | 说明 | | |
| | :---: | :--- | | |
| | 官方资源验证 | 加载官方 `.mod` 权重并验证配置。 | | |
| | 本地快速验证 | 使用小型模型运行掩码 token 训练和推理。 | | |
| | ERA5 大气表征学习 | 后续与官方 GRIB 或 Zarr 数据对接。 | | |
| ## 使用指南 | |
| ### 1. OneCode | |
| [点击体验智能一键 AI4S 编程](https://web-2069360198568017922-iaaj.ksai.scnet.cn:58043/home) | |
| ### 2. 手动安装与使用 | |
| **硬件要求** | |
| - 小型模型可在 CPU 上运行。 | |
| - 运行官方模型或进行真实数据推理时,建议使用 GPU。 | |
| #### 下载模型包 | |
| ```bash | |
| hf download OneScience-Group/AtmoRep --local-dir ./AtmoRep | |
| cd AtmoRep | |
| ``` | |
| #### 配置运行环境 | |
| **DCU 环境** | |
| ```bash | |
| conda create -n onescience311 python=3.11 -y | |
| conda activate onescience311 | |
| pip install onescience[earth-dcu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai | |
| ``` | |
| **GPU 环境** | |
| ```bash | |
| 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 | |
| pip install onescience[earth-gpu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai | |
| ``` | |
| 如果官方路径缺少依赖,可使用以下命令安装。 | |
| ```bash | |
| pip install zarr wandb cfgrib xarray dask netCDF4 torchinfo | |
| ``` | |
| #### 权重与数据 | |
| 当前目录保留以下内容。 | |
| ```text | |
| resources/id4nvwbetz/AtmoRep_id4nvwbetz.mod | |
| resources/id4nvwbetz/model_id4nvwbetz.json | |
| resources/data/normalization/vorticity/ | |
| ``` | |
| 重新下载官方资源前请注意,当前随包提供的快照未通过 Git 检出,现有下载脚本无法重新克隆到非空的 `vendor/atmorep-official` 目录。本包附带的资源无需重新下载。该脚本仅适用于空目标目录。 | |
| ```bash | |
| bash scripts/download_official_resources.sh . | |
| ``` | |
| #### 小型模型训练 | |
| ```bash | |
| python scripts/train.py | |
| ``` | |
| 此命令使用独立的训练和验证合成 Dataset,进行多轮掩码 token 训练,包括 DataLoader、AdamW、验证、学习率调度、早停、最佳及最新模型权重(检查点)(checkpoint)保存和训练历史记录。默认参数位于 `conf/config.yaml`。 | |
| 恢复训练 | |
| ```bash | |
| python scripts/train.py --resume weight/training/latest.pth --epochs 20 | |
| ``` | |
| 训练产物为 `weight/training/latest.pth`、`best.pth` 和 `history.json`,同时也会更新可用于推理的权重 `weight/tiny_atmorep.pth`。每个 Dataset 样本由 `fields [T,V,H,W]` 和非空的 `mask [N]` 组成,训练和验证使用不同随机种子。这是小型模型的完整训练流程,未复现论文中 3.5-billion-parameter 官方模型的训练。 | |
| #### 小型模型推理 | |
| ```bash | |
| python scripts/inference.py | |
| ``` | |
| 推理结果保存到以下位置。 | |
| ```text | |
| result/prediction.pt | |
| result/target.pt | |
| ``` | |
| 这些结果包括集合、集合均值、集合标准差和掩码。 | |
| #### 结果检查 | |
| ```bash | |
| python scripts/result.py | |
| ``` | |
| 此命令生成 `result/metrics.json` 和 `result/comparison.png`。报告的指标为归一化 token 空间中的集合、集合均值及离散度 RMSE,区别于论文中使用物理单位的 RMSE、ACC、CRPS 或离散度与预报技巧指标。 | |
| #### 论文与当前实现的输入输出对比 | |
| | 项目 | 论文 / 官方模型 | 小型冒烟测试模型 | | |
| | --- | --- | --- | | |
| | 输入 | ERA5 局部 4D 邻域、5 个模态层级、多个物理场 | `[B,4,1,8,8]` 单场随机张量 | | |
| | Token | 变量相关的 4D token,以绝对时空位置和层级为条件 | `1×4×4` 分块、16 个 token、以单层级为条件的相对坐标 | | |
| | 输出 | 支持重建、临近预报(nowcasting)和插值的多头集合 | 4 个成员的掩码 token 集合 | | |
| | 训练 | 大规模掩码 token 分布学习 | 多轮 Dataset 训练,支持独立验证并从模型权重(检查点)恢复训练 | | |
| | 权重 | `resources/id4nvwbetz` 官方涡度权重 | `weight/tiny_atmorep.pth`,二者互不兼容 | | |
| 小型模型的完整运行流程为 `train.py -> inference.py -> result.py`。结果分析会在 `weight/training/history.json` 存在时读取该文件。推理输出包括 `ensemble`、`ensemble_mean`、`ensemble_std`、`mask` 和 `target`。随机数据由 Dataset 按索引生成,目前没有可与官方 Zarr 采样器配合使用的独立合成数据集。模型包发布时未附带本地训练权重或 `result/` 产物,运行命令后会在上述路径生成。 | |
| #### 官方真实数据推理 | |
| 目前尚无可直接运行的官方真实数据推理命令。该流程还需要 ERA5 涡度 GRIB/Zarr 数据和 ecCodes 环境,并需对官方 `evaluate.py` 中的文件路径进行参数化(parameterization)。 | |
| #### 真实数据 | |
| 官方涡度模型需要 ERA5 涡度、模式层 96/105/114/123/137、逐小时时间轴以及 0.25° 全球 GRIB/Zarr 数据。 | |
| ## 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 | | |
| ## 引用与许可证 | |
| - 官方代码采用 MIT 许可证。 | |
| - 官方模型权重声明采用 CC BY 4.0 许可。 | |
| - ERA5 受 Copernicus/ECMWF 数据条款约束。 | |