Example #1
0
def run(FLAGS, cfg):
    # init parallel environment if nranks > 1
    init_parallel_env()

    if FLAGS.enable_ce:
        set_random_seed(0)

    # build trainer
    trainer = Trainer(cfg, mode='train')

    # load weights
    trainer.load_weights(cfg.pretrain_weights, FLAGS.weight_type)

    # training
    trainer.train()
Example #2
0
def run(FLAGS, cfg):
    # init fleet environment
    if cfg.fleet:
        init_fleet_env()
    else:
        # init parallel environment if nranks > 1
        init_parallel_env()

    if FLAGS.enable_ce:
        set_random_seed(0)

    # build trainer
    trainer = Trainer(cfg, mode='train')

    # load weights
    if not FLAGS.slim_config:
        trainer.load_weights(cfg.pretrain_weights, FLAGS.weight_type)

    # training
    trainer.train(FLAGS.eval)
Example #3
0
def run(FLAGS, cfg):
    # init fleet environment
    if cfg.fleet:
        init_fleet_env()
    else:
        # init parallel environment if nranks > 1
        init_parallel_env()

    if FLAGS.enable_ce:
        set_random_seed(0)

    # build trainer
    trainer = Trainer(cfg, mode='train')

    # load weights
    if FLAGS.resume is not None:
        trainer.resume_weights(FLAGS.resume)
    elif 'pretrain_weights' in cfg and cfg.pretrain_weights:
        trainer.load_weights(cfg.pretrain_weights)

    # training
    trainer.train(FLAGS.eval)