forked from lisiyao21/AnimeInbet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
47 lines (35 loc) · 1 KB
/
main.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
from inbetween import DraftRefine
import argparse
import os
import yaml
from pprint import pprint
from easydict import EasyDict
def parse_args():
parser = argparse.ArgumentParser(
description='Anime segment matching')
parser.add_argument('--config', default='')
# exclusive arguments
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument('--train', action='store_true')
group.add_argument('--eval', action='store_true')
group.add_argument('--gen', action='store_true')
return parser.parse_args()
def main():
# parse arguments and load config
args = parse_args()
with open(args.config) as f:
config = yaml.load(f)
for k, v in vars(args).items():
config[k] = v
pprint(config)
config = EasyDict(config)
agent = DraftRefine(config)
print(config)
if args.train:
agent.train()
elif args.eval:
agent.eval()
elif args.gen:
agent.gen()
if __name__ == '__main__':
main()