| name | deepmd-finetune-dpa4 | ||||||
|---|---|---|---|---|---|---|---|
| description | Fine-tune a DPA4 model in DeePMD-kit. Use for standard or LoRA fine-tuning from a DPA4/SeZM .pt checkpoint, validation and .pt2 export. | ||||||
| compatibility | Requires deepmd-kit with the PyTorch backend. DPA4/SeZM training is GPU-oriented. | ||||||
| license | LGPL-3.0-or-later | ||||||
| metadata |
|
Fine-tune a DPA4/SeZM checkpoint on downstream DeePMD data. This skill covers
single-task standard and LoRA fine-tuning. Do not infer the model family from a
.pt suffix or filename: DPA3 and DPA4 checkpoints use the same suffix.
If the user has not already established the model family, inspect the stored configuration:
dp --pt show pretrained.pt descriptor fitting-net type-mapUse this skill only when the descriptor/model configuration identifies DPA4 or SeZM. If the checkpoint is multi-task, inspect its branches before selecting a head:
dp --pt show pretrained.pt model-branch descriptor type-mapDo not guess a branch. Use deepmd-finetune-dpa3 instead when the descriptor is
DPA3, and stop when the family cannot be established.
- Confirm the checkpoint exists and can be inspected.
- Confirm training and validation systems, labels, and element type maps.
- Keep a held-out test set that is not used for training or model selection.
- Start from the exact checkpoint architecture. Introducing new element types, changing architecture, or combining specialized spin/property/multi-task configurations requires separate compatibility validation.
- Choose standard fine-tuning or LoRA. Do not assume a built-in DPA4 model name;
check
dp pretrained download -hfor the installed version.
The model section in input.json must match the checkpoint unless the standard
pretrained-script mechanism is deliberately used:
dp --pt train input.json --finetune pretrained.ptIf the architecture is unknown, --use-pretrain-script can inherit the stored
model configuration except for type_map:
dp --pt train input.json --finetune pretrained.pt --use-pretrain-scriptInspect the resulting configuration and run a bounded initial segment before a
long training job. Do not combine model-specific additions with
--use-pretrain-script unless that combination has been validated.
DPA4/SeZM supports LoRA adapters for single-task fine-tuning. Copy the exact base
architecture into lora_ft.json, then add:
{
"model": {
"type": "dpa4",
"lora": {
"rank": 16,
"alpha": 16.0
}
}
}Run:
dp --pt train lora_ft.json --finetune pretrained.ptThe JSON fragment above is not a complete training input. Adapt the full public
example at examples/water/dpa4/lora_ft.json. Do not add
--use-pretrain-script to this LoRA command unless a targeted test confirms that
the intended LoRA configuration is retained.
Monitor lcurve.out for non-finite values and train/validation divergence.
Select a checkpoint using validation data, then evaluate the selected checkpoint
on the complete held-out test systems. Report energy and force errors, plus
virial errors when those labels are part of the task.
DPA4/SeZM uses the .pt2 AOTInductor export path rather than the conventional
PyTorch .pth freeze path:
dp --pt freeze -c ckpt/model.ckpt.pt -o finetuned_model
dp test -m finetuned_model.pt2 -s /path/to/test_system -n 30The freeze command detects DPA4/SeZM and writes finetuned_model.pt2. Validate
the exported archive in the target environment before deployment.
- The stored descriptor identifies DPA4/SeZM; the
.ptsuffix was not used as proof. - The intended branch is explicit for a multi-task checkpoint.
- Training, validation, and held-out test systems are separate.
- The input architecture is compatible with the checkpoint.
- LoRA uses a complete base configuration and is not silently overwritten.
- Training and held-out metrics are finite and reported with units.
- The selected
.ptcheckpoint was exported to and tested as.pt2.