yushuang88 commited on
Commit
44e39da
·
verified ·
1 Parent(s): 41f44f3

Update README and model configuration

Browse files
Files changed (1) hide show
  1. README.md +165 -0
README.md ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ language:
4
+ - en
5
+ library_name: pytorch
6
+ datasets:
7
+ - OneScience-Group/ShapeNetCar
8
+ tags:
9
+ - OneScience
10
+ - computational-fluid-dynamics
11
+ - graph-neural-operator
12
+ - automotive-aerodynamics
13
+ - pde-surrogate-modeling
14
+ ---
15
+ <p align="center">
16
+ <strong>
17
+ <span style="font-size: 30px;">AMG</span>
18
+ </strong>
19
+ </p>
20
+
21
+ # Model Overview
22
+
23
+ AMG is a multi-graph neural operator for solving partial differential equations on arbitrary geometries. It was proposed by researchers from the Hong Kong University of Science and Technology (Guangzhou), Beihang University, and other institutions. The model uses multiscale graphs, a physics graph, and the dynamic graph-attention mechanism in GraphFormer to learn PDE solution operators on regularly or irregularly discretized domains. This package is trained for the ShapeNet-Car/CarCFD experiment. Given a three-dimensional vehicle geometry and mesh-node features, it predicts surface pressure and the surrounding airflow velocity field for rapid aerodynamic evaluation and drag-coefficient estimation.
24
+
25
+ This repository is an independent reproduction of the AMG ShapeNet-Car experiment, implemented through the OneScience workflow from the paper description and official configuration.
26
+
27
+ Paper: [Harnessing Scale and Physics: A Multi-Graph Neural Operator Framework for PDEs on Arbitrary Geometries](https://arxiv.org/abs/2411.15178)
28
+
29
+ # Model Description
30
+
31
+ AMG uses an encoder, a multi-graph processor, and a decoder. It takes discrete mesh-point coordinates and node features as input. A local graph captures high-frequency local variations, a global graph models long-range spatial dependencies, and a physics graph aggregates and propagates latent physical properties. The GraphFormer module performs cross-node interaction with dynamic graph attention and produces the PDE solution at the original discrete points. For the ShapeNet-Car/CarCFD task, the model predicts three velocity components and pressure on a three-dimensional unstructured mesh containing 32,186 points.
32
+
33
+ ## Use Cases
34
+
35
+ | Use Case | Description |
36
+ | --- | --- |
37
+ | Three-dimensional automotive external-flow prediction | Predict the three-dimensional velocity field around complex vehicle geometries and pressure on the vehicle surface |
38
+ | Automotive aerodynamic evaluation | Use predicted velocity and pressure fields to support drag-coefficient estimation and aerodynamic assessment |
39
+ | PDE learning on unstructured meshes | Build PDE surrogate models for three-dimensional unstructured meshes and irregular geometric domains |
40
+ | CFD surrogate modeling | Replace part of a costly numerical-simulation workflow to accelerate vehicle-shape design and batch evaluation of design candidates |
41
+
42
+ # Usage
43
+
44
+ ## 1. OneCode
45
+
46
+ Use the online OneCode environment for an intelligent, one-click AI for Science (AI4S) programming experience:
47
+
48
+ [Launch OneCode for one-click AI4S programming](https://web-2069360198568017922-iaaj.ksai.scnet.cn:58043/home)
49
+
50
+ ## 2. Manual Setup
51
+
52
+ **Hardware Requirements**
53
+
54
+ - A GPU or DCU is recommended.
55
+ - A CPU can be used for import checks and small-scale pipeline validation, but full training and inference will be slow.
56
+ - DCU users must install DTK in advance. DTK 25.04.2 or later, or the OneScience-recommended version for the target cluster, is recommended.
57
+
58
+ ### Download the Model Package from Hugging Face
59
+
60
+ ```bash
61
+ pip install -U huggingface_hub
62
+ hf download OneScience-Group/AMG-ShapeNet-Car --local-dir ./AMG-ShapeNet-Car
63
+ cd AMG-ShapeNet-Car
64
+ ```
65
+
66
+ ### Set Up the Runtime Environment
67
+
68
+ **DCU Environment**
69
+
70
+ ```bash
71
+ # Activate DTK and Conda first
72
+ conda create -n onescience311 python=3.11 -y
73
+ conda activate onescience311
74
+ # Installation with uv is also supported
75
+ pip install onescience[cfd-dcu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai
76
+ ```
77
+
78
+ **GPU Environment**
79
+
80
+ ```bash
81
+ # Activate Conda first
82
+ conda create -n onescience311 python=3.11 -y libstdcxx-ng=12 libgcc-ng=12 gcc_linux-64=12 gxx_linux-64=12
83
+ conda activate onescience311
84
+ # Installation with uv is also supported
85
+ pip install onescience[cfd-gpu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai
86
+ ```
87
+
88
+ ### Training Data
89
+
90
+ The OneScience community provides the ShapeNetCar training data on Hugging Face. Download it with the command below, then update `data.root` in `config/config.yaml` so that it points to the downloaded `preprocessed_data` directory.
91
+
92
+ ```bash
93
+ hf download OneScience-Group/ShapeNetCar --repo-type dataset --local-dir ./data
94
+ ```
95
+
96
+ The dataset contains 889 three-dimensional automotive external-flow samples organized into nine shards, `param0` through `param8`. It includes 690 training samples, 99 validation samples, and 100 test samples. Each sample contains 32,186 unstructured mesh points and the following files:
97
+
98
+ - `x.npy`: node input features with shape `(32186, 7)`; AMG uses the four features at indices `[3, 4, 5, 6]`
99
+ - `y.npy`: ground-truth CFD solution with shape `(32186, 4)`, containing three velocity components followed by pressure
100
+ - `pos.npy`: three-dimensional mesh-point coordinates with shape `(32186, 3)`
101
+ - `surf.npy`: vehicle-surface node mask with shape `(32186,)`
102
+ - `edge_index.npy`: unstructured-mesh edge connectivity with shape `(2, E)`
103
+
104
+ ### Training
105
+
106
+ Single-device training:
107
+
108
+ - Training parameters are read from the `data`, `model`, and `training` sections of `config/config.yaml`.
109
+ - The default configuration follows the paper and trains for 500 epochs. Add `--smoke` for a minimal end-to-end test.
110
+ - Before training, set `data.root` to the ShapeNetCar dataset's `preprocessed_data` directory.
111
+ - For the two-device, eight-hour profile, use `--profile fast_8h_2dcu`.
112
+
113
+ ```bash
114
+ python scripts/train.py
115
+ ```
116
+
117
+ Multi-device training:
118
+
119
+ ```bash
120
+ torchrun --standalone --nproc_per_node=<num_GPUs> scripts/train.py
121
+ ```
122
+
123
+ Two-device, eight-hour training profile:
124
+
125
+ ```bash
126
+ torchrun --standalone --nproc_per_node=2 scripts/train.py --profile fast_8h_2dcu
127
+ ```
128
+
129
+ Training reports the training loss, validation pressure relative L2 error, and validation velocity relative L2 error. The best checkpoint is selected using the mean validation relative L2 error and saved to:
130
+
131
+ ```text
132
+ ./weight/best_model.pt
133
+ ```
134
+
135
+ ### Model Weights
136
+
137
+ The `weight/` directory contains `best_model.pt`, the best AMG checkpoint obtained from this ShapeNet-Car/CarCFD reproduction. It can be loaded directly for inference.
138
+
139
+ ### Inference
140
+
141
+ ```bash
142
+ python scripts/inference.py
143
+ ```
144
+
145
+ Predictions, per-sample metrics, and aggregate metrics are saved under `results/`.
146
+
147
+ ### Evaluation and Visualization
148
+
149
+ ```bash
150
+ python scripts/result.py
151
+ ```
152
+
153
+ The evaluation report, paper-metric comparison plots, training curves, and flow-field visualizations are saved under `results/`.
154
+
155
+ # Official OneScience Resources
156
+
157
+ | Platform | OneScience Repository | Skills 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
+ # Citations and License
163
+
164
+ - Original AMG paper: [Harnessing Scale and Physics: A Multi-Graph Neural Operator Framework for PDEs on Arbitrary Geometries](https://arxiv.org/abs/2411.15178)
165
+ - This repository retains attribution to the original paper and the ShapeNet-Car/CarCFD dataset. Use of this project must comply with the licenses and terms that apply to the original paper, dataset, and related resources.