diff --git a/README.md b/README.md index 90a2286e57..624f0b563b 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,8 @@ [**PaddleScience使用文档**](https://paddlescience-docs.readthedocs.io/zh/latest/) +🔥 [IJCAI 2024: 任意三维几何外形车辆的风阻快速预测竞赛](https://competition.atomgit.com/competitionInfo?id=7f3f276465e9e845fd3a811d2d6925b5),欢迎报名参赛。 + ## 👀简介 diff --git a/deploy/python_infer/base.py b/deploy/python_infer/base.py index c63df6e8f7..2fd656873e 100644 --- a/deploy/python_infer/base.py +++ b/deploy/python_infer/base.py @@ -36,7 +36,7 @@ class Predictor: Args: pdmodel_path (Optional[str]): Path to the PaddlePaddle model file. Defaults to None. - pdpiparams_path (Optional[str]): Path to the PaddlePaddle model parameters file. Defaults to None. + pdiparams_path (Optional[str]): Path to the PaddlePaddle model parameters file. Defaults to None. device (Literal["gpu", "cpu", "npu", "xpu"], optional): Device to use for inference. Defaults to "cpu". engine (Literal["native", "tensorrt", "onnx", "mkldnn"], optional): Inference engine to use. Defaults to "native". precision (Literal["fp32", "fp16", "int8"], optional): Precision to use for inference. Defaults to "fp32". @@ -51,7 +51,7 @@ class Predictor: def __init__( self, pdmodel_path: Optional[str] = None, - pdpiparams_path: Optional[str] = None, + pdiparams_path: Optional[str] = None, *, device: Literal["gpu", "cpu", "npu", "xpu"] = "cpu", engine: Literal["native", "tensorrt", "onnx", "mkldnn"] = "native", @@ -65,7 +65,7 @@ def __init__( num_cpu_threads: int = 10, ): self.pdmodel_path = pdmodel_path - self.pdpiparams_path = pdpiparams_path + self.pdiparams_path = pdiparams_path self._check_device(device) self.device = device @@ -104,13 +104,13 @@ def _create_paddle_predictor( f"Given 'pdmodel_path': {self.pdmodel_path} does not exist. " "Please check if it is correct." ) - if not osp.exists(self.pdpiparams_path): + if not osp.exists(self.pdiparams_path): raise FileNotFoundError( - f"Given 'pdpiparams_path': {self.pdpiparams_path} does not exist. " + f"Given 'pdiparams_path': {self.pdiparams_path} does not exist. " "Please check if it is correct." ) - config = paddle_inference.Config(self.pdmodel_path, self.pdpiparams_path) + config = paddle_inference.Config(self.pdmodel_path, self.pdiparams_path) if self.device == "gpu": config.enable_use_gpu(self.gpu_mem, self.gpu_id) if self.engine == "tensorrt": diff --git a/deploy/python_infer/pinn_predictor.py b/deploy/python_infer/pinn_predictor.py index 5dabe44e6d..0b01df92b8 100644 --- a/deploy/python_infer/pinn_predictor.py +++ b/deploy/python_infer/pinn_predictor.py @@ -38,7 +38,7 @@ def __init__( ): super().__init__( cfg.INFER.pdmodel_path, - cfg.INFER.pdpiparams_path, + cfg.INFER.pdiparams_path, device=cfg.INFER.device, engine=cfg.INFER.engine, precision=cfg.INFER.precision, diff --git a/docs/zh/examples/cylinder2d_unsteady.md b/docs/zh/examples/cylinder2d_unsteady.md index 33e35b8de1..e73868d50b 100644 --- a/docs/zh/examples/cylinder2d_unsteady.md +++ b/docs/zh/examples/cylinder2d_unsteady.md @@ -26,7 +26,7 @@ python cylinder2d_unsteady_Re100.py mode=eval EVAL.pretrained_model_path=https://paddle-org.bj.bcebos.com/paddlescience/models/cylinder2d_unsteady_Re100/cylinder2d_unsteady_Re100_pretrained.pdparams ``` - === "模型导出命令" +=== "模型导出命令" ``` sh python cylinder2d_unsteady_Re100.py mode=export diff --git a/docs/zh/examples/cylinder2d_unsteady_transformer_physx.md b/docs/zh/examples/cylinder2d_unsteady_transformer_physx.md index 721fa1caf7..bb8f6cd732 100644 --- a/docs/zh/examples/cylinder2d_unsteady_transformer_physx.md +++ b/docs/zh/examples/cylinder2d_unsteady_transformer_physx.md @@ -45,6 +45,24 @@ python train_transformer.py mode=infer ``` +=== "模型导出命令" + + ``` sh + python train_transformer.py mode=export EMBEDDING_MODEL_PATH=https://paddle-org.bj.bcebos.com/paddlescience/models/cylinder/cylinder_pretrained.pdparams + ``` + +=== "模型推理命令" + + ``` sh + # linux + wget -nc https://paddle-org.bj.bcebos.com/paddlescience/datasets/transformer_physx/cylinder_training.hdf5 -P ./datasets/ + wget -nc https://paddle-org.bj.bcebos.com/paddlescience/datasets/transformer_physx/cylinder_valid.hdf5 -P ./datasets/ + # windows + # curl https://paddle-org.bj.bcebos.com/paddlescience/datasets/transformer_physx/cylinder_training.hdf5 --output ./datasets/cylinder_training.hdf5 + # curl https://paddle-org.bj.bcebos.com/paddlescience/datasets/transformer_physx/cylinder_valid.hdf5 --output ./datasets/cylinder_valid.hdf5 + python train_transformer.py mode=infer + ``` + | 模型 | MSE | | :-- | :-- | | [cylinder_transformer_pretrained.pdparams](https://paddle-org.bj.bcebos.com/paddlescience/models/cylinder/cylinder_transformer_pretrained.pdparams) | 1.093 | diff --git a/examples/ldc/conf/ldc2d_steady_Re10.yaml b/examples/ldc/conf/ldc2d_steady_Re10.yaml index f99c9d7c83..f9bc05f44b 100644 --- a/examples/ldc/conf/ldc2d_steady_Re10.yaml +++ b/examples/ldc/conf/ldc2d_steady_Re10.yaml @@ -62,7 +62,7 @@ INFER: pretrained_model_path: https://paddle-org.bj.bcebos.com/paddlescience/models/ldc2d_steady_Re10/ldc2d_steady_Re10_pretrained.pdparams export_path: ./inference/ldc2d_steady_Re10 pdmodel_path: ${INFER.export_path}.pdmodel - pdpiparams_path: ${INFER.export_path}.pdiparams + pdiparams_path: ${INFER.export_path}.pdiparams onnx_path: ${INFER.export_path}.onnx device: gpu engine: native diff --git a/examples/tempoGAN/conf/tempogan.yaml b/examples/tempoGAN/conf/tempogan.yaml index a61eb91970..44cf4c559a 100644 --- a/examples/tempoGAN/conf/tempogan.yaml +++ b/examples/tempoGAN/conf/tempogan.yaml @@ -99,7 +99,7 @@ INFER: pretrained_model_path: https://paddle-org.bj.bcebos.com/paddlescience/models/tempoGAN/tempogan_pretrained.pdparams export_path: ./inference/tempoGAN pdmodel_path: ${INFER.export_path}.pdmodel - pdpiparams_path: ${INFER.export_path}.pdiparams + pdiparams_path: ${INFER.export_path}.pdiparams device: gpu engine: native precision: fp32 diff --git a/ppsci/utils/symbolic.py b/ppsci/utils/symbolic.py index a48a7399fd..8cf368c8c4 100644 --- a/ppsci/utils/symbolic.py +++ b/ppsci/utils/symbolic.py @@ -157,7 +157,7 @@ def __repr__(self): return f"{self.__class__.__name__}(expr: {self.expr})" -class DetachNode(nn.Layer): +class DetachNode(Node): """Class for detach operation in converted expression tree. Args: @@ -165,9 +165,7 @@ class DetachNode(nn.Layer): """ def __init__(self, expr: sp.Basic): - super().__init__() - self.expr = expr - self.key = _cvt_to_key(self.expr) + super().__init__(expr) self.child = _cvt_to_key(self.expr.args[0]) def forward(self, data_dict: DATA_DICT):