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


Python config.process_config方法代码示例

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


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

示例1: main

# 需要导入模块: from utils import config [as 别名]
# 或者: from utils.config import process_config [as 别名]
def main():
    # capture the config path from the run arguments
    # then process the json configuration file
    try:
        args = get_args()
        config = process_config(args.config)
    except:
        print("missing or invalid arguments")
        exit(0)

    # create the experiments dirs
    create_dirs([config.callbacks.tensorboard_log_dir, config.callbacks.checkpoint_dir])

    print('Create the data generator.')
    data_loader = SimpleMnistDataLoader(config)

    print('Create the model.')
    model = SimpleMnistModel(config)

    print('Create the trainer')
    trainer = SimpleMnistModelTrainer(model.model, data_loader.get_train_data(), config)

    print('Start training the model.')
    trainer.train() 
开发者ID:Ahmkel,项目名称:Keras-Project-Template,代码行数:26,代码来源:main.py

示例2: main

# 需要导入模块: from utils import config [as 别名]
# 或者: from utils.config import process_config [as 别名]
def main():
    # capture the config path from the run arguments
    # then process the json configuration fill
    try:
        args = get_args()
        config = process_config(args.config)

        # create the experiments dirs
        create_dirs([config.callbacks.tensorboard_log_dir, config.callbacks.checkpoint_dir])

        print('Create the data generator.')
        data_loader = factory.create("data_loader."+config.data_loader.name)(config)

        print('Create the model.')
        model = factory.create("models."+config.model.name)(config)

        print('Create the trainer')
        trainer = factory.create("trainers."+config.trainer.name)(model.model, data_loader.get_train_data(), config)

        print('Start training the model.')
        trainer.train()

    except Exception as e:
        print(e)
        sys.exit(1) 
开发者ID:Ahmkel,项目名称:Keras-Project-Template,代码行数:27,代码来源:from_config.py

示例3: main

# 需要导入模块: from utils import config [as 别名]
# 或者: from utils.config import process_config [as 别名]
def main():
    # capture the config path from the run arguments
    # then process the json configration file
    try:
        args = get_args()
        config = process_config(args.config)

    except Exception as e:
        print("missing or invalid arguments", e)
        exit(0)
    tf.logging.set_verbosity(tf.logging.INFO)

    if args.stylize:
        evaluate(config, args.content, args.style)
    else:
        train(config) 
开发者ID:benbenlijie,项目名称:style_swap_tensorflow,代码行数:18,代码来源:main.py

示例4: main

# 需要导入模块: from utils import config [as 别名]
# 或者: from utils.config import process_config [as 别名]
def main():
    args = get_args()
    config = process_config(args.config)

    # create the experiments dirs
    create_dirs([config.cache_dir, config.model_dir,
        config.log_dir, config.img_dir])

    # logging to the file and stdout
    logger = get_logger(config.log_dir, config.exp_name)
    
    # fix random seed to reproduce results
    random.seed(config.random_seed)
    logger.info('Random seed: {:d}'.format(config.random_seed))

    if config.method in ['src', 'jigsaw', 'rotate']:
        model = AuxModel(config, logger)
    else:
        raise ValueError("Unknown method: %s" % config.method)

    src_loader, val_loader = get_train_val_dataloader(config.datasets.src)
    test_loader = get_test_dataloader(config.datasets.test)

    tar_loader = None
    if config.datasets.get('tar', None):
        tar_loader = get_target_dataloader(config.datasets.tar)

    if config.mode == 'train':
        model.train(src_loader, tar_loader, val_loader, test_loader)
    elif config.mode == 'test':
        model.test(test_loader) 
开发者ID:Jiaolong,项目名称:self-supervised-da,代码行数:33,代码来源:main.py

示例5: main

# 需要导入模块: from utils import config [as 别名]
# 或者: from utils.config import process_config [as 别名]
def main():
    # capture the config path from the run arguments
    # then process the json configuration file
    try:
        args = get_args()
        config = process_config(args.config)

    except:
        print("missing or invalid arguments")
        exit(0)

    # create the experiments dirs
    create_dirs([config.summary_dir, config.checkpoint_dir])
    # create tensorflow session
    sess = tf.Session()
    # create your data generator
    data = DataGenerator(config)
    
    # create an instance of the model you want
    model = ExampleModel(config)
    # create tensorboard logger
    logger = Logger(sess, config)
    # create trainer and pass all the previous components to it
    trainer = ExampleTrainer(sess, model, data, config, logger)
    #load model if exists
    model.load(sess)
    # here you train your model
    trainer.train() 
开发者ID:MrGemy95,项目名称:Tensorflow-Project-Template,代码行数:30,代码来源:example.py


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