Skip to content

feat: add G-FNO (Group Equivariant Fourier Neural Operator) model#141

Open
lkyu-ly wants to merge 3 commits into
PaddlePaddle:developfrom
lkyu-ly:feat/G-FNO
Open

feat: add G-FNO (Group Equivariant Fourier Neural Operator) model#141
lkyu-ly wants to merge 3 commits into
PaddlePaddle:developfrom
lkyu-ly:feat/G-FNO

Conversation

@lkyu-ly

@lkyu-ly lkyu-ly commented Apr 21, 2026

Copy link
Copy Markdown
  • Add core model package ppcfd/models/g_fno/ with FNO, GCNN, GFNO, Ghybrid, radialNO 2D/3D variants
  • Migrate training scripts, data generation tools and README to examples/G-FNO/
  • Register g_fno as optional dependency in ppcfd/models/init.py

forward diff

Since the original model did not release pre-trained weights, forward precision alignment was performed using randomly initialized model weights.

model_config={'num_channels': 1, 'initial_step': 10, 'modes': 12, 'width': 10, 'reflection': False, 'grid_type': 'symmetric'}
input_shape=(2, 64, 64, 10, 1)
torch_output_shape=(2, 64, 64, 1, 1)
paddle_output_shape=(2, 64, 64, 1, 1)
torch_mean=-1.874004304409e-01
torch_std=4.745460674167e-02
paddle_mean=-1.874004602432e-01
paddle_std=4.745460301638e-02
mean_abs_error=6.605296221096e-08
max_abs_error=3.427267074585e-07
>>> mean_rel_error=3.910871670800e-07
max_rel_error=1.200105609294e-05

@lkyu-ly

lkyu-ly commented May 14, 2026

Copy link
Copy Markdown
Author

Due to the different behaviors of DataLoader in constructing training batches on the Paddle and Torch sides, it is impossible to align the training loss of Torch and Paddle model implementations without controlling the training data behavior.

To align the training loss with the Torch implementation, you need to pass the --debug_initial_state_path and --debug_batch_order_path parameters when running experiment.py to modify the data loading logic (the Torch code needs to be modified in the same way).

After alignment, the training loss for the first ten epochs is as follows:

Epoch Torch train Paddle train
0 2.812617205704e-01 2.813356721774e-01
1 1.845358097926e-02 1.848286241293e-02
2 9.400227867688e-03 9.394724480808e-03
3 6.490346913536e-03 6.522691513722e-03
4 5.093538621441e-03 4.809832565176e-03
5 5.873561472011e-03 4.971065659386e-03
6 3.246136389983e-03 4.314367046269e-03
7 2.722640871070e-03 2.368335577194e-03
8 1.788152358495e-03 1.759155808638e-03
9 1.650591345970e-03 1.652324215199e-03

max_abs_diff: 0.001068
mean_abs_diff: 0.000278
rmse: 0.000466
max_rel_diff: 0.247598
mean_rel_diff: 0.066266
train loss diff range: [-0.000902, 0.001068]

@zhiminzhang0830

Copy link
Copy Markdown

Due to the different behaviors of DataLoader in constructing training batches on the Paddle and Torch sides, it is impossible to align the training loss of Torch and Paddle model implementations without controlling the training data behavior.

To align the training loss with the Torch implementation, you need to pass the --debug_initial_state_path and --debug_batch_order_path parameters when running experiment.py to modify the data loading logic (the Torch code needs to be modified in the same way).

After alignment, the training loss for the first ten epochs is as follows:

Epoch Torch train Paddle train
0 2.812617205704e-01 2.813356721774e-01
1 1.845358097926e-02 1.848286241293e-02
2 9.400227867688e-03 9.394724480808e-03
3 6.490346913536e-03 6.522691513722e-03
4 5.093538621441e-03 4.809832565176e-03
5 5.873561472011e-03 4.971065659386e-03
6 3.246136389983e-03 4.314367046269e-03
7 2.722640871070e-03 2.368335577194e-03
8 1.788152358495e-03 1.759155808638e-03
9 1.650591345970e-03 1.652324215199e-03
max_abs_diff: 0.001068 mean_abs_diff: 0.000278 rmse: 0.000466 max_rel_diff: 0.247598 mean_rel_diff: 0.066266 train loss diff range: [-0.000902, 0.001068]

看到这个PR里面包含了FNO、GFNO的多个模型,请问这个对齐结果是基于哪个模型做的?另,最大绝对误差在1e-4的量级还是有点大,float32精度下,1e-6的误差量级可能才比较合理

@lkyu-ly

lkyu-ly commented Jun 23, 2026

Copy link
Copy Markdown
Author

看到这个PR里面包含了FNO、GFNO的多个模型,请问这个对齐结果是基于哪个模型做的?另,最大绝对误差在1e-4的量级还是有点大,float32精度下,1e-6的误差量级可能才比较合理

  1. 对齐结果基于GFNO2d_p4模型,详见原实现 https://github.com/divelab/AIRS/tree/main/OpenPDE/G-FNO 中的使用案例
  2. 关于“前向精度对齐”,指标要求diff在1e-4量级;对于训练,要求两轮LOSS一致,参考其他类型模型关于LOSS的标准,为“loss曲线误差在 0 上下波动”。

模型复现验收主要标准:
1、单卡前向精度对齐:前向loss diff 1e-4 量级。
2、反向对齐:训练2轮以上,loss一致。

loss曲线验证:在以下数据集和超参数上训练,与 ms-swift 的 loss曲线误差在 0 上下波动。(对于PaddleFormers中的模型)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants