Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
1d250f0
update develop mkdocs
HydrogenSulfate Jun 19, 2024
cb28eab
Merge branch 'develop' of https://github.com/HydrogenSulfate/PaddleSc…
HydrogenSulfate Jun 19, 2024
8e38247
allow alias for mike
HydrogenSulfate Jun 19, 2024
167b789
Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleScien…
HydrogenSulfate Jun 19, 2024
5ebd9f9
Merge branch 'develop' of https://github.com/HydrogenSulfate/PaddleSc…
HydrogenSulfate Jun 21, 2024
64bcbb2
Merge branch 'develop' of https://github.com/HydrogenSulfate/PaddleSc…
HydrogenSulfate Jun 26, 2024
bbc8c7d
update CViT code(WIP)
HydrogenSulfate Jun 27, 2024
69cc836
update CViT code(WIP)
HydrogenSulfate Jun 27, 2024
d937251
update validate code
HydrogenSulfate Jun 27, 2024
b650942
Merge branch 'develop' into add_cvit
HydrogenSulfate Jun 28, 2024
e0d6de3
update code
HydrogenSulfate Jun 30, 2024
8702701
update code
HydrogenSulfate Jul 1, 2024
302be9d
refine code
HydrogenSulfate Jul 2, 2024
2f7f930
refine docs
HydrogenSulfate Jul 2, 2024
ff7a4b7
update docs
HydrogenSulfate Jul 2, 2024
dd6e443
update export&inference code
HydrogenSulfate Jul 2, 2024
ca3dc47
update ns cvit code(WIP, not aligned)
HydrogenSulfate Jul 5, 2024
5832187
Merge branch 'PaddlePaddle:develop' into add_cvit
HydrogenSulfate Jul 5, 2024
578f155
update reprod code
HydrogenSulfate Jul 6, 2024
740c81b
rename block name according to their class
HydrogenSulfate Jul 6, 2024
50346a2
add more config yamls
HydrogenSulfate Jul 6, 2024
ac75ff0
fix data/__init__
HydrogenSulfate Jul 6, 2024
538a2d9
fix
HydrogenSulfate Jul 6, 2024
e47f2cd
refine code and add more annotations
HydrogenSulfate Jul 6, 2024
e5abe77
update code
HydrogenSulfate Jul 7, 2024
eed7d20
update TRT steps
HydrogenSulfate Jul 7, 2024
a226fc2
change pos/time embedding from buffer to trainable parameters
HydrogenSulfate Jul 7, 2024
a57a01a
use interpolation for spatial_dims
HydrogenSulfate Jul 7, 2024
6c0f5b0
remove interpolation
HydrogenSulfate Jul 7, 2024
7a0274d
update config
HydrogenSulfate Jul 7, 2024
b1a6cc7
fix std of normal initializer
HydrogenSulfate Jul 7, 2024
1662dff
update outputfile
HydrogenSulfate Jul 8, 2024
bf40de8
add einops into req
HydrogenSulfate Jul 8, 2024
5934778
Merge branch 'develop' into add_cvit
HydrogenSulfate Jul 8, 2024
3891566
restore l2_rel
HydrogenSulfate Jul 8, 2024
cfdb3f3
refine eval checking and logging
HydrogenSulfate Jul 8, 2024
9d1f13e
update example code of FunctionalBatchTransform
HydrogenSulfate Jul 8, 2024
dc9a4eb
Merge branch 'develop' into add_cvit
HydrogenSulfate Jul 8, 2024
5a52d66
update pretrained url and plot code
HydrogenSulfate Jul 8, 2024
b8c83ba
add cvit doc
HydrogenSulfate Jul 9, 2024
49cd79f
update adv_cvit doc
HydrogenSulfate Jul 9, 2024
95d2366
rename title for adv_cvit.md
HydrogenSulfate Jul 9, 2024
beef8fc
update docs
HydrogenSulfate Jul 9, 2024
31a677e
update docs
HydrogenSulfate Jul 9, 2024
087808c
Merge branch 'develop' into add_cvit
HydrogenSulfate Jul 9, 2024
126b580
fix zh/examples/extformer_moe.md
HydrogenSulfate Jul 9, 2024
7a0c9f0
update docs
HydrogenSulfate Jul 9, 2024
2d5a6c2
refine code
HydrogenSulfate Jul 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ PaddleScience 是一个基于深度学习框架 PaddlePaddle 开发的科学计

