deepmd-finetune-dpa3
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "deepmd-finetune-dpa3":https://skillpi.com/zh/skills/deepskill-bd879e6065d94de88793012690e0bd411d6de4ffbe6ff2255de3878a64e697c3。安装前核对上游来源和版本:https://github.com/jinzhezenggroup/computational-chemistry-agent-skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
使用 DeePMD-kit 的 PyTorch 后端对 DPA3 模型进行微调,适用于将预训练的 DPA3 模型适配到新的下游数据集。支持从自训练的 DPA3 (.pt 检查点)、多任务预训练模型或通过 `dp pretrained download` 获取的内置预训练模型(例如 DPA-3.1-3M、DPA-3.2-5M、DPA-3.3-1M)进行微调,涵盖单任务和多任务微调工作流。
介绍来源: third_party · jinzhezenggroup · 1.0 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 输入和输出
- 翻译待完成,请参阅来源文档。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: deepmd-finetune-dpa3
description: Fine-tune a DPA3 model in DeePMD-kit using the PyTorch backend. Use when the user wants to adapt a pre-trained DPA3 model to a new downstream dataset. Supports fine-tuning from a self-trained DPA3 model (.pt checkpoint), from a multi-task pre-trained model, or from a built-in pretrained model downloaded via `dp pretrained download` (e.g., DPA-3.1-3M, DPA-3.2-5M, DPA-3.3-1M). Covers single-task and multi-task fine-tuning workflows.
compatibility: Requires deepmd-kit with PyTorch backend installed. GPU strongly recommended.
license: LGPL-3.0-or-later
metadata:
author: iProzd
version: '1.0'
repository: https://github.com/deepmodeling/deepmd-kitDeePMD-kit Fine-tuning: DPA3
Fine-tune a pre-trained DPA3 model on a downstream dataset. This skill covers three scenarios:
- Fine-tuning from a self-trained single-task DPA3 model
- Fine-tuning from a multi-task pre-trained DPA3 model
- Fine-tuning from a built-in pretrained model (e.g., DPA-3.1-3M, DPA-3.2-5M, DPA-3.3-1M) downloaded via
dp pretrained download
Quick Start
# Fine-tune from a self-trained model
dp --pt train input.json --finetune pretrained.pt --use-pretrain-script
# Fine-tune from a built-in pretrained model
dp pretrained download DPA-3.2-5M
dp --pt train input.json --finetune /path/to/DPA-3.2-5M.pt --use-pretrain-script --model-branch OMat24
Agent Responsibilities
- Determine the fine-tuning scenario:
- Does the user have a self-trained
.ptmodel? - Does the user want to use a built-in pretrained model (DPA-3.1-3M, DPA-3.2-5M, DPA-3.3-1M, etc.)?
- Is the pre-trained model single-task or multi-task?
- Does the user have a self-trained
- If using a built-in pretrained model, download it first with
dp pretrained download. - Collect the downstream training data paths and element types.
- Generate the fine-tuning
input.json. - Run fine-tuning and monitor the learning curve.
- Freeze and test the fine-tuned model.
Scenario 1: Fine-tune from a Self-trained Single-task Model
When you have trained a DPA3 model yourself and want to adapt it to new data.
Step 1: Prepare input.json
When using --use-pretrain-script, the model architecture is inherited from the pre-trained model. You only need to specify type_map, data paths, and training parameters:
{
"model": {
"type_map": [
"O",
"H"
],
"descriptor": {},
"fitting_net": {}
},
"learning_rate": {
"type": "exp",
"decay_steps": 5000,
"start_lr": 0.0001,
"stop_lr": 3e-06
},
"loss": {
"type": "ener",
"start_pref_e": 0.2,
"limit_pref_e": 20,
"start_pref_f": 100,
"limit_pref_f": 60,
"start_pref_v": 0.02,
"limit_pref_v": 1
},
"optimizer": {
"type": "AdamW",
"weight_decay": 0.001
},
"training": {
"training_data": {
"systems": [
"./downstream_data/train_0",
"./downstream_data/train_1"
],
"batch_size": 1
},
"validation_data": {
"systems": [
"./downstream_data/valid_0"
],
"batch_size": 1
},
"numb_steps": 200000,
"gradient_max_norm": 5.0,
"seed": 10,
"disp_file": "lcurve.out",
"disp_freq": 100,
"save_freq": 2000
}
}
Fine-tuning tips:
- Use a smaller
start_lr(e.g., 1e-4) than training from scratch (1e-3). - Use fewer
numb_stepssince the model is already pre-trained. - The elements in the downstream data must be a subset of the pre-trained model's
type_map.
Step 2: Run Fine-tuning
dp --pt train input.json --finetune pretrained.pt --use-pretrain-script
The --use-pretrain-script flag tells DeePMD-kit to inherit the model architecture from the pre-trained model, so the descriptor and fitting_net sections in input.json can be empty.
Without --use-pretrain-script, the model section in input.json must exactly match the pre-trained model's architecture.
Scenario 2: Fine-tune from a Multi-task Pre-trained Model
When the pre-trained model was trained with multiple datasets (multi-task training), you can select a specific branch to fine-tune from.
Check Available Branches
dp --pt show multitask_pretrained.pt model-branch
Run Fine-tuning from a Specific Branch
dp --pt train input.json --finetune multitask_pretrained.pt --model-branch CHOSEN_BRANCH --use-pretrain-script
If --model-branch is not set or set to RANDOM, a randomly initialized fitting net will be used.
Multi-task Fine-tuning (Prevent Forgetting)
To retain knowledge from the pre-trained datasets during fine-tuning, use multi-task fine-tuning. Prepare a multi-task input script:
{
"model": {
"shared_dict": {
"type_map_all": [
"O",
"H",
"C",
"N"
],
"dpa3_desc": {
"type": "dpa3",
"repflow": {}
}
},
"model_dict": {
"pre_data_1": {
"type_map": "type_map_all",
"descriptor": "dpa3_desc",
"fitting_net": {}
},
"pre_data_2": {
"type_map": "type_map_all",
"descriptor": "dpa3_desc",
"fitting_net": {}
},
"downstream": {
"finetune_head": "pre_data_1",
"type_map": "type_map_all",
"descriptor": "dpa3_desc",
"fitting_net": {}
}
}
},
"learning_rate": {
"type": "exp",
"decay_steps": 5000,
"start_lr": 0.0001,
"stop_lr": 3e-06
},
"loss_dict": {
"pre_data_1": {
"type": "ener",
"start_pref_e": 0.2,
"limit_pref_e": 20,
"start_pref_f": 100,
"limit_pref_f": 60
},
"pre_data_2": {
"type": "ener",
"start_pref_e": 0.2,
"limit_pref_e": 20,
"start_pref_f": 100,
"limit_pref_f": 60
},
"downstream": {
"type": "ener",
"start_pref_e": 0.2,
"limit_pref_e": 20,
"start_pref_f": 100,
"limit_pref_f": 60
}
},
"training": {
"model_prob": {
"pre_data_1": 0.3,
"pre_data_2": 0.3,
"downstream": 1.0
},
"data_dict": {
"pre_data_1": {
"training_data": {
"systems": [
"./pre_data_1/train"
],
"batch_size": 1
}
},
"pre_data_2": {
"training_data": {
"systems": [
"./pre_data_2/train"
],
"batch_size": 1
}
},
"downstream": {
"training_data": {
"systems": [
"./downstream/train"
],
"batch_size": 1
},
"validation_data": {
"systems": [
"./downstream/valid"
],
"batch_size": 1
}
}
},
"numb_steps": 200000,
"gradient_max_norm": 5.0,
"disp_file": "lcurve.out",
"disp_freq": 100,
"save_freq": 2000
}
}
Key points:
"finetune_head": "pre_data_1"specifies which branch the downstream task fine-tunes from.model_probcontrols the sampling probability for each dataset.- Pre-trained branches continue training in
init-modelmode; the downstream branch fine-tunes from the selected head.
Run:
dp --pt train multi_input.json --finetune multitask_pretrained.pt
Freeze a specific branch:
dp --pt freeze -o model_downstream.pth --head downstream
Scenario 3: Fine-tune from Built-in Pretrained Models
DeePMD-kit provides built-in pretrained models that can be downloaded directly.
Step 1: Check Available Models
dp pretrained download -h
Currently available models include:
DPA-3.3-1M— 1M parameter DPA3 pretrained modelDPA-3.2-5M— latest large-scale pretrained modelDPA-3.1-3M— 3M parameter DPA3 pretrained modelDPA3-Omol-Large— large organic molecule model
Step 2: Download the Model
# Download to default cache directory
dp pretrained download DPA-3.1-3M
# Download to a custom directory
dp pretrained download DPA-3.1-3M --cache-dir ./models
The command prints the local path of the downloaded model file on success.
Step 3: Check Model Branches (if multi-task)
dp --pt show /path/to/DPA-3.1-3M.pt model-branch
Step 4: Prepare input.json and Run Fine-tuning
The input.json is the same as Scenario 1. Use --use-pretrain-script to inherit the model architecture:
{
"model": {
"type_map": [
"O",
"H"
],
"descriptor": {},
"fitting_net": {}
},
"learning_rate": {
"type": "exp",
"decay_steps": 5000,
"start_lr": 0.0001,
"stop_lr": 3e-06
},
"loss": {
"type": "ener",
"start_pref_e": 0.2,
"limit_pref_e": 20,
"start_pref_f": 100,
"limit_pref_f": 60,
"start_pref_v": 0.02,
"limit_pref_v": 1
},
"optimizer": {
"type": "AdamW",
"weight_decay": 0.001
},
"training": {
"training_data": {
"systems": [
"./my_data/train_0",
"./my_data/train_1"
],
"batch_size": 1
},
"validation_data": {
"systems": [
"./my_data/valid_0"
],
"batch_size": 1
},
"numb_steps": 200000,
"gradient_max_norm": 5.0,
"seed": 10,
"disp_file": "lcurve.out",
"disp_freq": 100,
"save_freq": 2000
}
}
The meaning of each parameter can be generated through dp doc-train-input.
Considering the output RST documentation on the screen is very long, use grep to find the documentation of a specific parameter:
dp doc-train-input | grep -A 7 training/numb_steps
Run fine-tuning:
# Single-task fine-tuning from a specific branch
dp --pt train input.json --finetune /path/to/DPA-3.1-3M.pt --model-branch CHOSEN_BRANCH --use-pretrain-script
# If the pretrained model is single-task, --model-branch is not needed
dp --pt train input.json --finetune /path/to/DPA3-Omol-Large.pt --use-pretrain-script
Step 5: Freeze and Test
dp --pt freeze -o finetuned_model.pth
dp --pt test -m finetuned_model.pth -s /path/to/test_system -n 30
Fine-tuning Command Reference
| Command | Description |
|---|---|
dp pretrained download <MODEL> |
Download a built-in pretrained model |
dp pretrained download <MODEL> --cache-dir <PATH> |
Download to a custom directory |
dp --pt train input.json --finetune <MODEL>.pt |
Fine-tune from a pre-trained model |
dp --pt train input.json --finetune <MODEL>.pt --use-pretrain-script |
Inherit model architecture from pre-trained model |
dp --pt train input.json --finetune <MODEL>.pt --model-branch <BRANCH> |
Fine-tune from a specific branch |
dp --pt train input.json --finetune <MODEL>.pt --model-branch RANDOM |
Fine-tune with random fitting net |
dp --pt show <MODEL>.pt model-branch |
List available branches in a multi-task model |
dp --pt freeze -o model.pth |
Freeze the fine-tuned model |
dp --pt freeze -o model.pth --head <BRANCH> |
Freeze a specific branch (multi-task) |
Agent Checklist
- [ ] Pre-trained model file exists (downloaded or self-trained)
- [ ] Downstream data elements are a subset of the pre-trained model's
type_map - [ ]
--use-pretrain-scriptis used if model architecture is unknown - [ ] Learning rate is reduced compared to training from scratch (e.g., 1e-4 vs 1e-3)
- [ ] For multi-task pretrained models, the correct
--model-branchis selected - [ ] Training completes without NaN in
lcurve.out - [ ] Fine-tuned model is frozen and tested
- [ ] Test RMSE values are reported to the user
References
当前收录版本
1.0
安全与评测信息
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 面向计算化学/材料科学专业用户,解决 DPA3 模型迁移学习的核心需求
- 支持三种主流微调场景:自训练模型、多任务预训练模型、内置预训练模型
- 提供完整的工作流指导,从数据准备到模型测试
亮点
- 触发描述完整覆盖多种使用场景和模型类型
- 边界清晰,无歧义或重叠风险
- 明确指定了 DeePMD-kit PyTorch 后端的技术栈
亮点
- 文档结构清晰,分场景组织内容
- 提供详细的 JSON 配置示例和命令行示例
- 包含完整的 Agent 检查清单确保执行质量
亮点
- 工具来源明确,基于 DeePMD-kit 官方工具链
- 关键参数配置详细,包含学习率、损失函数等
- 覆盖多任务分支选择、模型架构继承等重要异常场景
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
文档引用的域名或地址
这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。
- docs.deepmodeling.com
- github.com
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。