Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【SCU】【PPSCI Export&Infer No.32】phygeonet #1036

Merged
merged 10 commits into from
Dec 6, 2024

Conversation

PolaKuma
Copy link
Contributor

@PolaKuma PolaKuma commented Dec 5, 2024

PR types

Others

PR changes

Others

Describe

phygeonet案例添加了export和inference功能,由于pgl版本的缘故(paddle的fluid被迁移了),所以建议用2.5 paddle版本(仍保存dmodel),已成功运行。2.6及以上pgl引用paddle时候会缺失fluid算子。
Screenshot 2024-12-05 at 17 38 20
Screenshot 2024-12-05 at 17 39 16
Screenshot 2024-12-05 at 17 39 23

Copy link

paddle-bot bot commented Dec 5, 2024

Thanks for your contribution!

Copy link
Collaborator

@HydrogenSulfate HydrogenSulfate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

精度验证了下是对的,几处小问题还麻烦修改下

``` sh

# heat_equation
python heat_equation.py mode=export
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heat_equation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

确实是heat_equation🥺

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

确实是heat_equation🥺

哦这条评论忘记删了,没事儿

data = np.load(cfg.data_dir)
coords = data["coords"]

ofv_sb = paddle.to_tensor(data["OFV_sb"])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里好像不用转tensor?因为下面204行又转回numpy了

output_v[0, 0, pad_singleside:-pad_singleside, 0:pad_singleside] = 1
output_v[0, 0, 0, 0] = 0.5 * (output_v[0, 0, 0, 1] + output_v[0, 0, 1, 0])
output_v[0, 0, 0, -1] = 0.5 * (output_v[0, 0, 0, -2] + output_v[0, 0, 1, -1])

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里麻烦补充上以下代码,和evaluate保持一致:

    ev = paddle.sqrt(
        paddle.mean((ofv_sb - output_v[0, 0]) ** 2) / paddle.mean(ofv_sb**2)
    ).item()
    logger.info(f"ev: {ev}")

ax.set_aspect("equal")
ax.set_title("FV " + r"$T$")
fig.tight_layout(pad=1)
fig.savefig(f"{cfg.output_dir}/result.png", bbox_inches="tight")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

路径链接尽量不要用/, \\啥的,建议用下面这种方式

import os.path as osp
fig.savefig(osp.join(cfg.output_dir, "result.png"), bbox_inches="tight")
``

Comment on lines 218 to 220
truths = paddle.to_tensor(data["truths"])
coords = paddle.to_tensor(data["coords"])

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上,不用转tensor好像

j, 0, -2:-1, pad_singleside:-pad_singleside
]
output_v[j, 0, :, -pad_singleside:] = 0
output_v[j, 0, :, 0:pad_singleside] = paras[j, 0, 0, 0]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同理,这里补充evaluate里的指标评估代码:

error = paddle.sqrt(
    paddle.mean((truths - output_v) ** 2) / paddle.mean(truths**2)
).item()
logger.info(f"The average error: {error / num_sample}")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

同理,这里补充evaluate里的指标评估代码:

error = paddle.sqrt(
    paddle.mean((truths - output_v) ** 2) / paddle.mean(truths**2)
).item()
logger.info(f"The average error: {error / num_sample}")

docs/zh/examples/phygeonet.md Outdated Show resolved Hide resolved
docs/zh/examples/phygeonet.md Outdated Show resolved Hide resolved
docs/zh/examples/phygeonet.md Outdated Show resolved Hide resolved
docs/zh/examples/phygeonet.md Outdated Show resolved Hide resolved
examples/phygeonet/conf/heat_equation.yaml Outdated Show resolved Hide resolved
@HydrogenSulfate HydrogenSulfate merged commit 965156d into PaddlePaddle:develop Dec 6, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants