Image-to-Image
PyTorch
fuxi
transformer
tpys commited on
Commit
2fcfccf
·
1 Parent(s): ca036c1

Preserve essential model context after inference documentation refresh

Browse files

Restore the architecture, FuXi-1.0 comparison, training-data provenance, evaluation scope and results, and known limitations removed during today's inference-focused rewrite. Keep the corrected q units, normalization and precipitation behavior, quick-start arguments, and current file inventory.

Constraint: Preserve all factual corrections introduced by the 2026-07-30 model-card updates

Rejected: Revert the README wholesale | would reintroduce incorrect q units and lose current inference guidance

Confidence: high

Scope-risk: narrow

Directive: Keep architecture and evaluation caveats when revising inference documentation

Tested: git diff --cached --check; verified restored headings, image references, units, forecast_time, PT2 suffix, and infer_log entry

Not-tested: Inference execution; documentation-only change

Files changed (1) hide show
  1. README.md +143 -9
README.md CHANGED
@@ -18,7 +18,38 @@ metrics:
18
 
19
  # FuXi 2.1 — Global Weather Forecasting Model
20
 
21
- FuXi 2.1 is a 0.25-degree global weather forecasting model producing 85-channel predictions at 6-hour intervals. This repository provides minimal inference code for autoregressive rollout using the PyTorch PT2 (torch.export) backend.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
  ## Quick Start
24
 
@@ -49,13 +80,37 @@ python plot.py --output_dir ./output --channels t2m z500 tp --discrete
49
  | Channels | 85 (65 pressure-level + 20 surface) |
50
  | Time step | 6 hours |
51
  | Input frames | 2 (t-6h, t) |
52
- | Architecture | FuXi HR |
53
- | Format | torch.export (.pth) |
 
54
  | Size | ~3.7 GB |
55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  ## Input Format
57
 
58
  The input NetCDF file must contain a variable named `input` with:
 
59
  - **Shape**: `(time=2, channel=85, lat=721, lon=1440)`
60
  - **Normalization**: z-score normalized (already in normalized space)
61
  - **Coordinates**: `time`, `channel` (C85 names), `lat` (90 to -90), `lon` (0 to 359.75)
@@ -65,6 +120,7 @@ The provided `input.nc` is a sample input for 2024-09-29 00Z. Both `input.nc` an
65
  ## Output Format
66
 
67
  Each forecast step is saved as `{output_dir}/{step:03d}.nc`:
 
68
  - **Shape**: `(channel=85, lat=721, lon=1440)`
69
  - **Units**: Physical units (denormalized via `output = output * std + mean`)
70
  - **Coordinates**: `channel`, `lat`, `lon`
@@ -74,13 +130,31 @@ Step numbering is 1-based: `001.nc` = +6h, `002.nc` = +12h, ..., `040.nc` = +240
74
 
75
  > **Note:** The `tp` (total precipitation) channel is log1p-transformed during training. Denormalization reverses this with `expm1` and clips to ≥ 0.
76
 
77
- ## Channel Table (C85)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
 
79
  **Pressure-level variables** (5 vars × 13 levels = 65 channels):
 
