-
Notifications
You must be signed in to change notification settings - Fork 59
/
combo.py
50 lines (46 loc) · 1.32 KB
/
combo.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from tools.combine_tools import NaiveAndDiffModel
import argparse
def parse_args(args=None, namespace=None):
"""Parse command-line arguments."""
parser = argparse.ArgumentParser()
parser.add_argument(
"-model",
"--model",
type=str,
required=True,
help="path to the diffusion model checkpoint",
)
parser.add_argument(
"-nmodel",
"--naive_model",
type=str,
required=True,
help="path to the naive model checkpoint",
)
parser.add_argument(
"-d",
"--device",
type=str,
default="cpu",
required=False,
help="cpu or cuda, auto set cpu")
parser.add_argument(
"-exp",
"--exp",
type=str,
required=True,
help="path to the output dir",
)
parser.add_argument(
"-n",
"--name",
type=str,
required=True,
help="name for save combo model",
)
return parser.parse_args(args=args, namespace=namespace)
if __name__ == '__main__':
# parse commands
cmd = parse_args()
combo_model = NaiveAndDiffModel(diff_model_path=cmd.model, naive_model_path=cmd.naive_model, device=cmd.device)
combo_model.save_combo_model(save_path=cmd.exp, save_name=cmd.name)