Skip to content

Commit

Permalink
add data
Browse files Browse the repository at this point in the history
  • Loading branch information
devzhk committed Jul 10, 2023
1 parent f7a2a64 commit b4fcb66
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions download_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
'NS-Re100Part0': 'https://hkzdata.s3.us-west-2.amazonaws.com/PINO/data/NS_fine_Re100_T128_part0.npy',
'burgers': 'https://hkzdata.s3.us-west-2.amazonaws.com/PINO/data/burgers_pino.mat',
'NS-Re500_T300_id0': 'https://hkzdata.s3.us-west-2.amazonaws.com/PINO/NS-Re500_T300_id0.npy',
'NS-Re500_T300_id0-shuffle': 'https://hkzdata.s3.us-west-2.amazonaws.com/PINO/data/NS-Re500_T300_id0-shuffle.npy',
'darcy-train': 'https://hkzdata.s3.us-west-2.amazonaws.com/PINO/data/piececonst_r421_N1024_smooth1.mat',
'darcy-test': 'https://hkzdata.s3.us-west-2.amazonaws.com/PINO/data/piececonst_r421_N1024_smooth2.mat',
'cavity': 'https://hkzdata.s3.us-west-2.amazonaws.com/PINO/data/cavity.mat',
Expand Down
10 changes: 7 additions & 3 deletions inference.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
'''
This code generates the prediction on one instance.
Both the ground truth and the prediction are saved in a .pt file.
'''
import os
import yaml
from argparse import ArgumentParser
import random

import torch
from torch.utils.data import DataLoader
Expand All @@ -17,7 +20,8 @@
def get_pred(args):
with open(args.config, 'r') as stream:
config = yaml.load(stream, yaml.FullLoader)

basedir = os.path.join('exp', config['log']['logdir'])
save_path = os.path.join(basedir, 'predictions','prediction.pt')
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')

# prepare data
Expand Down Expand Up @@ -55,7 +59,7 @@ def get_pred(args):
torch.save({
'truth': u.cpu(),
'pred': out.cpu(),
}, 're500-1_8s-800-fno-50k-prediction.pt')
}, save_path)
break


Expand Down

0 comments on commit b4fcb66

Please sign in to comment.