diff --git a/ppgan/utils/config.py b/ppgan/utils/config.py index 4ec02b14df863094891e405d7360358039d6ee68..c98e9fc26afa4f1204b28da25b60afc2dcee7f62 100644 --- a/ppgan/utils/config.py +++ b/ppgan/utils/config.py @@ -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 diff --git a/ppgan/utils/setup.py b/ppgan/utils/setup.py index c8c0c267d7d7596c058a073a72c390233d0f6e14..a439d3e4744064e47ad054b94108f520b677678f 100644 --- a/ppgan/utils/setup.py +++ b/ppgan/utils/setup.py @@ -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')