mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-10 22:36:55 +08:00
solve init kwargs conflictions
This commit is contained in:
@@ -249,6 +249,7 @@ def auto_init(**kwargs):
|
|||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
init(**kwargs)
|
init(**kwargs)
|
||||||
else:
|
else:
|
||||||
|
logger = get_module_logger("Initialization")
|
||||||
conf_pp = pp / "config.yaml"
|
conf_pp = pp / "config.yaml"
|
||||||
with conf_pp.open() as f:
|
with conf_pp.open() as f:
|
||||||
conf = yaml.safe_load(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.
|
# - The shared configure may be updated later and you don't want to copy it.
|
||||||
# - You have some customized config.
|
# - You have some customized config.
|
||||||
qlib_conf_path = conf.get("qlib_cfg", None)
|
qlib_conf_path = conf.get("qlib_cfg", None)
|
||||||
|
|
||||||
|
# merge the arguments
|
||||||
qlib_conf_update = conf.get("qlib_cfg_update", {})
|
qlib_conf_update = conf.get("qlib_cfg_update", {})
|
||||||
init_from_yaml_conf(qlib_conf_path, **qlib_conf_update, **kwargs)
|
for k, v in kwargs.items():
|
||||||
logger = get_module_logger("Initialization")
|
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}")
|
logger.info(f"Auto load project config: {conf_pp}")
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
Collector module can collect objects from everywhere and process them such as merging, grouping, averaging and so on.
|
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 typing import Callable, Dict, List
|
||||||
from qlib.log import get_module_logger
|
from qlib.log import get_module_logger
|
||||||
from qlib.utils.serial import Serializable
|
from qlib.utils.serial import Serializable
|
||||||
@@ -190,7 +191,9 @@ class RecorderCollector(Collector):
|
|||||||
|
|
||||||
collect_dict = {}
|
collect_dict = {}
|
||||||
# filter records
|
# 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 = {}
|
recs_flt = {}
|
||||||
for rid, rec in recs.items():
|
for rid, rec in recs.items():
|
||||||
if rec_filter_func is None or rec_filter_func(rec):
|
if rec_filter_func is None or rec_filter_func(rec):
|
||||||
|
|||||||
Reference in New Issue
Block a user