-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path12_inspectModel.py
executable file
·31 lines (25 loc) · 1.14 KB
/
12_inspectModel.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
31
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
# -----------------------------------------------------------------------------
# Script parameters
# -----------------------------------------------------------------------------
parser = argparse.ArgumentParser(
description='Inspect model stored in a checkpoint',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument(
"--checkpoint", default="model.pt", help="name of the model checkpoint file")
args = parser.parse_args()
checkpoint = args.checkpoint
# -----------------------------------------------------------------------------
# Script execution
# -----------------------------------------------------------------------------
from cfno.training.pySDC import FourierNeuralOp
model = FourierNeuralOp(checkpoint=checkpoint)
print(f"Inspecting model saved in {checkpoint} ({model.epochs} epochs) ...")
print(" -- hyper-parameters :")
for key, val in model.modelConfig.items():
print(" "*4 + f" -- {key} : {val}")
print(" -- losses :")
print(f" -- train : {model.losses['model']['train']}")
print(f" -- valid : {model.losses['model']['valid']}")