diff --git a/qlib/__init__.py b/qlib/__init__.py index 3989b3692..19a7e09af 100644 --- a/qlib/__init__.py +++ b/qlib/__init__.py @@ -249,6 +249,7 @@ def auto_init(**kwargs): except FileNotFoundError: init(**kwargs) else: + logger = get_module_logger("Initialization") conf_pp = pp / "config.yaml" with conf_pp.open() as f: conf = yaml.safe_load(f) @@ -263,7 +264,13 @@ def auto_init(**kwargs): # - The shared configure may be updated later and you don't want to copy it. # - You have some customized config. qlib_conf_path = conf.get("qlib_cfg", None) + + # merge the arguments qlib_conf_update = conf.get("qlib_cfg_update", {}) - init_from_yaml_conf(qlib_conf_path, **qlib_conf_update, **kwargs) - logger = get_module_logger("Initialization") + for k, v in kwargs.items(): + if k in qlib_conf_update: + logger.warning(f"`qlib_conf_update` from conf_pp is override by `kwargs` on key '{k}'") + qlib_conf_update.update(kwargs) + + init_from_yaml_conf(qlib_conf_path, **qlib_conf_update) logger.info(f"Auto load project config: {conf_pp}") diff --git a/qlib/workflow/task/collect.py b/qlib/workflow/task/collect.py index 467281666..13fcd0202 100644 --- a/qlib/workflow/task/collect.py +++ b/qlib/workflow/task/collect.py @@ -5,6 +5,7 @@ Collector module can collect objects from everywhere and process them such as merging, grouping, averaging and so on. """ +from libs.qlib.qlib.log import TimeInspector from typing import Callable, Dict, List from qlib.log import get_module_logger from qlib.utils.serial import Serializable @@ -190,7 +191,9 @@ class RecorderCollector(Collector): collect_dict = {} # filter records - recs = self.experiment.list_recorders(**self.list_kwargs) + + with TimeInspector.logt("Time to `list_recorders` in RecorderCollector"): + recs = self.experiment.list_recorders(**self.list_kwargs) recs_flt = {} for rid, rec in recs.items(): if rec_filter_func is None or rec_filter_func(rec):