| 问题类型 | 案例名称 | 优化算法 | 模型类型 | 训练方式 | 数据集 | 参考资料 |
|-----|---------|-----|---------|----|---------|---------|
| 定常不可压流体 | [2D 定常方腔流](https://paddlescience-docs.readthedocs.io/zh/latest/zh/examples/ldc2d_steady) | 机理驱动 | MLP | 无监督学习 | - | |
| 一维线性对流问题 | [1D 线性对流](https://paddlescience-docs.readthedocs.io/zh/examples/adv_cvit.md) | 数据驱动 | ViT | 监督学习 | [Data](https://github.com/Zhengyu-Huang/Operator-Learning/tree/main/data) | [Paper](https://arxiv.org/abs/2405.13998) |
| 非定常不可压流体 | [2D 方腔浮力驱动流](https://paddlescience-docs.readthedocs.io/zh/examples/ns_cvit.md) | 数据驱动 | ViT | 监督学习 | [Data](https://huggingface.co/datasets/pdearena/NavierStokes-2D) | [Paper](https://arxiv.org/abs/2405.13998) |
| 定常不可压流体 | [Re3200 2D 定常方腔流](https://paddlescience-docs.readthedocs.io/zh/latest/zh/examples/ldc2d_steady) | 机理驱动 | MLP | 无监督学习 | - | |
| 定常不可压流体 | [2D 达西流](https://paddlescience-docs.readthedocs.io/zh/latest/zh/examples/darcy2d) | 机理驱动 | MLP | 无监督学习 | - | |
| 定常不可压流体 | [2D 管道流](https://paddlescience-docs.readthedocs.io/zh/latest/zh/examples/labelfree_DNN_surrogate) | 机理驱动 | MLP | 无监督学习 | - | [Paper](https://arxiv.org/abs/1906.02382) |
| 定常不可压流体 | [3D 血管瘤](https://paddlescience-docs.readthedocs.io/zh/latest/zh/examples/aneurysm) | 机理驱动 | MLP | 无监督学习 | [Data](https://paddle-org.bj.bcebos.com/paddlescience/datasets/aneurysm/aneurysm_dataset.tar) | [Project](https://docs.nvidia.com/deeplearning/modulus/modulus-v2209/user_guide/intermediate/adding_stl_files.html)|
Expand Down Expand Up @@ -102,6 +104,7 @@ PaddleScience 是一个基于深度学习框架 PaddlePaddle 开发的科学计
<!-- --8<-- [start:update] -->
## 🕘最近更新

- 添加 CVit(基于 Advection 方程和 N-S 方程求解) [CVit(Navier-Stokes)](https://paddlescience-docs.readthedocs.io/zh/latest/zh/examples/ns_cvit/)、[CVit(Advection)](https://paddlescience-docs.readthedocs.io/zh/latest/zh/examples/adv_cvit/)。
- 添加 PirateNet(基于 Allen-cahn 方程和 N-S 方程求解) [Allen-Cahn](https://paddlescience-docs.readthedocs.io/zh/latest/zh/examples/allen_cahn/)、[LDC2D(Re3200)](https://paddlescience-docs.readthedocs.io/zh/latest/zh/examples/ldc2d_steady/)。
- 基于 PaddleScience 的快速热仿真方法 [A fast general thermal simulation model based on MultiBranch Physics-Informed deep operator neural network](https://pubs.aip.org/aip/pof/article-abstract/36/3/037142/3277890/A-fast-general-thermal-simulation-model-based-on?redirectedFrom=fulltext) 被 Physics of Fluids 2024 接受。
- 添加多目标优化算法 [Relobralo](https://paddlescience-docs.readthedocs.io/zh/latest/zh/api/loss/mtl/#ppsci.loss.mtl.Relobralo) 。
Expand Down
21 changes: 13 additions & 8 deletions deploy/python_infer/pinn_predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

from typing import Dict
from typing import List
from typing import Optional
from typing import Union

import numpy as np
Expand Down Expand Up @@ -106,21 +107,22 @@ def __init__(
def predict(
self,
input_dict: Dict[str, Union[np.ndarray, paddle.Tensor]],
batch_size: int = 64,
batch_size: Optional[int] = 64,
) -> Dict[str, np.ndarray]:
"""
Predicts the output of the model for the given input.

Args:
input_dict (Dict[str, Union[np.ndarray, paddle.Tensor]]):
A dictionary containing the input data.
batch_size (int, optional): The batch size to use for prediction.
Defaults to 64.
batch_size (Optional[int]): The batch size to use for prediction.
If None, input will be directly sent to the model
without batch slicing. Defaults to 64.

Returns:
Dict[str, np.ndarray]: A dictionary containing the predicted output.
"""
if batch_size > self.max_batch_size:
if batch_size and batch_size > self.max_batch_size:
logger.warning(
f"batch_size({batch_size}) is larger than "
f"max_batch_size({self.max_batch_size}), which may occur error."
Expand All @@ -143,7 +145,7 @@ def predict(
]

num_samples = len(next(iter(input_dict.values())))
batch_num = (num_samples + (batch_size - 1)) // batch_size
batch_num = (num_samples + (batch_size - 1)) // batch_size if batch_size else 1
pred_dict = misc.Prettydefaultdict(list)

# inference by batch
Expand All @@ -152,9 +154,12 @@ def predict(
logger.info(f"Predicting batch {batch_id}/{batch_num}")

# prepare batch input dict
st = (batch_id - 1) * batch_size
ed = min(num_samples, batch_id * batch_size)
batch_input_dict = {key: input_dict[key][st:ed] for key in input_dict}
if batch_size:
st = (batch_id - 1) * batch_size
ed = min(num_samples, batch_id * batch_size)
batch_input_dict = {key: input_dict[key][st:ed] for key in input_dict}
else:
batch_input_dict = {key: input_dict[key] for key in input_dict}

# send batch input data to input handle(s)
if self.engine != "onnx":
Expand Down
4 changes: 3 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@

| 问题类型 | 案例名称 | 优化算法 | 模型类型 | 训练方式 | 数据集 | 参考资料 |
|-----|---------|-----|---------|----|---------|---------|
| 定常不可压流体 | [2D 定常方腔流](./zh/examples/ldc2d_steady.md) | 机理驱动 | MLP | 无监督学习 | - | |
| 一维线性对流问题 | [1D 线性对流](./zh/examples/adv_cvit.md) | 数据驱动 | ViT | 监督学习 | [Data](https://github.com/Zhengyu-Huang/Operator-Learning/tree/main/data) | [Paper](https://arxiv.org/abs/2405.13998) |
| 非定常不可压流体 | [2D 方腔浮力驱动流](./zh/examples/ns_cvit.md) | 数据驱动 | ViT | 监督学习 | [Data](https://huggingface.co/datasets/pdearena/NavierStokes-2D) | [Paper](https://arxiv.org/abs/2405.13998) |
| 定常不可压流体 | [Re3200 2D 定常方腔流](./zh/examples/ldc2d_steady.md) | 机理驱动 | MLP | 无监督学习 | - | |
| 定常不可压流体 | [2D 达西流](./zh/examples/darcy2d.md) | 机理驱动 | MLP | 无监督学习 | - | |
| 定常不可压流体 | [2D 管道流](./zh/examples/labelfree_DNN_surrogate.md) | 机理驱动 | MLP | 无监督学习 | - | [Paper](https://arxiv.org/abs/1906.02382) |
| 定常不可压流体 | [3D 血管瘤](./zh/examples/aneurysm.md) | 机理驱动 | MLP | 无监督学习 | [Data](https://paddle-org.bj.bcebos.com/paddlescience/datasets/aneurysm/aneurysm_dataset.tar) | [Project](https://docs.nvidia.com/deeplearning/modulus/modulus-v2209/user_guide/intermediate/adding_stl_files.html)|
Expand Down
38 changes: 17 additions & 21 deletions docs/zh/api/arch.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,32 @@
handler: python
options:
members:
- Arch
- AFNONet
- AMGNet
- MLP
- ModifiedMLP
- PirateNet
- Arch
- AutoEncoder
- ChipDeepONets
- CuboidTransformer
- CVit1D
- CylinderEmbedding
- DeepONet
- DeepPhyLSTM
- LorenzEmbedding
- RosslerEmbedding
- CylinderEmbedding
- Generator
- DGMR
- Discriminator
- PhysformerGPT2
- ExtFormerMoECuboid
- Generator
- HEDeepONets
- LorenzEmbedding
- MLP
- ModelList
- AFNONet
- PrecipNet
- PhyCRNet
- UNetEx
- USCNN
- ModifiedMLP
- NowcastNet
- HEDeepONets
- DGMR
- ChipDeepONets
- AutoEncoder
- CuboidTransformer
- ExtFormerMoECuboid
- SFNONet
- UNONet
- TFNO1dNet
- TFNO2dNet
- TFNO3dNet
- UNetEx
- UNONet
- USCNN
show_root_heading: true
heading_level: 3
2 changes: 1 addition & 1 deletion docs/zh/api/equation.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
- Laplace
- LinearElasticity
- NavierStokes
- NLSMB
- NormalDotVec
- Poisson
- Vibration
- Volterra
- NLSMB
show_root_heading: true
heading_level: 3
2 changes: 1 addition & 1 deletion docs/zh/api/experimental.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
- bessel_i1e
- fractional_diff
- gaussian_integrate
- trapezoid_integrate
- montecarlo_integrate
- trapezoid_integrate
show_root_heading: true
heading_level: 3
12 changes: 6 additions & 6 deletions docs/zh/api/geometry.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
options:
members:
- Geometry
- Interval
- Disk
- Polygon
- Rectangle
- Triangle
- Cuboid
- Sphere
- Disk
- Hypercube
- Hypersphere
- Interval
- Mesh
- PointCloud
- Polygon
- Rectangle
- Sphere
- TimeDomain
- TimeXGeometry
- Triangle
show_root_heading: true
heading_level: 3
10 changes: 5 additions & 5 deletions docs/zh/api/lr_scheduler.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
handler: python
options:
members:
- Linear
- Cosine
- Step
- Piecewise
- MultiStepDecay
- ExponentialDecay
- CosineWarmRestarts
- ExponentialDecay
- Linear
- MultiStepDecay
- OneCycleLR
- Piecewise
- Step
show_root_heading: true
heading_level: 3
8 changes: 4 additions & 4 deletions docs/zh/api/metric.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
members:
- Metric
- FunctionalMetric
- MAE
- MSE
- RMSE
- L2Rel
- MeanL2Rel
- LatitudeWeightedACC
- LatitudeWeightedRMSE
- MAE
- MeanL2Rel
- MSE
- RMSE
show_root_heading: true
heading_level: 3
6 changes: 3 additions & 3 deletions docs/zh/api/optimizer.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
handler: python
options:
members:
- SGD
- Momentum
- Adam
- AdamW
- RMSProp
- LBFGS
- Momentum
- OptimizerList
- RMSProp
- SGD
show_root_heading: true
heading_level: 3
12 changes: 6 additions & 6 deletions docs/zh/api/visualize.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
options:
members:
- Visualizer
- VisualizerScatter1D
- VisualizerScatter3D
- VisualizerVtu
- Visualizer2D
- Visualizer2DPlot
- Visualizer3D
- VisualizerWeather
- VisualizerRadar
- save_vtu_from_dict
- save_vtu_to_mesh
- VisualizerScatter1D
- VisualizerScatter3D
- VisualizerVtu
- VisualizerWeather
- save_plot_from_1d_dict
- save_plot_from_3d_dict
- save_vtu_from_dict
- save_vtu_to_mesh
show_root_heading: true
heading_level: 3
Loading