Skip to content

Commit c5eddb2

Browse files
authored
Merge pull request #12 from zhaiwenxi/docs/update-dpa-adapt-example
Docs/update dpa adapt example
2 parents 8d35b91 + 3e96f10 commit c5eddb2

330 files changed

Lines changed: 5150 additions & 2368 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/property_tools_tests.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ name: DeePMD Property Tools Tests
33
on:
44
push:
55
paths:
6-
- "deepmd/dpa_tools/**"
7-
- "source/tests/dpa_tools/**"
6+
- "deepmd/dpa_adapt/**"
7+
- "source/tests/dpa_adapt/**"
88
- ".github/workflows/property_tools_tests.yml"
99
pull_request:
1010
paths:
11-
- "deepmd/dpa_tools/**"
12-
- "source/tests/dpa_tools/**"
11+
- "deepmd/dpa_adapt/**"
12+
- "source/tests/dpa_adapt/**"
1313
- ".github/workflows/property_tools_tests.yml"
1414

1515
jobs:
@@ -36,4 +36,4 @@ jobs:
3636
3737
- name: Run unit tests
3838
run: |
39-
python -m pytest source/tests/dpa_tools/ -v --ignore=source/tests/dpa_tools/test_trainer_dim_case_embd.py
39+
python -m pytest source/tests/dpa_adapt/ -v --ignore=source/tests/dpa_adapt/test_trainer_dim_case_embd.py

README.md

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ For more information, check the [documentation](https://deepmd.readthedocs.io/).
2424
- **implements the Deep Potential series models**, which have been successfully applied to finite and extended systems, including organic molecules, metals, semiconductors, insulators, etc.
2525
- **implements MPI and GPU supports**, making it highly efficient for high-performance parallel and distributed computing.
2626
- **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+
- **fine-tunes pre-trained DPA models through a scikit-learn-style Python API**, via [`dpa_adapt`](dpa_adapt/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.
2828

2929
### License and credits
3030

@@ -98,27 +98,13 @@ Then, read on for a brief overview of the usage of DeePMD-kit. You may start wit
9898
dp
9999
```
100100

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-
preds = model.predict("data/new_structures").predictions # 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-
115101
## Code structure
116102

117103
The code is organized as follows:
118104

119105
- `examples`: examples.
120106
- `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)).
107+
- `dpa_adapt`: scikit-learn-style package for fine-tuning pre-trained DPA models.
122108
- `source/lib`: source code of the core library.
123109
- `source/op`: Operator (OP) implementation.
124110
- `source/api_cc`: source code of DeePMD-kit C++ API.

backend/find_pytorch.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ def get_pt_requirement(pt_version: str = "") -> dict:
137137
# https://github.com/pytorch/pytorch/commit/7e0c26d4d80d6602aed95cb680dfc09c9ce533bc
138138
else "torch>=2.1.0",
139139
"e3nn>=0.5.9",
140+
# O(N) cell-list neighbor list for fast Python/ASE inference; the
141+
# torch bindings (vesin-torch) ship only as a PyPI extra, so keep it
142+
# under the torch extra rather than the core deps (conda-forge has
143+
# vesin but not vesin-torch).
144+
"vesin[torch]",
140145
*mpi_requirement,
141146
*cibw_requirement,
142147
],

deepmd/__about__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# SPDX-License-Identifier: LGPL-3.0-or-later
2+
__version__ = "0.0.0"

deepmd/dpa_tools/README.md

Lines changed: 0 additions & 198 deletions
This file was deleted.

deepmd/dpa_tools/__init__.py

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)