File size: 5,210 Bytes
3fef26f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
---
frameworks: ONNX Runtime
language:
- en
license: cc-by-nc-nd-4.0
tags:
- OneScience
- Earth Science
- Weather Forecast
- Subseasonal Forecast
- Ensemble Forecasting
- ERA5
- ONNX
tasks: []
datasets:
- OneScience/ERA5
---
<p align="center">
  <strong>
    <span style="font-size: 30px;">FuXi-S2S</span>
  </strong>
</p>

# Model Introduction

FuXi-S2S is a global subseasonal forecasting model proposed by researchers from Fudan University and collaborating institutions.

Paper: A machine learning model that outperforms conventional global subseasonal forecast models

https://doi.org/10.1038/s41467-024-50714-1

# Model Description

FuXi-S2S takes two consecutive daily mean atmospheric states as input and targets the two-week to two-month forecast range, where conventional numerical models remain challenging to use effectively. This model package exposes the official ONNX inference graph through a small ONNX Runtime adapter.

# Use Cases

| Scenario | Description |
| :---: | :--- |
| Global subseasonal forecasting | Run the official FuXi-S2S ONNX weights with ERA5 inputs following the fixed 76-channel order. |
| Local quick validation | Use synthetic HDF5 data to check data loading, ONNX Runtime execution, and visualization. |
| ModelScope / OneCode execution | Download the standalone model package, configure an ONNX Runtime provider, and run the scripts directly. |

# Usage Guide

## 1. OneCode Usage

Experience intelligent one-click AI4S programming through the OneCode online environment:

[Click to Experience Intelligent One-Click AI4S Programming](https://web-2069360198568017922-iaaj.ksai.scnet.cn:58043/home)

## 2. Manual Installation and Usage

**Hardware Requirements**

- A GPU or DCU is recommended for practical inference. CPU can be used for import and small-scale connectivity checks, but full-resolution inference will be slow.
- Install the ONNX Runtime build that provides the execution provider required by your hardware.
- 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

```bash
hf download OneScience-Group/FuXi-S2S --local-dir ./FuXi-S2S
cd FuXi-S2S
```

### Install the Runtime Environment

**DCU Environment**

```bash
# 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**
```bash
# 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
```

Install or select an ONNX Runtime provider matching the target hardware, then update `model.providers` in `conf/config.yaml` if necessary. The default configuration targets a DCU-compatible provider list.

### Training Data Introduction

The official model uses daily mean ERA5 states with a fixed 76-channel order. The OneScience community provides an ERA5 data slice:

```bash
hf download --repo-type dataset OneScience-Group/ERA5 --local-dir ./data
```

The adapter expects yearly files under `data/data/` and normalization arrays under `data/stats/`. Confirm the variable order in `conf/config.yaml` before inference.

### Generate Synthetic Data

When real ERA5 data is unavailable, generate native-grid HDF5 files for interface checks:

```bash
python scripts/fake_data.py
```

For a smaller smoke fixture, pass `--height 32 --width 64`; synthetic data does not reproduce the official forecast quality.

### Pre-trained Weights

The official ONNX graph requires both files below:

```text
weight/fuxi_s2s.onnx
weight/fuxi_s2s
```

The large weight files are not bundled in this working copy and must be supplied from the authorized release. The `weight/` directory is reserved for these files.

### Inference

Inference reads `weight/fuxi_s2s.onnx` and its external data file by default. It converts ERA5 fields to the model's `121x240` grid and writes ONNX outputs to `result/output/`:

```bash
python scripts/inference.py
```

Use `--device cpu`, `--device cuda`, or `--device dcu` and configure `model.providers` for the selected runtime.

### Evaluation and Visualization

```bash
python scripts/result.py
```

The result script reads the newest NPY output and writes multi-variable forecast figures to `result/visualization/`.

# 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 model package contains an adapter for the official FuXi-S2S ONNX release.
- The official ONNX graph, external data file, and related data are subject to the CC BY-NC-ND 4.0 terms stated by the authorized release.