-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopts.py
21 lines (15 loc) · 786 Bytes
/
opts.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import argparse
import config as c
def parse(args):
parser = argparse.ArgumentParser(prog=args[0])
parser.add_argument('-l', '--lr', default=c.lr, dest='lr', type=float)
parser.add_argument('-d', '--gamma', default=c.gamma, dest='gamma', type=float)
parser.add_argument('-b', '--batch_size', default=c.batch_size, dest='batch_size', type=int)
parser.add_argument('-n', '--n_iterations', default=c.n_its_per_epoch, dest='n_its_per_epoch', type=int)
parser.add_argument('-N', '--epochs', default=c.n_epochs, dest='n_epochs', type=int)
opts = parser.parse_args(args[1:])
c.lr = opts.lr
c.batch_size = opts.batch_size
c.gamma = opts.gamma
c.n_its_per_epoch = opts.n_its_per_epoch
c.n_epochs = opts.n_epochs