You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,7 @@ For more information, check the [documentation](https://deepmd.readthedocs.io/).
24
24
-**implements the Deep Potential series models**, which have been successfully applied to finite and extended systems, including organic molecules, metals, semiconductors, insulators, etc.
25
25
-**implements MPI and GPU supports**, making it highly efficient for high-performance parallel and distributed computing.
26
26
-**highly modularized**, easy to adapt to different descriptors for deep learning-based potential energy models.
27
+
-**fine-tunes pre-trained DPA models through a scikit-learn-style Python API**, via [`dpa_tools`](deepmd/dpa_tools/README.md) — construct a `DPAFineTuner`, then `fit` and `predict` to adapt a large pre-trained model to your own property dataset, with no input files to write.
27
28
28
29
### License and credits
29
30
@@ -97,12 +98,27 @@ Then, read on for a brief overview of the usage of DeePMD-kit. You may start wit
97
98
dp
98
99
```
99
100
101
+
## Fine-tune pre-trained DPA models with `dpa_tools`
102
+
103
+
`dpa_tools` is a scikit-learn-style **Python API for fine-tuning pre-trained DPA atomic models** on your own dataset: you construct a `DPAFineTuner`, call `fit(...)` then `predict(...)`, and pick a transfer-learning strategy — a frozen descriptor with a scikit-learn head, linear probing, full fine-tuning, or multi-task fine-tuning — without writing any DeePMD-kit JSON config or training pipeline. Use it to adapt a large pre-trained model to a downstream materials or molecular property (energy, band gap, HOMO–LUMO gap, …) from a modest labeled dataset. It ships with DeePMD-kit (`pip install deepmd-kit[dpa-tools]`); the full guide lives in [`deepmd/dpa_tools/README.md`](deepmd/dpa_tools/README.md).
104
+
105
+
```python
106
+
from deepmd.dpa_tools import DPAFineTuner
107
+
108
+
model = DPAFineTuner(pretrained="DPA-3.1-3M", strategy="frozen_sklearn", predictor="rf")
109
+
model.fit(train_data="data/train", target_key="bandgap") # fine-tune on your labeled structures
110
+
model.predict("data/new_structures") # predict for new structures
111
+
```
112
+
113
+
The same workflow is also available from the command line as `dp dpa fit` / `dp dpa predict`.
114
+
100
115
## Code structure
101
116
102
117
The code is organized as follows:
103
118
104
119
-`examples`: examples.
105
120
-`deepmd`: DeePMD-kit python modules.
121
+
-`deepmd/dpa_tools`: scikit-learn-style Python API for fine-tuning pre-trained DPA models ([README](deepmd/dpa_tools/README.md)).
106
122
-`source/lib`: source code of the core library.
107
123
-`source/op`: Operator (OP) implementation.
108
124
-`source/api_cc`: source code of DeePMD-kit C++ API.
|`mft`| Multi-task: property head + force-field head | Prevents representation collapse |
47
+
The strategy is the main choice you make. All four adapt the same pre-trained
48
+
DPA backbone; they differ in how much of it they train:
49
+
50
+
| Strategy | What it does | Best for |
51
+
|----------|--------------|----------|
52
+
|`frozen_sklearn` (default) | Freeze the backbone, extract descriptors once, fit a scikit-learn head (RF / Ridge / MLP) | Small data (<1k samples), CPU-only, fastest iteration |
53
+
|`linear_probe`| Freeze the backbone, train only a property fitting net | Medium data, GPU available |
54
+
|`finetune`| Fine-tune the full network | Larger data, GPU available |
55
+
|`mft`| Multi-task: property head + an auxiliary force-field head trained jointly | Prevents representation collapse on small property datasets |
70
56
71
57
```python
58
+
# frozen_sklearn (CPU, no dp train): extract once, fit a scikit-learn head
72
59
model = DPAFineTuner(
73
-
pretrained="DPA-3.1-3M", # built-in name → auto-downloaded; or use a local path
60
+
pretrained="DPA-3.1-3M", # built-in name → auto-downloaded; or a local path
0 commit comments