当前位置: 首页>>代码示例>>Python>>正文


Python main.train方法代码示例

本文整理汇总了Python中main.train方法的典型用法代码示例。如果您正苦于以下问题:Python main.train方法的具体用法?Python main.train怎么用?Python main.train使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在main的用法示例。


在下文中一共展示了main.train方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: import main [as 别名]
# 或者: from main import train [as 别名]
def main(_):
    config = flags.FLAGS
    if config.mode == "train":
        train(config)
    elif config.mode == "prepro":
        prepro(config)
    elif config.mode == "debug":
        config.num_steps = 2
        config.val_num_batches = 1
        config.checkpoint = 1
        config.period = 1
        train(config)
    elif config.mode == "test":
        test(config)
    else:
        print("Unknown mode")
        exit(0) 
开发者ID:HKUST-KnowComp,项目名称:R-Net,代码行数:19,代码来源:config.py

示例2: main

# 需要导入模块: import main [as 别名]
# 或者: from main import train [as 别名]
def main(_):
    config = flags.FLAGS
    if config.mode == "train":
        train(config)
    elif config.mode == "prepro":
        prepro(config)
    elif config.mode == "debug":
        config.num_steps = 2
        config.val_num_batches = 1
        config.checkpoint = 1
        config.period = 1
        train(config)
    elif config.mode == "test":
        test(config)
    else:
        print("Unknown mode, you must choose mode from [train/prepro/debug/test]")
        exit(0) 
开发者ID:l11x0m7,项目名称:Question_Answering_Models,代码行数:19,代码来源:config.py

示例3: main

# 需要导入模块: import main [as 别名]
# 或者: from main import train [as 别名]
def main(_):
    config = flags.FLAGS
    if config.mode == "train":
        train(config)
    elif config.mode == "prepro":
        prepro(config)
    elif config.mode == "debug":
        config.num_steps = 2
        config.val_num_batches = 1
        config.checkpoint = 1
        config.period = 1
        train(config)
    elif config.mode == "test":
        test(config)
    elif config.mode == "demo":
        demo(config)
    else:
        print("Unknown mode")
        exit(0) 
开发者ID:NLPLearn,项目名称:QANet,代码行数:21,代码来源:config.py

示例4: main

# 需要导入模块: import main [as 别名]
# 或者: from main import train [as 别名]
def main(_):
    config = flags.FLAGS
    os.environ["CUDA_VISIBLE_DEVICES"] = config.gpu  # 选择一块gpu
    if config.mode == "train":
        train(config)
    elif config.mode == "prepro":
        data_process.prepro(config)
    elif config.mode == "debug":
        config.num_steps = 2
        config.val_num_batches = 1
        config.checkpoint = 1
        config.period = 1
        train(config)
    elif config.mode == "test":
        test(config)
    elif config.mode == "examine":
        examine_dev(config)
    elif config.mode == "save_dev":
        save_dev(config)
    elif config.mode == "save_test":
        save_test(config)
    else:
        print("Unknown mode")
        exit(0) 
开发者ID:yuhaitao1994,项目名称:AIchallenger2018_MachineReadingComprehension,代码行数:26,代码来源:config.py

示例5: main

# 需要导入模块: import main [as 别名]
# 或者: from main import train [as 别名]
def main(_):
    config = flags.FLAGS
    os.environ["CUDA_VISIBLE_DEVICES"] = config.gpu  # 选择一块gpu
    if config.mode == "train":
        train(config)
    elif config.mode == "prepro":
        data_process_addAnswer.prepro(config)
    elif config.mode == "test":
        test(config)
    elif config.mode == "examine":
        examine_dev(config)
    elif config.mode == "save_dev":
        save_dev(config)
    elif config.mode == "save_test":
        save_test(config)
    else:
        print("Unknown mode")
        exit(0) 
开发者ID:yuhaitao1994,项目名称:AIchallenger2018_MachineReadingComprehension,代码行数:20,代码来源:config.py

示例6: main

