{hardware NPU} 运行硬件:华为昇腾 NPU (910B/910C)
AIMNet2 是一个分子神经网络势 (NNP),在 B97-3c 理论水平上训练,用于快速、准确地做分子模拟单点能量与受力预测。本仓库将
isayevlab/aimnet2-2025 (Hugging Face)aimnet2-2025 权重适配到华为昇腾 NPU,实现 torch_npu 直接加载推理(无需 vLLM-Ascend;模型为 AI-for-Science 回归模型,非 LLM)。
ensemble_0..3.safetensors),默认加载成员 0,支持平均不确定度| 项目 | 说明 |
|---|---|
| 迁移方式 | torch_npu 直接加载推理(非 LLM,不用 vLLM-Ascend) |
| 依赖剥离 | vendored 自包含包 aimnet/,剥离 warp-lang / nvalchemiops(纯 CUDA)等重依赖 |
| 算子兼容 | 全部算子为纯 PyTorch eager 执行;ConvSV 走 einsum 回退(CUDA conv_sv_2d_sp 核被移除) |
| 长程项 | D3-BJ 色散 / Ewald·DSF 长程库仑为外部校正(needs_*),不由 NN forward 计算,未 vendor |
| 精度验证 | CPU↔NPU 余弦相似度 ≥ 0.999999,Energy/Charges/Forces 全部通过 |
aimnet2-2025/
├── inference.py # NPU 推理脚本(单点能量/受力/精度对比)
├── README.md # 本文档
├── requirements.txt # 环境依赖
├── aimnet/ # vendored 自包含包(剥离 CUDA 重依赖)
└── assets/ # 截图素材目录pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/拉取权重到 --model-dir(含 config.json + ensemble_*.safetensors)。可用
huggingface_hub/hf-mirror:
export HF_ENDPOINT=https://hf-mirror.com
# 或 gitcode 镜像: git clone https://gitcode.com/hf_mirrors/aimnaylab/aimnet2-2025.gitpython inference.py --model-dir models/aimnet2-2025 --device npu:0 --system water预期输出(水分子):
[energy ] -2077.703369 eV
[charges ] [[-0.30635890, 0.15317946, 0.15317946]]
[force ] ...
[latency ] forward=4.29 ms forces=36.56 mspython inference.py --model-dir models/aimnet2-2025 --device npu:0 --system water --compare-cpu===== CPU vs NPU 精度对比 =====
energy cos=1.00000000 maxabs=7.568e-03
charges cos=1.00000000 maxabs=2.731e-04
force cos=0.99999833 maxabs=3.111e-03(block:NPU 首次 generate/warm-up 有偏差,脚本内已做预热)
| 参数 | 默认值 | 说明 |
|---|---|---|
--model-dir | (必填) | 权重目录 |
--device | npu:0 | 推理设备 |
--system | water | 测试分子 (water/methane/ethanethiol) |
--ensemble | off | 平均全部 4 个 ensemble 成员 |
--member | 0 | 指定单个成员 |
--no-forces | off | 关闭受力计算 |
--compare-cpu | off | 对比 CPU 精度 |
| 组件 | 版本 |
|---|---|
| torch | 2.9.0+cpu |
| torch_npu | 2.9.0.post1 |
| CANN | 8.5.1 |
| 昇腾硬件 | 910B/910C (NPU ×2) |
@article{anstine2024aimnet2,
title={AIMNet2: A Neural Network Potential to Meet your Neutral, Charged, Organic, and Elemental-Organic Needs},
author={Anstine, Dylan and Zubatyuk, Roman and Isayev, Olexandr},
journal={Chemical Science},
year={2024}
}Apache License 2.0