def eval_models(args: Argument): args.mode = 'test' dc, lc, tc, model_dir = get_config_list(args) modes = ['test'] dataloader = { 'test': get_trajectory_data_loader(dc, test=True, batch_size=args.bsize, num_workers=args.num_workers, shuffle=True) } run_every = {'test': 1} gn_wrapper = fetch_model_iterator(lc, args) trainer = train.Trainer(gn_wrapper, modes, dataloader, run_every, tc) output = trainer.eval(dataloader['test']) return trainer.num_iter, output
def train_model(args: Argument): args.mode = 'train' dc, lc, tc, _ = get_config_list(args) gn_wrapper = fetch_model_iterator(lc, args) modes = ['train', 'test'] dataloader = { m: get_trajectory_data_loader(dc, test=m == 'train', batch_size=args.bsize, num_workers=args.num_workers, shuffle=True) for m in modes } run_every = {'train': 1, 'test': args.test_every} trainer = train.Trainer(gn_wrapper, modes, dataloader, run_every, tc) train_winding = False train_trajectory = True trainer.train(train_winding, train_trajectory) trainer.save(train_winding, train_trajectory)