# 需要导入模块: import main [as 别名]
# 或者: from main import train [as 别名]
def main(_):
    config = flags.FLAGS
    if config.mode == "get_vocab":
        get_vocab(config)
    elif config.mode == "prepare":
        prepare(config)
    elif config.mode == "train":
        train(config)
    elif config.mode == "train_rl":
        train_rl(config)
    elif config.mode == "train_qpp":
        train_qpp(config)
    elif config.mode == "train_qap":
        train_qap(config)
    elif config.mode == "train_qqp_qap":
        train_qqp_qap(config)
    elif config.mode == "test":
        test(config)
    else:
        print("Unknown mode")
        exit(0) 
开发者ID:ZhangShiyue,项目名称:QGforQA,代码行数:23,代码来源:config.py

示例7: run

# 需要导入模块: import main [as 别名]
# 或者: from main import train [as 别名]
def run(_):
    if config.mode == "train":
        train(config,device)
    elif config.mode == "preprocess":
        preproc(config)

    elif config.mode == "debug":
        config.epochs = 1
        config.batch_size = 3
        config.val_batch_size = 20
        config.checkpoint = 1
        config.period = 1
        train(config,device)
    elif config.mode == "test":
        pass
    elif config.mode == "dev":
        dev(config,device)
    else:
        print("Unknown mode")
        exit(0) 
开发者ID:InitialBug,项目名称:BiSET,代码行数:22,代码来源:config.py

示例8: main

# 需要导入模块: import main [as 别名]
# 或者: from main import train [as 别名]
def main(_):
    config = flags.FLAGS

    if config.mode == 'prepro':
        prepro(config)
    elif config.mode == 'train':
        train(config)
    elif config.mode == 'test':
        test(config)
    else:
        raise ValueError('The mode must choose from [prepro/train/test]!') 
开发者ID:l11x0m7,项目名称:Question_Answering_Models,代码行数:13,代码来源:config.py

示例9: train

# 需要导入模块: import main [as 别名]
# 或者: from main import train [as 别名]
def train():
    model_num, model_name = get_latest_model()
    print("Training on gathered game data, initializing from {}".format(model_name))
    new_model_name = shipname.generate(model_num + 1)
    print("New model will be {}".format(new_model_name))
    load_file = os.path.join(MODELS_DIR, model_name)
    save_file = os.path.join(MODELS_DIR, new_model_name)
    #try:
    main.train(ESTIMATOR_WORKING_DIR, TRAINING_CHUNK_DIR, save_file,
               generation_num=model_num + 1)
    #except:
    #    print("Got an error training, muddling on...")
    #    logging.exception("Train error")
    return new_model_name 
开发者ID:mlperf,项目名称:training_results_v0.5,代码行数:16,代码来源:loop_train_eval.py

示例10: rl_loop_train

# 需要导入模块: import main [as 别名]
# 或者: from main import train [as 别名]
def rl_loop_train():
    """Run the reinforcement learning loop

    This tries to create a realistic way to run the reinforcement learning with
    all default parameters.
    """
    qmeas.stop_time('selfplay_wait')
    print("Gathering game output...")
    gather()

    print("Training on gathered game data...")
    _, model_name = get_latest_model()
    new_model = train() 
开发者ID:mlperf,项目名称:training_results_v0.5,代码行数:15,代码来源:loop_train_eval.py

示例11: main

# 需要导入模块: import main [as 别名]
# 或者: from main import train [as 别名]
def main(_):
    config = flags.FLAGS
    if config.mode == "prepare":
        prepare(config)
    elif config.mode == "test":
        test(config)
    elif config.mode == "train":
        train(config)
    else:
        print("Unknown mode")
        exit(0) 
开发者ID:ZhangShiyue,项目名称:QGforQA,代码行数:13,代码来源:config.py

示例12: main

# 需要导入模块: import main [as 别名]
# 或者: from main import train [as 别名]
def main(_):
    config = flags.FLAGS
    if config.mode == "prepare":
        prepare(config)
    elif config.mode == "train":
        train(config)
    elif config.mode == "test":
        test(config)
    else:
        print("Unknown mode")
        exit(0) 
开发者ID:ZhangShiyue,项目名称:QGforQA,代码行数:13,代码来源:config.py


注:本文中的main.train方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。