Skip to content

Commit

Permalink
Fix EPNN (PaddlePaddle#636)
Browse files Browse the repository at this point in the history
* Fix

* Fix

* Fix
  • Loading branch information
co63oc authored Nov 15, 2023
1 parent 93712ae commit 6248f60
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 43 deletions.
20 changes: 10 additions & 10 deletions docs/zh/examples/epnn.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@

``` sh
# linux
wget https://paddle-org.bj.bcebos.com/paddlescience/datasets/dstate-16-plas.dat -O datasets/dstate-16-plas.dat
wget https://paddle-org.bj.bcebos.com/paddlescience/datasets/dstress-16-plas.dat -O datasets/dstress-16-plas.dat
wget https://paddle-org.bj.bcebos.com/paddlescience/datasets/epnn/dstate-16-plas.dat -P ./datasets/
wget https://paddle-org.bj.bcebos.com/paddlescience/datasets/epnn/dstress-16-plas.dat -P ./datasets/
# windows
# curl https://paddle-org.bj.bcebos.com/paddlescience/datasets/dstate-16-plas.dat --output datasets/dstate-16-plas.dat
# curl https://paddle-org.bj.bcebos.com/paddlescience/datasets/dstress-16-plas.dat --output datasets/dstress-16-plas.dat
# curl https://paddle-org.bj.bcebos.com/paddlescience/datasets/epnn/dstate-16-plas.dat --output datasets/dstate-16-plas.dat
# curl https://paddle-org.bj.bcebos.com/paddlescience/datasets/epnn/dstress-16-plas.dat --output datasets/dstress-16-plas.dat
python epnn.py
```

=== "模型评估命令"

``` sh
# linux
wget https://paddle-org.bj.bcebos.com/paddlescience/datasets/dstate-16-plas.dat -O datasets/dstate-16-plas.dat
wget https://paddle-org.bj.bcebos.com/paddlescience/datasets/dstress-16-plas.dat -O datasets/dstress-16-plas.dat
wget https://paddle-org.bj.bcebos.com/paddlescience/datasets/epnn/dstate-16-plas.dat -P ./datasets/
wget https://paddle-org.bj.bcebos.com/paddlescience/datasets/epnn/dstress-16-plas.dat -P ./datasets/
# windows
# curl https://paddle-org.bj.bcebos.com/paddlescience/datasets/dstate-16-plas.dat --output datasets/dstate-16-plas.dat
# curl https://paddle-org.bj.bcebos.com/paddlescience/datasets/dstress-16-plas.dat --output datasets/dstress-16-plas.dat
# curl https://paddle-org.bj.bcebos.com/paddlescience/datasets/epnn/dstate-16-plas.dat --output datasets/dstate-16-plas.dat
# curl https://paddle-org.bj.bcebos.com/paddlescience/datasets/epnn/dstress-16-plas.dat --output datasets/dstress-16-plas.dat
python epnn.py mode=eval EVAL.pretrained_model_path=https://paddle-org.bj.bcebos.com/paddlescience/models/epnn/epnn_pretrained.pdparams
```

Expand Down Expand Up @@ -53,7 +53,7 @@ examples/epnn/functions.py:370:390
--8<--
```

Epnn 参数 input_keys 是输入字段名,output_keys 是输出字段名,node_sizes 是节点大小列表,activations 是激活函数字符串列表,drop_p 是节点丢弃概率。
EPNN 参数 `input_keys` 是输入字段名,`output_keys` 是输出字段名,`node_sizes` 是节点大小列表,`activations` 是激活函数字符串列表,`drop_p` 是节点丢弃概率。

### 3.2 数据生成

Expand Down Expand Up @@ -120,7 +120,7 @@ examples/epnn/conf/epnn.yaml:40:41

训练过程会调用优化器来更新模型参数,此处选择较为常用的 `Adam` 优化器,并配合使用机器学习中常用的 ExponentialDecay 学习率调整策略。

由于使用多个模型,需要设置多个优化器,对 Epnn 网络部分,需要设置 `Adam` 优化器。
由于使用多个模型,需要设置多个优化器,对 EPNN 网络部分,需要设置 `Adam` 优化器。

``` py linenums="395"
--8<--
Expand Down
65 changes: 32 additions & 33 deletions ppsci/arch/epnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,38 @@
# See the License for the specific language governing permissions and
# limitations under the License.

""" Elasto-Plastic Neural Network (EPNN)
DEVELOPED AT:
COMPUTATIONAL GEOMECHANICS LABORATORY
DEPARTMENT OF CIVIL ENGINEERING
UNIVERSITY OF CALGARY, AB, CANADA
DIRECTOR: Prof. Richard Wan
DEVELOPED BY:
MAHDAD EGHBALIAN
MIT License
Copyright (c) 2022 Mahdad Eghbalian
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
# Elasto-Plastic Neural Network (EPNN)

# DEVELOPED AT:
# COMPUTATIONAL GEOMECHANICS LABORATORY
# DEPARTMENT OF CIVIL ENGINEERING
# UNIVERSITY OF CALGARY, AB, CANADA
# DIRECTOR: Prof. Richard Wan

# DEVELOPED BY:
# MAHDAD EGHBALIAN

# MIT License

# Copyright (c) 2022 Mahdad Eghbalian

# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

from typing import Tuple

Expand Down

0 comments on commit 6248f60

Please sign in to comment.