Esempio n. 1
0
def run_transformer(args, config):
    from transformer.runner import Runner

    # mkdir
    if args.ckpdir == '':
        if args.name is None: args.name = 'run_' + str(random.randint(0, 999))
        ckpdir = os.path.join('result/result_transformer/', args.name)
    else:
        ckpdir = args.ckpdir
    if not os.path.exists(ckpdir):
        os.makedirs(ckpdir)
    copyfile(args.config, os.path.join(ckpdir, args.config.split('/')[-1]))
    if args.online_config is not None:
        copyfile(args.online_config,
                 os.path.join(ckpdir,
                              args.online_config.split('/')[-1]))

    # get dataloader
    if 'online' in config:
        dataloader = get_online_Dataloader(args, config, is_train=True)
    else:
        dataloader = get_dataloader(args, config)

    # train
    runner = Runner(args, config, dataloader, ckpdir)
    runner.set_model()
    runner.train()
Esempio n. 2
0
def run_apc(seed):
    from rnn.runner import Runner
    runner = Runner(seed, train=True)
    runner.train()