forked from neuraloperator/physics_informed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deeponet.py
30 lines (26 loc) · 1.12 KB
/
deeponet.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import yaml
from argparse import ArgumentParser
from baselines.train_ns import train_deeponet_cp
from baselines.test import test_deeponet_ns, test_deeponet_darcy
from baselines.train_darcy import train_deeponet_darcy
if __name__ == '__main__':
parser = ArgumentParser(description='Basic paser')
parser.add_argument('--config_path', type=str, help='Path to the configuration file')
parser.add_argument('--mode', type=str, default='train', help='Train or test')
args = parser.parse_args()
config_file = args.config_path
with open(config_file, 'r') as stream:
config = yaml.load(stream, yaml.FullLoader)
if args.mode == 'train':
print('Start training DeepONet Cartesian Product')
if 'name' in config['data'] and config['data']['name'] == 'Darcy':
train_deeponet_darcy(config)
else:
train_deeponet_cp(config)
else:
print('Start testing DeepONet Cartesian Product')
if 'name' in config['data'] and config['data']['name'] == 'Darcy':
test_deeponet_darcy(config)
else:
test_deeponet_ns(config)
print('Done!')