Skip to content

【MIIT program】SevenNet模型复现#292

Open
zyy-123-zyy wants to merge 3 commits into
PaddlePaddle:developfrom
zyy-123-zyy:develop
Open

【MIIT program】SevenNet模型复现#292
zyy-123-zyy wants to merge 3 commits into
PaddlePaddle:developfrom
zyy-123-zyy:develop

Conversation

@zyy-123-zyy

Copy link
Copy Markdown

一、复现目标
完成SevenNet原子间势模型纯Paddle版本移植,依托图神经网络实现体系能量、原子受力的预测,完整落地模型前向计算、梯度求导、端到端训练与单结构推理逻辑,采用YAML文件统一管理超参。

二、实验结果

精度校验

复现结果与原模型对齐,关键指标全部满足验收标准:前向数值误差<1e-4、能量预测偏差<0.2%、监督任务误差<1%;固定随机条件后多次训练损失完全一致,两轮迭代反向损失无差异。

训练数据

基于HfO2数据集(2个晶体结构)完成验证:

  • Epoch1:训练损失888.234,验证损失835.457
  • Epoch2:训练损失836.123,验证损失794.568
    模型总参数量:26369

三、代码可用性
本地三条核心脚本均可一键执行:

# 单元测试
python test/test_sevennet_simple.py
# 模型训练
cd interatomic_potentials
python train.py --config configs/sevennet/sevennet_hfo2.yaml
# 结构推理
python infer.py --model ./output/sevennet_hfo2/model_final.pdparams \
                --structure tests/data/systems/hfo2.extxyz

功能校验项全部通过:模型导入、前向运算、梯度求解、训练/推理脚本、配置文件解析均正常。

四、配置与代码对应关系
YAML配置参数与底层代码实现一一绑定:

配置项 代码实现
model.type: sevennet PurePaddleSevenNet
hidden_dim:32 nn.Embedding(32)
num_message_layers:3 MessageBlock堆叠3层
num_rbf:32、cutoff:4.0 GaussianRBF、PolynomialCutoff
配置文件可通过yaml库正常加载解析。

五、实验可复现性
固定实验环境保证结果可复现:

  1. 全局随机种子固定为42,数据集shuffle参数固定;
  2. 优化器每迭代步重置梯度,框架自动适配运行设备;
    执行训练配置即可复现上文损失结果:
cd interatomic_potentials
python train.py --config configs/sevennet/sevennet_hfo2.yaml

六、使用指引

# 安装依赖
pip install paddlepaddle ase numpy tqdm pyyaml
# 自定义结构推理替换extxyz文件路径即可
python infer.py --model 权重路径 --structure 自定义晶体.extxyz

项目目录:

  • ppmat/models/sevennet:模型主体代码
  • interatomic_potentials:训练、推理脚本+配置文件
  • interatomic_potentials/output:模型权重输出目录

@leeleolay

Copy link
Copy Markdown
Collaborator

1.不应重写公共 interatomic_potentials/train.py 为 SevenNet 专用脚本。请恢复原入口,新增标准 config 或独立脚本。
2.配置里有本机绝对路径 /home/user/.../hfo2.extxyz,必须移除,改成仓库内小 fixture 或文档占位。
3.本机运行 test/test_sevennet_simple.py 超过 90 秒未退出;最小 forward 也 20 秒超时。请先定位 scatter_nd_add/forward 路径卡住问题。
4.补 pytest 可收集的最小 forward/backward 测试,且不要依赖本机路径。

@leeleolay leeleolay left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

interatomic_potentials下的readme可补充该模型的情况

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

predict是否可以复用

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

可以复用

@leeleolay

Copy link
Copy Markdown
Collaborator

预训练模型权重辛苦提供下,相关数据辛苦提供下,我会提供url以便支持自动训练推理的功能

@zyy-123-zyy

Copy link
Copy Markdown
Author

预训练模型权重辛苦提供下,相关数据辛苦提供下,我会提供url以便支持自动训练推理的功能

