rm dependency on .git; multi-gpu WIP; fine-grained time
This commit is contained in:
parent
53ddbbe0b1
commit
e0e04702cc
13
arguments.py
13
arguments.py
|
@ -71,9 +71,10 @@ def parse():
|
||||||
parser.add_argument('--resume', action='store_true', help='whether to resume training with past optimizers')
|
parser.add_argument('--resume', action='store_true', help='whether to resume training with past optimizers')
|
||||||
|
|
||||||
parser.add_argument('--seed', default=123, type=int, help='Random seed.')
|
parser.add_argument('--seed', default=123, type=int, help='Random seed.')
|
||||||
parser.add_argument('--gpus', nargs='+', type=int, help='gpus to use')
|
parser.add_argument('--gpus', nargs='+', type=int, help='a list of gpus that can be used for training (multi-gpu currently WIP)')
|
||||||
parser.add_argument('--backend', default='gloo', type=str, help='backend for distributed training')
|
parser.add_argument('--backend', default='gloo', type=str, help='backend for distributed training')
|
||||||
|
|
||||||
|
parser.add_argument('--no_commit', action='store_false', dest='commit', help='do not track the git commit associated with this training run')
|
||||||
parser.add_argument('--exist_ok', action='store_true', help='Ok if the save directory already exists, i.e. overwrite is ok')
|
parser.add_argument('--exist_ok', action='store_true', help='Ok if the save directory already exists, i.e. overwrite is ok')
|
||||||
parser.add_argument('--token_testing', action='store_true', help='if true, sorts all iterators')
|
parser.add_argument('--token_testing', action='store_true', help='if true, sorts all iterators')
|
||||||
parser.add_argument('--reverse', action='store_true', help='if token_testing and true, sorts all iterators in reverse')
|
parser.add_argument('--reverse', action='store_true', help='if token_testing and true, sorts all iterators in reverse')
|
||||||
|
@ -86,7 +87,10 @@ def parse():
|
||||||
if 'imdb' in args.val_tasks:
|
if 'imdb' in args.val_tasks:
|
||||||
args.val_tasks.remove('imdb')
|
args.val_tasks.remove('imdb')
|
||||||
args.world_size = len(args.gpus) if args.gpus[0] > -1 else -1
|
args.world_size = len(args.gpus) if args.gpus[0] > -1 else -1
|
||||||
args.timestamp = '-'.join(datetime.datetime.now(tz=tz.tzoffset(None, -8*60*60)).strftime("%y/%m/%d/%H/%M").split())
|
if args.world_size > 1:
|
||||||
|
print('multi-gpu training is currently a work in progress')
|
||||||
|
return
|
||||||
|
args.timestamp = '-'.join(datetime.datetime.now(tz=tz.tzoffset(None, -8*60*60)).strftime("%y/%m/%d/%H/%M/%S.%f").split())
|
||||||
|
|
||||||
if len(args.train_tasks) > 1:
|
if len(args.train_tasks) > 1:
|
||||||
if args.train_iterations is None:
|
if args.train_iterations is None:
|
||||||
|
@ -99,7 +103,10 @@ def parse():
|
||||||
args.val_batch_size = len(args.val_tasks) * args.val_batch_size
|
args.val_batch_size = len(args.val_tasks) * args.val_batch_size
|
||||||
|
|
||||||
# postprocess arguments
|
# postprocess arguments
|
||||||
args.commit = get_commit()
|
if args.commit:
|
||||||
|
args.commit = get_commit()
|
||||||
|
else:
|
||||||
|
args.commit = ''
|
||||||
train_out = f'{",".join(args.train_tasks)}'
|
train_out = f'{",".join(args.train_tasks)}'
|
||||||
if len(args.train_tasks) > 1:
|
if len(args.train_tasks) > 1:
|
||||||
train_out += f'{"-".join([str(x) for x in args.train_iterations])}'
|
train_out += f'{"-".join([str(x) for x in args.train_iterations])}'
|
||||||
|
|
9
train.py
9
train.py
|
@ -336,8 +336,10 @@ def init_opt(args, model):
|
||||||
return opt
|
return opt
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
def main():
|
||||||
args = arguments.parse()
|
args = arguments.parse()
|
||||||
|
if args is None:
|
||||||
|
return
|
||||||
set_seed(args)
|
set_seed(args)
|
||||||
logger = initialize_logger(args)
|
logger = initialize_logger(args)
|
||||||
logger.info(f'Arguments:\n{pformat(vars(args))}')
|
logger.info(f'Arguments:\n{pformat(vars(args))}')
|
||||||
|
@ -357,3 +359,8 @@ if __name__ == '__main__':
|
||||||
else:
|
else:
|
||||||
logger.info(f'Processing')
|
logger.info(f'Processing')
|
||||||
run(args, run_args, world_size=args.world_size)
|
run(args, run_args, world_size=args.world_size)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue