forked from mlcommons/GaNDLF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gandlf_optimizeModel
39 lines (33 loc) · 1.08 KB
/
gandlf_optimizeModel
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
32
33
34
35
36
37
38
39
#!usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
from GANDLF.cli import copyrightMessage, post_training_model_optimization
if __name__ == "__main__":
parser = argparse.ArgumentParser(
prog="GANDLF_OptimizeModel",
formatter_class=argparse.RawTextHelpFormatter,
description="Generate optimized versions of trained GaNDLF models.\n\n"
+ copyrightMessage,
)
parser.add_argument(
"-m",
"--model",
metavar="",
type=str,
help="Path to the model file (ending in '.pth.tar') you wish to optimize.",
required=True,
)
parser.add_argument(
"-c",
"--config",
metavar="",
type=str,
default=None,
required=False,
help="The configuration file (contains all the information related to the training/inference session).",
)
args = parser.parse_args()
if post_training_model_optimization(args.model, args.config):
print("Post-training model optimization successful.")
else:
print("Post-training model optimization failed.")