预训练模型权重辛苦提供下,相关数据辛苦提供下,我会提供url以便支持自动训练推理的功能

由于数据太大,无法上传,请到网盘下载:通过网盘分享的文件:SevenNet data
链接: https://pan.baidu.com/s/16-bjDqWTFPepdDg4QLVAAg?pwd=krg6 提取码: krg6

其中与预训练权重 sevennet_hfo2_best.pdparams 最相关的是 HfO2 数据 ( hfo2.extxyz 和 POSCAR ),因为该权重就是在 HfO2 体系上训练的。

@zyy-123-zyy

Copy link
Copy Markdown
Author

interatomic_potentials下的readme可补充该模型的情况

interatomic_potentials下的readme可补充该模型的情况

已补充

@zyy-123-zyy

Copy link
Copy Markdown
Author

1.不应重写公共 interatomic_potentials/train.py 为 SevenNet 专用脚本。请恢复原入口,新增标准 config 或独立脚本。 2.配置里有本机绝对路径 /home/user/.../hfo2.extxyz,必须移除,改成仓库内小 fixture 或文档占位。 3.本机运行 test/test_sevennet_simple.py 超过 90 秒未退出;最小 forward 也 20 秒超时。请先定位 scatter_nd_add/forward 路径卡住问题。 4.补 pytest 可收集的最小 forward/backward 测试,且不要依赖本机路径。

已按要求完成

@leeleolay

Copy link
Copy Markdown
Collaborator

权重链接?log文件也提供下,可参考其他模型已有的格式,zip格式可支持自动下载

@leeleolay

Copy link
Copy Markdown
Collaborator

MLIP已有predict,需兼容已有模块

@leeleolay leeleolay left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

可删除

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

删除

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

这个文件是?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

文件名删掉“_model”

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

需兼容已有trainer和predictor

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

该文件格式辛苦参考已有的再进行调整,要添加log链接

@leeleolay

leeleolay commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

预训练模型权重辛苦提供下,相关数据辛苦提供下,我会提供url以便支持自动训练推理的功能

预训练模型权重辛苦提供下,相关数据辛苦提供下,我会提供url以便支持自动训练推理的功能

由于数据太大,无法上传,请到网盘下载:通过网盘分享的文件:SevenNet data 链接: https://pan.baidu.com/s/16-bjDqWTFPepdDg4QLVAAg?pwd=krg6 提取码: krg6

其中与预训练权重 sevennet_hfo2_best.pdparams 最相关的是 HfO2 数据 ( hfo2.extxyz 和 POSCAR ),因为该权重就是在 HfO2 体系上训练的。

数据是不是太少了
image
image
https://sevennet.readthedocs.io/en/latest/user_guide/pretrained.html

@leeleolay

Copy link
Copy Markdown
Collaborator

预训练模型权重辛苦提供下,相关数据辛苦提供下,我会提供url以便支持自动训练推理的功能

预训练模型权重辛苦提供下,相关数据辛苦提供下,我会提供url以便支持自动训练推理的功能

由于数据太大,无法上传,请到网盘下载:通过网盘分享的文件:SevenNet data 链接: https://pan.baidu.com/s/16-bjDqWTFPepdDg4QLVAAg?pwd=krg6 提取码: krg6

其中与预训练权重 sevennet_hfo2_best.pdparams 最相关的是 HfO2 数据 ( hfo2.extxyz 和 POSCAR ),因为该权重就是在 HfO2 体系上训练的。

我先不上传这部分数据了,当前提交代码格式问题较大,且需要整理数据格式等问题,代码完善的差不多我再传吧

@paddle-bot

paddle-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown

Thanks for your contribution!

@paddle-bot paddle-bot Bot added the contributor External developers label Jul 13, 2026
@leeleolay

Copy link
Copy Markdown
Collaborator

存在冲突

@leeleolay

Copy link
Copy Markdown
Collaborator

@zyy-123-zyy 辛苦继续修改

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

Labels

contributor External developers MIIT Program

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants