File tree Expand file tree Collapse file tree 6 files changed +19
-9
lines changed Expand file tree Collapse file tree 6 files changed +19
-9
lines changed Original file line number Diff line number Diff line change 15
15
16
16
🔥 [ IJCAI 2024: 任意三维几何外形车辆的风阻快速预测竞赛] ( https://competition.atomgit.com/competitionInfo?id=7f3f276465e9e845fd3a811d2d6925b5 ) ,track A, B, C 代码:
17
17
18
- - [ paddle实现] ( .. /jointContribution/IJCAI_2024/README.md )
18
+ - [ paddle实现] ( ./jointContribution/IJCAI_2024/README.md )
19
19
- [ pytorch实现] ( https://competition.atomgit.com/competitionInfo?id=7f3f276465e9e845fd3a811d2d6925b5 ) (点击** 排行榜** 可查看各个赛道前10名的代码)
20
20
21
21
<!-- --8<-- [start:description] -->
@@ -108,6 +108,8 @@ PaddleScience 是一个基于深度学习框架 PaddlePaddle 开发的科学计
108
108
<!-- --8<-- [start:update] -->
109
109
## 🕘最近更新
110
110
111
+ - 添加 [ IJCAI 2024: 任意三维几何外形车辆的风阻快速预测竞赛] ( https://competition.atomgit.com/competitionInfo?id=7f3f276465e9e845fd3a811d2d6925b5 ) ,track A, B, C 的 paddle/pytorch 代码链接。
112
+ - 添加 SPINN(基于 Helmholtz3D 方程求解) [ helmholtz3d] ( https://paddlescience-docs.readthedocs.io/zh-cn/latest/zh/examples/spinn/ ) 。
111
113
- 添加 CVit(基于 Advection 方程和 N-S 方程求解) [ CVit(Navier-Stokes)] ( https://paddlescience-docs.readthedocs.io/zh-cn/latest/zh/examples/ns_cvit/ ) 、[ CVit(Advection)] ( https://paddlescience-docs.readthedocs.io/zh-cn/latest/zh/examples/adv_cvit/ ) 。
112
114
- 添加 PirateNet(基于 Allen-cahn 方程和 N-S 方程求解) [ Allen-Cahn] ( https://paddlescience-docs.readthedocs.io/zh-cn/latest/zh/examples/allen_cahn/ ) 、[ LDC2D(Re3200)] ( https://paddlescience-docs.readthedocs.io/zh-cn/latest/zh/examples/ldc2d_steady/ ) 。
113
115
- 基于 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 接受。
Original file line number Diff line number Diff line change 6
6
7
7
🔥 [ IJCAI 2024: 任意三维几何外形车辆的风阻快速预测竞赛] ( https://competition.atomgit.com/competitionInfo?id=7f3f276465e9e845fd3a811d2d6925b5 ) ,track A, B, C 代码:
8
8
9
- - [ paddle实现] ( ../ jointContribution/IJCAI_2024/README.md )
9
+ - [ paddle实现] ( https://github.com/PaddlePaddle/PaddleScience/tree/develop/ jointContribution/IJCAI_2024)
10
10
- [ pytorch实现] ( https://competition.atomgit.com/competitionInfo?id=7f3f276465e9e845fd3a811d2d6925b5 ) (点击** 排行榜** 可查看各个赛道前10名的代码)
11
11
12
12
<style >
Original file line number Diff line number Diff line change 1
1
# SPINN(helmholtz3d)
2
2
3
- <!-- < a href="https://aistudio.baidu.com/projectdetail/8219967" class="md-button md-button--primary" style>AI Studio快速体验</a> -- >
3
+ <a href =" https://aistudio.baidu.com/projectdetail/8219967 " class =" md-button md-button--primary " style >AI Studio快速体验</a >
4
4
5
5
=== "模型训练命令"
6
6
Original file line number Diff line number Diff line change 15
15
import copy
16
16
import random
17
17
from functools import partial
18
+ from typing import Callable
19
+ from typing import Optional
18
20
19
21
import numpy as np
20
22
import paddle .distributed as dist
@@ -101,9 +103,11 @@ def build_dataloader(_dataset, cfg):
101
103
102
104
# build collate_fn if specified
103
105
batch_transforms_cfg = cfg .pop ("batch_transforms" , None )
104
- collate_fn = None
106
+ collate_fn : Optional [ Callable ] = cfg . pop ( "collate_fn" , None )
105
107
if isinstance (batch_transforms_cfg , (list , tuple )):
106
- collate_fn = batch_transform .build_batch_transforms (batch_transforms_cfg )
108
+ collate_fn = batch_transform .build_batch_transforms (
109
+ batch_transforms_cfg , collate_fn
110
+ )
107
111
108
112
# build init function
109
113
_DEFAULT_NUM_WORKERS = 1
Original file line number Diff line number Diff line change 19
19
from typing import Any
20
20
from typing import Callable
21
21
from typing import List
22
+ from typing import Optional
22
23
23
24
import numpy as np
24
25
import paddle
@@ -118,15 +119,17 @@ def build_transforms(cfg):
118
119
return transform .Compose (transform_list )
119
120
120
121
121
- def build_batch_transforms (cfg ):
122
+ def build_batch_transforms (cfg , collate_fn : Optional [ Callable ] ):
122
123
cfg = copy .deepcopy (cfg )
123
124
batch_transforms : Callable [[List [Any ]], List [Any ]] = build_transforms (cfg )
125
+ if collate_fn is None :
126
+ collate_fn = default_collate_fn
124
127
125
128
def collate_fn_batch_transforms (batch : List [Any ]):
126
129
# apply batch transform on separate samples
127
130
batch = batch_transforms (batch )
128
131
129
132
# then collate separate samples into batched data
130
- return default_collate_fn (batch )
133
+ return collate_fn (batch )
131
134
132
135
return collate_fn_batch_transforms
Original file line number Diff line number Diff line change 25
25
from paddle import io
26
26
27
27
from ppsci .solver import printer
28
+ from ppsci .solver .train import _compute_batch_size
28
29
from ppsci .utils import misc
29
30
30
31
if TYPE_CHECKING :
@@ -128,7 +129,7 @@ def _eval_by_dataset(
128
129
batch_cost = time .perf_counter () - batch_tic
129
130
solver .eval_time_info ["reader_cost" ].update (reader_cost )
130
131
solver .eval_time_info ["batch_cost" ].update (batch_cost )
131
- batch_size = next ( iter ( input_dict . values ())). shape [ 0 ]
132
+ batch_size = _compute_batch_size ( input_dict )
132
133
printer .update_eval_loss (solver , loss_dict , batch_size )
133
134
if (
134
135
iter_id == 1
@@ -216,7 +217,7 @@ def _eval_by_batch(
216
217
input_dict , label_dict , weight_dict = batch
217
218
reader_cost = time .perf_counter () - reader_tic
218
219
219
- batch_size = next ( iter ( input_dict . values ())). shape [ 0 ]
220
+ batch_size = _compute_batch_size ( input_dict )
220
221
for v in input_dict .values ():
221
222
if hasattr (v , "stop_gradient" ):
222
223
v .stop_gradient = False
You can’t perform that action at this time.
0 commit comments