80
  - z (geopotential), t (temperature), u (u-wind), v (v-wind), q (specific humidity, **g/kg** — scaled ×1000 from ERA5's kg/kg)
81
  - Levels: 50, 100, 150, 200, 250, 300, 400, 500, 600, 700, 850, 925, 1000 hPa
82
 
83
  **Surface variables** (20 channels):
 
84
  | Channel | Variable | Units |
85
  |---------|----------|-------|
86
  | msl | Mean sea level pressure | Pa |
@@ -98,6 +172,9 @@ Step numbering is 1-based: `001.nc` = +6h, `002.nc` = +12h, ..., `040.nc` = +240
98
 
99
  See `variables.py` for the full ordered list.
100
 
 
 
 
101
  ## GPU Requirements
102
 
103
  - **Minimum GPU memory**: ~8 GB (model ~4 GB + state ~1.4 GB + working memory)
@@ -134,17 +211,74 @@ The recurrence state stays on GPU throughout the rollout (no CPU round-trip per
134
 
135
  The specific humidity `q` is stored and predicted in **g/kg** (grams of water vapor per kg of dry air), not the raw ERA5 kg/kg. During data preparation, ERA5 q values were multiplied by 1000 before normalization. This scaling is baked into the model's normalization statistics (`mean.nc` / `std.nc`), so denormalized output will be in g/kg. Typical near-surface values range from 0–25 g/kg.
136
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  ## Citation
138
 
 
 
139
  ```bibtex
140
  @article{chen2023fuxi,
141
- title={FuXi: A cascade machine learning forecasting system for 15-day global weather forecast},
142
- author={Chen, Lei and Zhong, Xiaohui and Zhang, Feng and Cheng, Yuan and Xu, Yinghui and Qi, Yuan and Li, Hao},
143
- journal={npj Climate and Atmospheric Science},
144
- year={2023}
 
 
 
145
  }
146
  ```
147
 
148
  ## License
149
 
150
- Please refer to the model license for usage terms.
 
 
 
 
 
 
18
 
19
  # FuXi 2.1 — Global Weather Forecasting Model
20
 
21
+ **FuXi-2.1** is a global, deterministic machine-learning weather forecasting model
22
+ developed by **Fudan University** and **[SAIS](https://www.sais.com.cn/)**. It produces
23
+ 85-channel forecasts at **0.25°** resolution, in **6-hourly** steps, out to **10 days**.
24
+
25
+ FuXi-2.1 targets a defining failure mode of data-driven weather prediction: forecasts
26
+ that blur toward a smooth spatial average as lead time grows, erasing the small-scale
27
+ structure that matters most for extremes. It produces markedly sharper fields whose
28
+ spatial power spectra track observations across the full wavenumber range, while keeping
29
+ deterministic skill (RMSE) comparable to FuXi-1.0 and substantially improving
30
+ extreme-event detection for heavy precipitation and strong wind.
31
+
32
+ This model is part of the
33
+ **[FuXi Single collection](https://huggingface.co/collections/tpys/fuxi-single)**.
34
+ This repository provides the exported model and minimal inference code for
35
+ autoregressive rollout using the PyTorch PT2 (`torch.export`) backend.
36
+
37
+ ## What's New in 2.1
38
+
39
+ Relative to [FuXi-1.0](https://github.com/tpys/FuXi), FuXi-2.1 introduces:
40
+
41
+ - **A flat Transformer backbone** replacing FuXi-1.0's U-Transformer
42
+ (ResNet downsample → Swin Transformer → upsample). FuXi-2.1 removes the U-shaped
43
+ up/down-sampling path in favor of a single Transformer trunk.
44
+ - **Rotary position embeddings (RoPE)** inside Swin windowed attention, replacing the
45
+ learned relative-position bias used in FuXi-1.0.
46
+ - **adaLN time conditioning** that injects forecast lead step, time of day, and
47
+ day-of-year phase into every block.
48
+ - **A variable-aware multi-head decoder** with specialized output heads for
49
+ pressure-level, surface, and derived variables.
50
+
51
+ The combined effect is sharper, spectrally faithful forecasts without a penalty on
52
+ mean-error skill.
53
 
54
  ## Quick Start
55
 
 
80
  | Channels | 85 (65 pressure-level + 20 surface) |
81
  | Time step | 6 hours |
82
  | Input frames | 2 (t-6h, t) |
83
+ | Forecast type | Global, deterministic, autoregressive |
84
+ | Architecture | Patch embedding → Swin attention with RoPE + adaLN → multi-head decoder |
85
+ | Format | `torch.export` (`.pt2`) |
86
  | Size | ~3.7 GB |
87
 
88
+ ### Architecture
89
+
90
+ FuXi-2.1 is a single Transformer. The global atmospheric state is split into patches and
91
+ embedded into tokens, processed by a stack of windowed-attention blocks, and read out by
92
+ a variable-aware multi-head decoder. One deterministic forward pass predicts the next
93
+ 6-hour state; predictions are then rolled out autoregressively.
94
+
95
+ <div align="center">
96
+ <img src="assets/arch.png" alt="FuXi-2.1 architecture" style="width: 95%;"/>
97
+ </div>
98
+
99
+ | Component | Specification |
100
+ |---|---|
101
+ | Backbone | Single Transformer trunk (no U-Net up/down-sampling) |
102
+ | Attention | Swin windowed attention |
103
+ | Position encoding | Rotary position embedding (RoPE, 1-D) |
104
+ | Normalization / conditioning | adaLN conditioned on lead step, time of day, and day of year |
105
+ | Feed-forward network | SwiGLU |
106
+ | Decoder | Variable-aware multi-head (pressure-level / surface / derived) |
107
+ | Input | Two states at t−6 h and t |
108
+ | Output | State at t+6 h, rolled out autoregressively |
109
+
110
  ## Input Format
111
 
112
  The input NetCDF file must contain a variable named `input` with:
113
+
114
  - **Shape**: `(time=2, channel=85, lat=721, lon=1440)`
115
  - **Normalization**: z-score normalized (already in normalized space)
116
  - **Coordinates**: `time`, `channel` (C85 names), `lat` (90 to -90), `lon` (0 to 359.75)
 
120
  ## Output Format
121
 
122
  Each forecast step is saved as `{output_dir}/{step:03d}.nc`:
123
+
124
  - **Shape**: `(channel=85, lat=721, lon=1440)`
125
  - **Units**: Physical units (denormalized via `output = output * std + mean`)
126
  - **Coordinates**: `channel`, `lat`, `lon`
 
130
 
131
  > **Note:** The `tp` (total precipitation) channel is log1p-transformed during training. Denormalization reverses this with `expm1` and clips to ≥ 0.
132
 
133
+ ## Data Details
134
+
135
+ ### Training Data
136
+
137
+ FuXi-2.1 was trained on ERA5 reanalysis at 0.25° resolution and a 6-hour cadence.
138
+
139
+ - **Training period:** 2002–2023
140
+ - **Held-out test period:** 2024
141
+
142
+ ### Channel Table (C85)
143
+
144
+ FuXi-2.1 operates on 85 channels per time step: 65 pressure-level channels
145
+ (5 variables × 13 levels) and 20 surface channels, plus static forcings supplied as
146
+ constant inputs. Most channels are **prognostic**: they are both input and output
147
+ channels and are fed back during rollout. Radiation fluxes and total precipitation are
148
+ **diagnostic** outputs from a dedicated decoder head; they are predicted but not fed
149
+ back as inputs.
150
 
151
  **Pressure-level variables** (5 vars × 13 levels = 65 channels):
152
+
153
  - z (geopotential), t (temperature), u (u-wind), v (v-wind), q (specific humidity, **g/kg** — scaled ×1000 from ERA5's kg/kg)
154
  - Levels: 50, 100, 150, 200, 250, 300, 400, 500, 600, 700, 850, 925, 1000 hPa
155
 
156
  **Surface variables** (20 channels):
157
+
158
  | Channel | Variable | Units |
159
  |---------|----------|-------|
160
  | msl | Mean sea level pressure | Pa |
 
172
 
173
  See `variables.py` for the full ordered list.
174
 
175
+ **Static forcings** include the land-sea mask, orography/geopotential,
176
+ latitude/longitude encodings, and time-of-day/day-of-year encodings.
177
+
178
  ## GPU Requirements
179
 
180
  - **Minimum GPU memory**: ~8 GB (model ~4 GB + state ~1.4 GB + working memory)
 
211
 
212
  The specific humidity `q` is stored and predicted in **g/kg** (grams of water vapor per kg of dry air), not the raw ERA5 kg/kg. During data preparation, ERA5 q values were multiplied by 1000 before normalization. This scaling is baked into the model's normalization statistics (`mean.nc` / `std.nc`), so denormalized output will be in g/kg. Typical near-surface values range from 0–25 g/kg.
213
 
214
+ ## Evaluation
215
+
216
+ We compare FuXi-2.1 with FuXi-1.0 under an identical protocol: forecasts initialized
217
+ from ERA5 and rolled out to 240 hours in 6-hour steps. CSI is computed globally over
218
+ land only.
219
+
220
+ > **Evaluation scope:** These values come from a limited set of sample cases rather than
221
+ > a full-year evaluation. Treat them as indicative; broader scorecards will follow.
222
+
223
+ RMSE remains comparable to FuXi-1.0 across variables, while structural and
224
+ extreme-event scores improve substantially.
225
+
226
+ <div align="center">
227
+ <img src="assets/chart_tp_csi.png" alt="Precipitation CSI" style="width: 49%;"/>
228
+ <img src="assets/chart_ws10m_csi.png" alt="Wind-speed CSI" style="width: 49%;"/>
229
+ </div>
230
+
231
+ ### Precipitation — Critical Success Index (CSI)
232
+
233
+ | Threshold | FuXi-1.0 | FuXi-2.1 | Δ |
234
+ |:---|---:|---:|---:|
235
+ | ≥ 5 mm | 0.265 | 0.284 | +7.3% |
236
+ | ≥ 20 mm | 0.131 | 0.146 | +11.4% |
237
+ | ≥ 50 mm | 0.074 | 0.084 | +13.4% |
238
+ | ≥ 100 mm | 0.014 | 0.024 | **+68.3%** |
239
+
240
+ ### 10 m Wind Speed — Critical Success Index (CSI)
241
+
242
+ | Threshold | FuXi-1.0 | FuXi-2.1 | Δ |
243
+ |:---|---:|---:|---:|
244
+ | ≥ 10.8 m·s⁻¹ | 0.544 | 0.571 | +4.8% |
245
+ | ≥ 24.5 m·s⁻¹ | 0.165 | 0.198 | +20.3% |
246
+ | ≥ 28.5 m·s⁻¹ | 0.000 | 0.044 | newly resolved |
247
+
248
+ The relative gain grows with event intensity and peaks at the extreme tail. At the
249
+ 28.5 m·s⁻¹ wind threshold, FuXi-1.0 scores zero whereas FuXi-2.1 attains a non-zero CSI.
250
+ FuXi-2.1's spatial power spectra track the observed spectra across the full wavenumber
251
+ range, in contrast with FuXi-1.0's high-wavenumber energy deficit.
252
+
253
+ ## Known Limitations
254
+
255
+ - FuXi-2.1 is deterministic and does not provide a calibrated ensemble spread.
256
+ - The CSI results above cover a limited set of sample cases and are not a full-year
257
+ scorecard.
258
+ - As with all ERA5-trained models, forecast skill depends on the quality and resolution
259
+ of the initial conditions.
260
+
261
  ## Citation
262
 
263
+ If you use FuXi-2.1, please cite the FuXi series:
264
+
265
  ```bibtex
266
  @article{chen2023fuxi,
267
+ title = {FuXi: A cascade machine learning forecasting system for 15-day global weather forecast},
268
+ author = {Chen, Lei and Zhong, Xiaohui and Zhang, Feng and Cheng, Yuan and Xu, Yinghui and Qi, Yuan and Li, Hao},
269
+ journal = {npj Climate and Atmospheric Science},
270
+ year = {2023},
271
+ volume = {6},
272
+ pages = {190},
273
+ doi = {10.1038/s41612-023-00512-1}
274
  }
275
  ```
276
 
277
  ## License
278
 
279
+ FuXi-2.1 is released under the
280
+ [Creative Commons Attribution 4.0 International license](https://creativecommons.org/licenses/by/4.0/).
281
+
282
+ **Code:** FuXi-1.0 — https://github.com/tpys/FuXi
283
+
284
+ *© 2026 Fudan University & [SAIS](https://www.sais.com.cn/) · FuXi Weather.*