Skip to content

Commit ad6dd0b

Browse files
committed
feat(ppsci): support data_effient_nopt
1 parent 48c2302 commit ad6dd0b

File tree

5 files changed

+179
-216
lines changed

5 files changed

+179
-216
lines changed

docs/zh/examples/data_efficient_nopt.md

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,32 @@
1111
=== "模型训练命令"
1212

1313
``` sh
14+
# Download possion_64 data and model into `examples/data_efficient_nopt/data`
1415
cd examples/data_efficient_nopt
15-
# Download possion_64 data from https://drive.google.com/drive/folders/1crIsTZGxZULWhrXkwGDiWF33W6RHxJkf
16-
# Download helmholtz_64 data from https://drive.google.com/drive/folders/1UjIaF6FsjmN_xlGGSUX-1K2V3EF2Zalw
17-
18-
# Update the file paths in `cexamples/data_efficient_nopt/config/data_efficient_nopt.yaml`, specify to mode in `train`, and then specify to `train_path`, `val_path`, `test_path`, `scales_path` and `train_rand_idx_path`
19-
20-
# pretrain or finetune, for possion_64 or helmholtz_64.
21-
# specify config_name to fno_possion using `data_efficient_nopt_fno_poisson`, or to fno_helmholtz using `data_efficient_nopt_fno_helmholtz`
22-
python data_efficient_nopt.py --config-name=<config_name>
16+
mkdir data && cd data
17+
wget https://dataset.bj.bcebos.com/PaddleScience/data_efficient_nopt/possion_data/poisson_64_e1_20_train.h5
18+
wget https://dataset.bj.bcebos.com/PaddleScience/data_efficient_nopt/possion_data/poisson_64_e1_20_val.h5
19+
wget https://dataset.bj.bcebos.com/PaddleScience/data_efficient_nopt/possion_data/poisson_64_e1_20_test.h5
20+
wget https://dataset.bj.bcebos.com/PaddleScience/data_efficient_nopt/possion_data/poisson_64_e1_20_train_scale.npy
21+
wget https://dataset.bj.bcebos.com/PaddleScience/data_efficient_nopt/possion_data/poisson_64_e5_15_train.h5
22+
wget https://dataset.bj.bcebos.com/PaddleScience/data_efficient_nopt/possion_data/poisson_64_e5_15_train_scale.npy
23+
wget https://dataset.bj.bcebos.com/PaddleScience/data_efficient_nopt/possion_data/poisson_64_e5_15_val.h5
24+
wget https://dataset.bj.bcebos.com/PaddleScience/data_efficient_nopt/possion_data/poisson_64_e5_15_test.h5
25+
wget https://dataset.bj.bcebos.com/PaddleScience/data_efficient_nopt/possion_data/train_rand_idx.npy
26+
27+
28+
# pretrain
29+
cd examples/data_efficient_nopt
30+
python data_efficient_nopt.py \
31+
--config-name data_efficient_nopt_fno_poisson \
32+
config=pois-64-pretrain-e1_20_m0
33+
34+
# finetune
35+
python data_efficient_nopt.py \
36+
--config-name data_efficient_nopt_fno_poisson \
37+
mode=finetune \
38+
config=pois_64_finetune_e5_15 \
39+
train_config.pois_64_finetune_e5_15.pretrained_ckpt_path="./data/pretrain_b01_m0.pdparams"
2340
```
2441

2542
=== "模型评估命令"
@@ -34,16 +51,13 @@
3451

3552
``` sh
3653
cd examples/data_efficient_nopt
37-
# Update the file paths in `cexamples/data_efficient_nopt/config/data_efficient_nopt.yaml`, specify to mode in `infer`, and then specify to `ckpt_path`, `train_path`, `test_path` and `scales_path`
38-
# Use a fine-tuned model as the checkpoint in 'exp' or utilize `model_convert.py` to convert the official checkpoint.
39-
40-
# use your onw finetune checkpoints, or download checkpoint from [FNO-Poisson](https://drive.google.com/drive/folders/1ekmXqqvpaY6pNStTciw1SCAzF0gjFP_V) or [FNO-Helmholtz](https://drive.google.com/drive/folders/1k7US8ZAgB14Wj9bfdgO_Cjw6hOrG6UaZ) and then convert to paddlepaddle weights.
41-
python model_convert.py --pt-model <pt_checkpiont> --pd-model <pd_checkpiont>
54+
mkdir data && cd data
55+
wget https://dataset.bj.bcebos.com/PaddleScience/data_efficient_nopt/possion_data/finetune_b01_m0_n8192.pdparams
4256

43-
# inference for possion_64 or helmholtz_64, specify in config as following:
44-
# ckpt_path: <ckpt_path>
45-
# specify config_name to fno_possion using `data_efficient_nopt_fno_poisson`, or to fno_helmholtz using `data_efficient_nopt_fno_helmholtz`
46-
python data_efficient_nopt.py --config-name=<config_name>
57+
python data_efficient_nopt.py \
58+
--config-name=data_efficient_nopt_fno_poisson.yaml \
59+
mode=infer \
60+
infer_config.ckpt_path=./exp/pois_64_finetune_e5_15/r0/training_checkpoints/ckpt.tar
4761
```
4862

4963
## 1. 背景简介

examples/data_efficient_nopt/config/data_efficient_nopt_fno_poisson.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ sweep_id: ''
1010

1111
train_config:
1212
default: &DEFAULT
13-
num_data_workers: 4
13+
num_data_workers: 0
1414
# model
1515
model: 'fno'
1616
depth: 5
@@ -131,7 +131,7 @@ train_config:
131131
blur: [0, 1]
132132

133133

134-
pois-64-finetune-e5_15: &pois_64_e5_15_ft
134+
pois_64_finetune_e5_15: &pois_64_e5_15_ft
135135
<<: *poisson
136136
train_path: 'data/possion_64/poisson_64_e5_15_train.h5'
137137
val_path: 'data/possion_64/poisson_64_e5_15_val.h5'
@@ -288,9 +288,9 @@ infer_config:
288288
test_path: 'data/possion_64/poisson_64_e15_50_test.h5'
289289
scales_path: 'data/possion_64/poisson_64_e5_15_train_scale.npy'
290290

291-
num_data_workers: 1
291+
num_data_workers: 0
292292
subsample: 1
293-
# num_demos: 0
293+
num_demos: 0
294294
shuffle: False
295295
nx: 64
296296
nt: 64

0 commit comments

Comments
 (0)