Skip to content

[FEAT] add code of PhysicsRegression model#136

Open
lkyu-ly wants to merge 4 commits into
PaddlePaddle:developfrom
lkyu-ly:feat/phye2e
Open

[FEAT] add code of PhysicsRegression model#136
lkyu-ly wants to merge 4 commits into
PaddlePaddle:developfrom
lkyu-ly:feat/phye2e

Conversation

@lkyu-ly
Copy link
Copy Markdown

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

This example integrates the Paddle version of PhysicsRegression into PaddleCFD for the paper A Neural Symbolic Model for Space Physics.

This example is able to run on both Nvidia GPU and Custom Device(using iluvatar for test). CINN is also supported.

Loss comparison of a training test on a rather small config than default:

image

froward diff:

logits_shape: (7, 10570)
torch_dtype: float32
paddle_dtype: float32
mean_abs_error: 5.4308799236e-07
max_abs_error: 5.7220458984e-06
mean_rel_error: 1.6366435602e-06
max_rel_error: 3.4902596381e-03

@lkyu-ly
Copy link
Copy Markdown
Author

lkyu-ly commented Apr 29, 2026

To switch to _SimpleIterator for deterministic cross-framework loss alignment:

  1. Comment out the return paddle.io.DataLoader(...) block above.
  2. Uncomment the class _SimpleIterator and the final return _SimpleIterator(...) below.
  3. If aligning against a PyTorch baseline, the PyTorch side MUST apply the same change
    (replace its DataLoader with an equivalent _SimpleIterator) — otherwise batch order and
    RNG state will diverge between the two frameworks, making per-step loss comparison invalid.

Loss alignment results (first epoch, sampled every 50 steps, PyTorch vs Paddle):
Shape: (10,) | dtype: float32 vs float32
max_abs_diff: 0.007700 mean_abs_diff: 0.003450 rmse: 0.004042
max_rel_diff: 0.043800 mean_rel_diff: 0.019583
diff range: [-0.007700, 0.003900]

1777456682972_d image

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