Skip to content

Commit 849f6ea

Browse files
Merge branch 'develop' into clean_code
2 parents 3ef8011 + bf17f68 commit 849f6ea

File tree

156 files changed

+10259
-724
lines changed

Some content is hidden

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

156 files changed

+10259
-724
lines changed

.github/workflows/publish.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Publish Python package
2+
3+
on:
4+
push:
5+
branches:
6+
- develop # Trigger the workflow on push events to the develop branch
7+
8+
jobs:
9+
build-and-publish:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
python-version: ['3.8', '3.9', '3.10'] # List of Python versions
14+
steps:
15+
- uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install setuptools wheel twine build
28+
29+
- name: Build package
30+
run: |
31+
python -m build
32+
33+
- name: Publish package
34+
env:
35+
TWINE_USERNAME: __token__
36+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
37+
run: |
38+
twine upload dist/*

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ PaddleScience 是一个基于深度学习框架 PaddlePaddle 开发的科学计
2727

2828
| 问题类型 | 案例名称 | 优化算法 | 模型类型 | 训练方式 | 数据集 | 参考资料 |
2929
|-----|---------|-----|---------|----|---------|---------|
30+
| 相场方程 | [Allen-Cahn](https://paddlescience-docs.readthedocs.io/zh/latest/zh/examples/allen_cahn) | 机理驱动 | MLP | 无监督学习 | [Data](https://paddle-org.bj.bcebos.com/paddlescience/datasets/AllenCahn/allen_cahn.mat) | [Paper](https://arxiv.org/pdf/2402.00326) |
3031
| 微分方程 | [拉普拉斯方程](https://paddlescience-docs.readthedocs.io/zh/latest/zh/examples/laplace2d) | 机理驱动 | MLP | 无监督学习 | - | - |
3132
| 微分方程 | [伯格斯方程](https://paddlescience-docs.readthedocs.io/zh/latest/zh/examples/deephpms) | 机理驱动 | MLP | 无监督学习 | [Data](https://github.com/maziarraissi/DeepHPMs/tree/master/Data) | [Paper](https://arxiv.org/pdf/1801.06637.pdf) |
3233
| 微分方程 | [非线性偏微分方程](https://paddlescience-docs.readthedocs.io/zh/latest/zh/examples/pirbn) | 机理驱动 | PIRBN | 无监督学习 | - | [Paper](https://arxiv.org/abs/2304.06234) |
@@ -38,7 +39,7 @@ PaddleScience 是一个基于深度学习框架 PaddlePaddle 开发的科学计
3839
| 微分方程 | [分数阶微分方程](https://github.com/PaddlePaddle/PaddleScience/blob/develop/examples/fpde/fractional_poisson_2d.py) | 机理驱动 | MLP | 无监督学习 | - | - |
3940
| 光孤子 | [Optical soliton](https://paddlescience-docs.readthedocs.io/zh/latest/zh/examples/nlsmb) | 机理驱动 | MLP | 无监督学习 | - | [Paper](https://doi.org/10.1007/s11071-023-08824-w)|
4041
| 光纤怪波 | [Optical rogue wave](https://paddlescience-docs.readthedocs.io/zh/latest/zh/examples/nlsmb) | 机理驱动 | MLP | 无监督学习 | - | [Paper](https://doi.org/10.1007/s11071-023-08824-w)|
41-
| 相场方程 | [Allen-Cahn](https://paddlescience-docs.readthedocs.io/zh/latest/zh/examples/allen_cahn) | 机理驱动 | MLP | 无监督学习 | - | |
42+
| 域分解 | [XPINN](https://paddlescience-docs.readthedocs.io/zh/latest/zh/examples/xpinns) | 机理驱动 | MLP | 无监督学习 | - | [Paper](https://doi.org/10.4208/cicp.OA-2020-0164)|
4243

4344
<br>
4445
<p align="center"><b>技术科学(AI for Technology)</b></p>
@@ -100,6 +101,7 @@ PaddleScience 是一个基于深度学习框架 PaddlePaddle 开发的科学计
100101
<!-- --8<-- [start:update] -->
101102
## 🕘最近更新
102103

104+
- 添加 PirateNet(基于 Allen-cahn 方程求解) [Allen-Cahn](https://paddlescience-docs.readthedocs.io/zh/latest/zh/examples/allen_cahn/)
103105
- 添加多目标优化算法 [Relobralo](https://paddlescience-docs.readthedocs.io/zh/latest/zh/api/loss/mtl/#ppsci.loss.mtl.Relobralo)
104106
- 添加气泡流求解案例([Bubble](https://paddlescience-docs.readthedocs.io/zh/latest/zh/examples/bubble))、机翼优化案例([DeepCFD](https://paddlescience-docs.readthedocs.io/zh/latest/zh/examples/deepcfd/))、热传导仿真案例([HeatPINN](https://paddlescience-docs.readthedocs.io/zh/latest/zh/examples/heat_pinn))、非线性短临预报模型([Nowcasting(仅推理)](https://paddlescience-docs.readthedocs.io/zh/latest/zh/examples/nowcastnet))、拓扑优化案例([TopOpt](https://paddlescience-docs.readthedocs.io/zh/latest/zh/examples/topopt))、矩形平板线弹性方程求解案例([Biharmonic2D](https://paddlescience-docs.readthedocs.io/zh/latest/zh/examples/biharmonic2d))。
105107
- 添加二维血管案例([LabelFree-DNN-Surrogate](https://paddlescience-docs.readthedocs.io/zh/latest/zh/examples/labelfree_DNN_surrogate/#4))、空气激波案例([ShockWave](https://paddlescience-docs.readthedocs.io/zh/latest/zh/examples/shock_wave/))、去噪网络模型([DUCNN](https://github.com/PaddlePaddle/PaddleScience/tree/develop/jointContribution/DU_CNN))、风电预测模型([Deep Spatial Temporal](https://github.com/PaddlePaddle/PaddleScience/tree/develop/jointContribution/Deep-Spatio-Temporal))、域分解模型([XPINNs](https://github.com/PaddlePaddle/PaddleScience/tree/develop/jointContribution/XPINNs))、积分方程求解案例([Volterra Equation](https://paddlescience-docs.readthedocs.io/zh/latest/zh/examples/volterra_ide))、分数阶方程求解案例([Fractional Poisson 2D](https://github.com/PaddlePaddle/PaddleScience/blob/develop/examples/fpde/fractional_poisson_2d.py))。

deploy/python_infer/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,13 @@
1515
from deploy.python_infer.base import Predictor
1616
from deploy.python_infer.pinn_predictor import PINNPredictor
1717

18+
1819
# alias as PINNPredictor can be used in most cases
19-
GeneralPredictor = PINNPredictor
20+
class GeneralPredictor(PINNPredictor):
21+
"""Use PINNPredictor as GeneralPredictor."""
22+
23+
pass
24+
2025

2126
__all__ = [
2227
"Predictor",

deploy/python_infer/pinn_predictor.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,57 @@ class PINNPredictor(base.Predictor):
3030
3131
Args:
3232
cfg (DictConfig): Running configuration.
33+
34+
Examples:
35+
>>> import numpy as np
36+
>>> import paddle
37+
>>> from omegaconf import DictConfig
38+
>>> from paddle.static import InputSpec
39+
>>> import ppsci
40+
>>> from deploy.python_infer import pinn_predictor
41+
>>> model = ppsci.arch.MLP(("x", "y"), ("u", "v", "p"), 3, 16)
42+
>>> static_model = paddle.jit.to_static(
43+
... model,
44+
... input_spec=[
45+
... {
46+
... key: InputSpec([None, 1], "float32", name=key)
47+
... for key in model.input_keys
48+
... },
49+
... ],
50+
... )
51+
>>> paddle.jit.save(static_model, "./inference")
52+
>>> cfg = DictConfig(
53+
... {
54+
... "log_freq": 10,
55+
... "INFER": {
56+
... "pdmodel_path": "./inference.pdmodel",
57+
... "pdiparams_path": "./inference.pdiparams",
58+
... "device": "cpu",
59+
... "engine": "native",
60+
... "precision": "fp32",
61+
... "onnx_path": None,
62+
... "ir_optim": True,
63+
... "min_subgraph_size": 15,
64+
... "gpu_mem": 500,
65+
... "gpu_id": 0,
66+
... "max_batch_size": 10,
67+
... "num_cpu_threads": 10,
68+
... }
69+
... }
70+
... )
71+
>>> predictor = pinn_predictor.PINNPredictor(cfg) # doctest: +SKIP
72+
>>> pred = predictor.predict(
73+
... {
74+
... "x": np.random.randn(4, 1).astype("float32"),
75+
... "y": np.random.randn(4, 1).astype("float32"),
76+
... },
77+
... batch_size=2,
78+
... ) # doctest: +SKIP
79+
>>> for k, v in pred.items(): # doctest: +SKIP
80+
... print(k, v.shape) # doctest: +SKIP
81+
save_infer_model/scale_0.tmp_0 (4, 1)
82+
save_infer_model/scale_1.tmp_0 (4, 1)
83+
save_infer_model/scale_2.tmp_0 (4, 1)
3384
"""
3485

3586
def __init__(

docs/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272

7373
| 问题类型 | 案例名称 | 优化算法 | 模型类型 | 训练方式 | 数据集 | 参考资料 |
7474
|-----|---------|-----|---------|----|---------|---------|
75+
| 相场方程 | [Allen-Cahn](./zh/examples/allen_cahn.md) | 机理驱动 | MLP | 无监督学习 | [Data](https://paddle-org.bj.bcebos.com/paddlescience/datasets/AllenCahn/allen_cahn.mat) | [Paper](https://arxiv.org/pdf/2402.00326) |
7576
| 微分方程 | [拉普拉斯方程](./zh/examples/laplace2d.md) | 机理驱动 | MLP | 无监督学习 | - | - |
7677
| 微分方程 | [伯格斯方程](./zh/examples/deephpms.md) | 机理驱动 | MLP | 无监督学习 | [Data](https://github.com/maziarraissi/DeepHPMs/tree/master/Data) | [Paper](https://arxiv.org/pdf/1801.06637.pdf) |
7778
| 微分方程 | [非线性偏微分方程](./zh/examples/pirbn.md) | 机理驱动 | PIRBN | 无监督学习 | - | [Paper](https://arxiv.org/abs/2304.06234) |
@@ -83,7 +84,7 @@
8384
| 微分方程 | [分数阶微分方程](https://github.com/PaddlePaddle/PaddleScience/blob/develop/examples/fpde/fractional_poisson_2d.py) | 机理驱动 | MLP | 无监督学习 | - | - |
8485
| 光孤子 | [Optical soliton](./zh/examples/nlsmb.md) | 机理驱动 | MLP | 无监督学习 | - | [Paper](https://doi.org/10.1007/s11071-023-08824-w)|
8586
| 光纤怪波 | [Optical rogue wave](./zh/examples/nlsmb.md) | 机理驱动 | MLP | 无监督学习 | - | [Paper](https://doi.org/10.1007/s11071-023-08824-w)|
86-
| 相场方程 | [Allen-Cahn](./zh/examples/allen_cahn.md) | 机理驱动 | MLP | 无监督学习 | - | |
87+
| 域分解 | [XPINN](./zh/examples/xpinns.md) | 机理驱动 | MLP | 无监督学习 | - | [Paper](https://doi.org/10.4208/cicp.OA-2020-0164)|
8788

8889
<br>
8990
<p align="center"><b>技术科学(AI for Technology)</b></p>

docs/zh/api/arch.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- AMGNet
99
- MLP
1010
- ModifiedMLP
11+
- PirateNet
1112
- DeepONet
1213
- DeepPhyLSTM
1314
- LorenzEmbedding
@@ -28,5 +29,10 @@
2829
- ChipDeepONets
2930
- AutoEncoder
3031
- CuboidTransformer
32+
- SFNONet
33+
- UNONet
34+
- TFNO1dNet
35+
- TFNO2dNet
36+
- TFNO3dNet
3137
show_root_heading: true
3238
heading_level: 3

docs/zh/api/data/dataset.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,6 @@
2525
- RadarDataset
2626
- build_dataset
2727
- DGMRDataset
28+
- DarcyFlowDataset
29+
- SphericalSWEDataset
2830
show_root_heading: true

docs/zh/api/equation.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
options:
66
members:
77
- PDE
8-
- FractionalPoisson
8+
- AllenCahn
99
- Biharmonic
10+
- FractionalPoisson
1011
- HeatExchanger
1112
- Laplace
1213
- LinearElasticity

0 commit comments

Comments
 (0)