-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.py
28 lines (22 loc) · 843 Bytes
/
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
import argparse
import importlib.util
from scripts.pretrain import pretrain
from scripts.finetune import finetune, update_finetune_config
def main(args):
spec = importlib.util.spec_from_file_location("config", args.config)
config = importlib.util.module_from_spec(spec)
spec.loader.exec_module(config)
if config.pretrain.state:
pretrain(config)
if config.finetune.state:
update_finetune_config(args, config)
finetune(config)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("config", type=str)
parser.add_argument('--resume', dest='resume', action='store_true')
parser.add_argument('--lr', type=float)
parser.add_argument('--device_idx', type=int)
parser.add_argument('--epochs', type=int)
args = parser.parse_args()
main(args)