-
Notifications
You must be signed in to change notification settings - Fork 184
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
Conversation
Thanks for your contribution! |
There was a problem hiding this 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
heat_equation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
确实是heat_equation🥺
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
确实是heat_equation🥺
哦这条评论忘记删了,没事儿
examples/phygeonet/heat_equation.py
Outdated
data = np.load(cfg.data_dir) | ||
coords = data["coords"] | ||
|
||
ofv_sb = paddle.to_tensor(data["OFV_sb"]) |
There was a problem hiding this comment.
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]) | ||
|
There was a problem hiding this comment.
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}")
examples/phygeonet/heat_equation.py
Outdated
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") |
There was a problem hiding this comment.
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")
``
truths = paddle.to_tensor(data["truths"]) | ||
coords = paddle.to_tensor(data["coords"]) | ||
|
There was a problem hiding this comment.
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] |
There was a problem hiding this comment.
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}")
There was a problem hiding this comment.
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}")
PR types
Others
PR changes
Others
Describe
为
phygeonet
案例添加了export和inference功能,由于pgl版本的缘故(paddle的fluid被迁移了),所以建议用2.5 paddle版本(仍保存dmodel),已成功运行。2.6及以上pgl引用paddle时候会缺失fluid算子。