未验证 提交 5f9c92e3 编写于 作者: L LielinJiang 提交者: GitHub

format config (#714)

上级 96551765
......@@ -124,3 +124,13 @@ def get_config(fname, overrides=None, show=True):
override_config(config, overrides)
return config
def cfg2dict(cfg):
if isinstance(cfg, AttrDict):
cfg = dict(cfg)
for k in cfg.keys():
if isinstance(cfg[k], AttrDict):
cfg[k] = cfg2dict(cfg[k])
return cfg
\ No newline at end of file
......@@ -14,12 +14,13 @@
import os
import time
import yaml
import paddle
import numpy as np
import random
from .config import cfg2dict
from .logger import setup_logger
def setup(args, cfg):
if args.evaluate_only:
cfg.is_train = False
......@@ -39,7 +40,7 @@ def setup(args, cfg):
logger = setup_logger(cfg.output_dir)
logger.info('Configs: {}'.format(cfg))
logger.info('Configs: \n{}'.format(yaml.dump(cfg2dict(cfg))))
if paddle.is_compiled_with_cuda():
paddle.set_device('gpu')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册