Skip to content

Commit 3961d68

Browse files
Fix cvit (#1244)
* fix cvit coords_dim and shapenet_car.py * update requirements.txt * fix * fix docstring style for chemprop_molecule_utils.py * fix
1 parent 8037ed1 commit 3961d68

File tree

5 files changed

+337
-211
lines changed

5 files changed

+337
-211
lines changed

docs/zh/examples/transolver.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
!!! note
44

5-
第一次运行时,会对 mlcfd_data 进行预处理,大约需要一小时,请耐心等待
5+
运行本案例前请先安装相关依赖库: `pip install -r requirements.txt`
66

77
=== "模型训练命令"
88

@@ -15,6 +15,10 @@
1515
python main.py
1616
```
1717

18+
!!! note
19+
20+
第一次运行时,会对 mlcfd_data 进行预处理,大约需要一小时,请耐心等待
21+
1822
=== "模型评估命令"
1923

2024
``` sh
@@ -26,6 +30,10 @@
2630
python main.py mode=eval EVAL.pretrained_model_path=https://paddle-org.bj.bcebos.com/paddlescience/models/transolver/transolver_pretrained.pdparams
2731
```
2832

33+
!!! note
34+
35+
第一次运行时,会对 mlcfd_data 进行预处理,大约需要一小时,请耐心等待
36+
2937
=== "模型导出命令"
3038

3139
``` sh
@@ -43,6 +51,10 @@
4351
python main.py mode=infer
4452
```
4553

54+
!!! note
55+
56+
第一次运行时,会对 mlcfd_data 进行预处理,大约需要一小时,请耐心等待
57+
4658
| 预训练模型 | 指标 |
4759
|:--| :--|
4860
| [transolver_pretrained.pdparams](https://paddle-org.bj.bcebos.com/paddlescience/models/transolver/transolver_pretrained.pdparams) | rho_d:, 0.99314<br>c_d: 0.01136<br>relative l2 error of press: 0.07829<br>relative l2 error of velocity: 0.02304<br>press: 4.95888<br>velocity: [0.12163974 0.14851639 0.41583335] 0.26443 |
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-e git+https://github.com/PFCCLab/paddle_geometric.git@main#egg=paddle_geometric
2+
vtk

examples/transolver/shapenet_car.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,13 @@
2424

2525
try:
2626
from paddle_geometric import nn as nng
27+
except ModuleNotFoundError:
28+
pass
29+
try:
2730
from paddle_geometric.data import Data
31+
except ModuleNotFoundError:
32+
pass
33+
try:
2834
from paddle_geometric.utils import k_hop_subgraph
2935
except ModuleNotFoundError:
3036
pass
@@ -362,7 +368,9 @@ def get_shape(data, max_n_point=8192, normalize=True, use_height=False):
362368
return shape_pc
363369

364370

365-
def create_edge_index_radius(data, r, max_neighbors=32) -> "torch.Tensor": # noqa: F821
371+
def create_edge_index_radius(
372+
data, r, max_neighbors=32
373+
) -> "paddle.Tensor": # noqa: F821
366374
data.edge_index = nng.radius_graph(
367375
x=data.pos, r=r, loop=True, max_num_neighbors=max_neighbors
368376
)
@@ -410,23 +418,23 @@ def __len__(self):
410418
def __getitem__(self, idx):
411419
sample = self.datalist[idx]
412420
shape = get_shape(sample, use_height=self.use_height)
413-
velo_press = paddle.from_dlpack(sample.y)
421+
velo_press = sample.y
414422

415423
inp = {
416-
"x": paddle.from_dlpack(sample.x),
417-
# "pos": paddle.from_dlpack(sample.pos),
424+
"x": sample.x,
425+
# "pos": (sample.pos),
418426
}
419427
lab = {
420428
"velo_vec": velo_press[..., 0:3], # x,y,z
421429
"press": velo_press[..., 3:], # p
422-
"surf": paddle.from_dlpack(sample.surf),
430+
"surf": sample.surf,
423431
}
424432
wei = {}
425433
# lab["sdf"] = inp["x"][:, 3:4]
426434
# lab["normal_vec"] = inp["x"][:, 4:]
427435

428436
if not self.training:
429-
lab["shape"] = paddle.from_dlpack(shape)
437+
lab["shape"] = shape
430438

431439
return inp, lab, wei
432440

0 commit comments

Comments
 (0)