Skip to content

PBDL model for 物理感知神经网络流固耦合计算加速方法研究-王兆坤 #1137

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

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

cloud2009
Copy link

PR types

New Features

PR changes

Others.
Add an example about PBDL model used in '物理感知神经网络流固耦合计算加速方法研究'

Describe

This is the physics-based deep learning model to predict body force used in immerse boundary method. It can accelerate the traditional LBM calculation by this rapid predicted body force.

Copy link

paddle-bot bot commented Apr 9, 2025

Thanks for your contribution!

@CLAassistant
Copy link

CLAassistant commented Apr 9, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

Choose a reason for hiding this comment

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



def main(OUTPUT_DIR):

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change

Copy link
Author

Choose a reason for hiding this comment

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

Thank you! The main(OUTPUT_DIR) function is intended to be used later. I’ll keep it and add at least a pass statement to avoid syntax issues. Implementation is coming soon.

Comment on lines +164 to +177
for i, (x1_batch, x2_batch, y_batch) in enumerate(train_loader):
x1_batch, x2_batch, y_batch = (
x1_batch.to(device),
x2_batch.to(device),
y_batch.to(device),
)
break
for i, (x1_test, x2_test, y_test) in enumerate(test_loader):
x1_test, x2_test, y_test = (
x1_test.to(device),
x2_test.to(device),
y_test.to(device),
)
break
Copy link
Collaborator

Choose a reason for hiding this comment

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

这两段for循环的作用是?

Copy link
Author

Choose a reason for hiding this comment

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

这两段 for 循环的作用是提取训练集和测试集中的第一个batch 数据,并将其移动到对应的计算设备(如 GPU 或 CPU)。其中的 break 语句用于确保循环只执行一次,防止遍历完整个数据集。主要用途是用于调试或验证数据加载过程是否正确。如果后续进入正式训练阶段,这两个 break 语句是可以删除的,从而让训练/测试完整遍历整个数据集。

np.linalg.norm(test_prediction - test_target)
/ np.linalg.norm(test_target)
)
with open(f"{OUTPUT_DIR}/TestingLoss_L2.dat", "a") as file2:
Copy link
Collaborator

Choose a reason for hiding this comment

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

文件路径请使用os.path.join来拼接

Copy link
Author

Choose a reason for hiding this comment

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

感谢提醒!我会将相关路径拼接方式统一改为 os.path.join(OUTPUT_DIR, ...) 的形式。

Copy link
Collaborator

Choose a reason for hiding this comment

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

输出的日志不用上传

Copy link
Author

Choose a reason for hiding this comment

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

这是测试过程中实时监测的Loss文件,我们会在后续提交中将它们移除。

Copy link
Collaborator

Choose a reason for hiding this comment

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

输出的日志不用上传

Copy link
Author

Choose a reason for hiding this comment

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

这是训练过程中监测的Loss文件,我们会在后续提交中将它们移除。

Copy link
Collaborator

Choose a reason for hiding this comment

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

请转换成.pdparams格式的文件

Copy link
Author

Choose a reason for hiding this comment

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

好的

Copy link
Collaborator

Choose a reason for hiding this comment

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

输出的日志不用上传

Copy link
Author

Choose a reason for hiding this comment

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

好的

Copy link
Collaborator

Choose a reason for hiding this comment

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

输出的日志不用上传

Copy link
Author

Choose a reason for hiding this comment

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

好的

Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. 这个文件和checkpoint.pth有什么区别,如果是重复的文件,可以删除,否则请转换成.pdparams格式的文件

Copy link
Author

Choose a reason for hiding this comment

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

感谢您的提醒!这两个文件的主要区别如下:
1)checkpoint.pth:保存的是训练过程中的中间权重,同时还包含了优化器状态、当前轮次、loss 等信息,方便训练中断后继续训练(resume training)。
2)trained_model.pth:保存了最终的模型参数,用于推理或测试阶段的加载。

@HydrogenSulfate
Copy link
Collaborator

@cloud2009 另外请参考:https://paddlescience-docs.readthedocs.io/zh-cn/latest/zh/development/#3,补充案例文档

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.

3 participants