Skip to content

Commit

Permalink
pd: update paddle doc (#4489)
Browse files Browse the repository at this point in the history
Add paddle icon svg and update related docs

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
	- Added Paddle as a supported deep learning backend for DeePMD-kit.
- Expanded documentation to include Paddle installation, training, and
model support.
- Updated documentation for various model descriptors and training
methods to include Paddle.

- **Documentation**
- Added Paddle-specific installation instructions for different
environments.
	- Updated README and backend documentation to reflect Paddle support.
- Expanded training, fine-tuning, and parallel training guides to
include Paddle.
- Introduced Paddle commands for model freezing and neighbor statistics.
- Enhanced documentation with Paddle icons and details for various
commands and configurations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: HydrogenSulfate <[email protected]>
Co-authored-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
HydrogenSulfate and njzjz authored Jan 14, 2025
1 parent 83049b2 commit 3e9cf88
Show file tree
Hide file tree
Showing 16 changed files with 270 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ For more information, check the [documentation](https://deepmd.readthedocs.io/).

### Highlighted features

- **interfaced with multiple backends**, including TensorFlow, PyTorch, and JAX, the most popular deep learning frameworks, making the training process highly automatic and efficient.
- **interfaced with multiple backends**, including TensorFlow, PyTorch, JAX, and Paddle, the most popular deep learning frameworks, making the training process highly automatic and efficient.
- **interfaced with high-performance classical MD and quantum (path-integral) MD packages**, including LAMMPS, i-PI, AMBER, CP2K, GROMACS, OpenMM, and ABACUS.
- **implements the Deep Potential series models**, which have been successfully applied to finite and extended systems, including organic molecules, metals, semiconductors, insulators, etc.
- **implements MPI and GPU supports**, making it highly efficient for high-performance parallel and distributed computing.
Expand Down
10 changes: 10 additions & 0 deletions doc/_static/paddle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 11 additions & 2 deletions doc/backend.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
DeePMD-kit supports multiple backends: TensorFlow and PyTorch.
To use DeePMD-kit, you must install at least one backend.
Each backend does not support all features.
In the documentation, TensorFlow {{ tensorflow_icon }} and PyTorch {{ pytorch_icon }} icons are used to mark whether a backend supports a feature.
In the documentation, TensorFlow {{ tensorflow_icon }}, PyTorch {{ pytorch_icon }}, and Paddle {{ paddle_icon }} icons are used to mark whether a backend supports a feature.

### TensorFlow {{ tensorflow_icon }}

Expand Down Expand Up @@ -35,6 +35,15 @@ Only the `.savedmodel` format supports C++ inference, which needs the TensorFlow
The model is device-specific, so that the model generated on the GPU device cannot be run on the CPUs.
Currently, this backend is developed actively, and has no support for training.

### Paddle {{ paddle_icon }}

- Model filename extensions: `.json` and `.pdiparams`
- Checkpoint filename extension: `.pd`

[Paddle](https://www.paddlepaddle.org.cn/) version 3.0 or above is required.

The `.pd` extension is used for model checkpoint storage, which is commonly utilized during training and testing in Python. The `.json` extension is for the model's computational graph in [PIR representation](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/paddle_v3_features/paddle_ir_cn.html), while the `.pdiparams` extension stores model parameters. Both `.json` and `.pdiparams` files are exported together and used in model freezing and Python/C++ inference.

### DP {{ dpmodel_icon }}

:::{note}
Expand All @@ -57,7 +66,7 @@ NumPy 1.21 or above is required.

### Training

When training and freezing a model, you can use `dp --tf` or `dp --pt` in the command line to switch the backend.
When training and freezing a model, you can use `dp --tf`, `dp --pt` or `dp --pd` in the command line to switch the backend.

### Inference

Expand Down
1 change: 1 addition & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
"tensorflow_icon": """![TensorFlow](/_static/tensorflow.svg){class=platform-icon}""",
"pytorch_icon": """![PyTorch](/_static/pytorch.svg){class=platform-icon}""",
"jax_icon": """![JAX](/_static/jax.svg){class=platform-icon}""",
"paddle_icon": """![Paddle](/_static/paddle.svg){class=platform-icon}""",
"dpmodel_icon": """![DP](/_static/logo_icon.svg){class=platform-icon}""",
}

Expand Down
23 changes: 23 additions & 0 deletions doc/freeze/freeze.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,26 @@ $ dp --pt freeze -o model_branch1.pth --head CHOSEN_BRANCH
```

The output model is called `model_branch1.pth`, which is the specifically frozen model with the `CHOSEN_BRANCH` head.

:::

:::{tab-item} Paddle {{ paddle_icon }}

```bash
$ dp --pd freeze -o model
```

in the folder where the model is trained. The output model is called `model.json` and `model.pdiparams`.

In [multi-task mode](../train/multi-task-training-pd.md), you need to choose one available heads (e.g. `CHOSEN_BRANCH`) by `--head`
to specify which model branch you want to freeze:

```bash
$ dp --pd freeze -o model_branch1 --head CHOSEN_BRANCH
```

The output model is called `model_branch1.json`, which is the specifically frozen model with the `CHOSEN_BRANCH` head.

:::

::::
35 changes: 35 additions & 0 deletions doc/install/easy-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,41 @@ Switch to the TensorFlow {{ tensorflow_icon }} tab for more information.

::::::

::::::{tab-item} Paddle {{ paddle_icon }}

:::::{tab-set}

::::{tab-item} CUDA 12.3

```bash
pip install paddlepaddle-gpu==3.0.0rc0 -i https://www.paddlepaddle.org.cn/packages/stable/cu123/
pip install deepmd-kit
```

::::

::::{tab-item} CUDA 11.8

```bash
pip install paddlepaddle-gpu==3.0.0rc0 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/
pip install deepmd-kit
```

::::

::::{tab-item} CPU

```bash
pip install paddlepaddle==3.0.0rc0 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/
pip install deepmd-kit
```

::::

:::::

::::::

:::::::

The supported platform includes Linux x86-64 and aarch64 with GNU C Library 2.28 or above, macOS x86-64 and arm64, and Windows x86-64.
Expand Down
Loading

0 comments on commit 3e9cf88

Please sign in to comment.