yushuang88 commited on
Commit
893fb8e
·
verified ·
1 Parent(s): 0280b83

Update README and model configuration

Browse files
Files changed (1) hide show
  1. README.md +166 -0
README.md ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language:
4
+ - en
5
+ library_name: pytorch
6
+ tags:
7
+ - OneScience
8
+ - fluid-dynamics
9
+ - neural-operator
10
+ - radon-transform
11
+ - darcy-flow
12
+ datasets:
13
+ - OneScience-Group/cfd_benchmark
14
+ ---
15
+
16
+ <p align="center">
17
+ <strong><span style="font-size: 30px;">RNO</span></strong>
18
+ </p>
19
+
20
+ # Model Introduction
21
+
22
+ RNO (Radon Neural Operator), proposed by researchers from Zhejiang University of Technology, learns PDE solution mappings with both global and local features in the sinogram domain through the Radon transform.
23
+
24
+ This repository is an independent OneScience reproduction of the Darcy-flow experiment. RNO learns the parameterized Darcy solution operator and predicts steady pressure from a porous-medium permeability or diffusion-coefficient field.
25
+
26
+ Paper: [Solving Partial Differential Equations via Radon Neural Operator](https://proceedings.neurips.cc/paper_files/paper/2025/file/e66233a208ef32f56df6312263239fa0-Paper-Conference.pdf)
27
+
28
+ # Model Description
29
+
30
+ For Darcy flow, RNO maps a two-dimensional permeability or diffusion-coefficient field \(a(x,y)\) to its scalar pressure solution \(u(x,y)\).
31
+
32
+ The architecture consists of feature lifting, Physics-Attention, a Radon block, and output projection. The input field and spatial coordinates are lifted to high-dimensional features; Physics-Attention extracts nonlocal information; and the Radon block projects features into the sinogram domain. Angle reweighting and sinogram convolution learn the contribution of different projection directions before filtered back-projection restores spatial features for the final Darcy solution.
33
+
34
+ ## Intended Uses
35
+
36
+ | Use case | Description |
37
+ | --- | --- |
38
+ | Darcy-flow prediction | Predict steady porous-medium pressure from a two-dimensional permeability or diffusion field. |
39
+ | Parameterized PDE solution | Learn an operator from coefficients, initial conditions, or boundary conditions to PDE solutions. |
40
+ | Scientific surrogate | Replace part of a costly numerical solve with fast batched prediction. |
41
+ | Cross-resolution prediction | Evaluate the learned operator at different spatial resolutions when supported by the training setup. |
42
+
43
+ # Usage
44
+
45
+ ## 1. OneCode
46
+
47
+ [Launch the OneCode AI-for-Science environment](https://web-2069360198568017922-iaaj.ksai.scnet.cn:58043/home)
48
+
49
+ ## 2. Manual Setup
50
+
51
+ **Hardware requirements**
52
+
53
+ - A GPU or DCU is recommended.
54
+ - A CPU can run imports and small connectivity checks, but full training and inference will be slow.
55
+ - DCU users should install DTK 25.04.2 or later, or the OneScience-recommended version for the cluster.
56
+
57
+ ### Download the model repository from Hugging Face
58
+
59
+ ```bash
60
+ pip install -U huggingface_hub
61
+ hf download OneScience-Group/RNO --local-dir ./RNO
62
+ cd RNO
63
+ ```
64
+
65
+ ### Install the runtime environment
66
+
67
+ **DCU environment**
68
+
69
+ ```bash
70
+ # Activate DTK first.
71
+ conda create -n onescience311 python=3.11 -y
72
+ conda activate onescience311
73
+ pip install onescience[cfd-dcu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai
74
+ ```
75
+
76
+ **GPU environment**
77
+
78
+ ```bash
79
+ conda create -n onescience311 python=3.11 -y libstdcxx-ng=12 libgcc-ng=12 gcc_linux-64=12 gxx_linux-64=12
80
+ conda activate onescience311
81
+ pip install onescience[cfd-gpu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai
82
+ ```
83
+
84
+ ### Download the training dataset from Hugging Face
85
+
86
+ ```bash
87
+ hf download OneScience-Group/cfd_benchmark \
88
+ --repo-type dataset \
89
+ --local-dir ./data
90
+ ```
91
+
92
+ The Darcy files are stored under `data/data/darcy/` after this download:
93
+
94
+ ```text
95
+ data/data/darcy/
96
+ ├── piececonst_r421_N1024_smooth1.mat
97
+ └── piececonst_r421_N1024_smooth2.mat
98
+ ```
99
+
100
+ Set `data.root` in `config/config.yaml` to the Darcy directory. Each MAT file contains 1,024 regular-grid samples at the original `421 x 421` resolution:
101
+
102
+ - `coeff`: the Darcy permeability or diffusion-coefficient field.
103
+ - `sol`: the corresponding steady pressure solution.
104
+
105
+ This experiment uses `piececonst_r421_N1024_smooth1.mat` for training and `piececonst_r421_N1024_smooth2.mat` for testing, with downsampling and normalization defined by the experiment configuration.
106
+
107
+ ### Train
108
+
109
+ ```bash
110
+ python scripts/train.py --config config/config.yaml
111
+ ```
112
+
113
+ Per-epoch metrics are logged and printed at the configured interval. The checkpoint with the lowest training relative L2 is saved to `weight/best_model.pth`.
114
+
115
+ ### Pretrained weights
116
+
117
+ The repository includes a Darcy-trained RNO checkpoint at `weight/best_model.pth` for inference or continued training.
118
+
119
+ ### Inference and evaluation
120
+
121
+ ```bash
122
+ python scripts/inference.py \
123
+ --config config/config.yaml \
124
+ --checkpoint weight/best_model.pth \
125
+ --device auto
126
+ ```
127
+
128
+ The script evaluates the fixed test set, prints the mean per-sample relative L2, computes relative L2 and gradient-relative L2 against paper references, and writes:
129
+
130
+ ```text
131
+ results/evaluation_metrics.json
132
+ results/predictions.npz
133
+ ```
134
+
135
+ `predictions.npz` contains predicted and target pressure fields, normalized permeability fields, and per-sample relative L2 values.
136
+
137
+ ### Visualization
138
+
139
+ ```bash
140
+ python scripts/result.py --results results
141
+ ```
142
+
143
+ Outputs:
144
+
145
+ ```text
146
+ results/training_curve.png
147
+ results/darcy_prediction.png
148
+ results/visualization_summary.json
149
+ ```
150
+
151
+ - `training_curve.png` shows total training loss, relative L2, and gradient-relative L2.
152
+ - `darcy_prediction.png` compares permeability, target pressure, predicted pressure, and absolute error.
153
+ - `visualization_summary.json` records visualization paths, test relative L2, and the paper comparison.
154
+
155
+ # OneScience
156
+
157
+ | Platform | OneScience repository | OneSkills repository |
158
+ | --- | --- | --- |
159
+ | Gitee | https://gitee.com/onescience-ai/onescience | https://gitee.com/onescience-ai/oneskills |
160
+ | GitHub | https://github.com/onescience-ai/OneScience | https://github.com/onescience-ai/oneskills |
161
+
162
+ # Citation and License
163
+
164
+ - Paper: [Solving Partial Differential Equations via Radon Neural Operator](https://proceedings.neurips.cc/paper_files/paper/2025/file/e66233a208ef32f56df6312263239fa0-Paper-Conference.pdf).
165
+ - Official implementation: [wenbin-lu/Radon-Neural-Operator](https://github.com/wenbin-lu/Radon-Neural-Operator), released under the [MIT License](https://github.com/wenbin-lu/Radon-Neural-Operator/blob/main/LICENSE).
166
+ - This repository uses the Hugging Face-compatible MIT identifier (`mit`). The dataset and other third-party resources remain subject to their original licenses and terms.