From 08fd1d3f426c30919842717268e6b022efdc5289 Mon Sep 17 00:00:00 2001 From: Chao Wang Date: Mon, 11 Apr 2022 20:58:28 -0400 Subject: [PATCH] update cli.py (#1008) * update cli.py update cli.py so that one can specify exp_manager uri in "qlib_init" and "experiment_name" in *.yaml file. * black cli.py * Resolving pre-commit-hook changes --- qlib/workflow/cli.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/qlib/workflow/cli.py b/qlib/workflow/cli.py index e0a925b41..25239d1f1 100644 --- a/qlib/workflow/cli.py +++ b/qlib/workflow/cli.py @@ -54,10 +54,15 @@ def workflow(config_path, experiment_name="workflow", uri_folder="mlruns"): # config the `sys` section sys_config(config, config_path) - exp_manager = C["exp_manager"] - exp_manager["kwargs"]["uri"] = "file:" + str(Path(os.getcwd()).resolve() / uri_folder) - qlib.init(**config.get("qlib_init"), exp_manager=exp_manager) + if "exp_manager" in config.get("qlib_init"): + qlib.init(**config.get("qlib_init")) + else: + exp_manager = C["exp_manager"] + exp_manager["kwargs"]["uri"] = "file:" + str(Path(os.getcwd()).resolve() / uri_folder) + qlib.init(**config.get("qlib_init"), exp_manager=exp_manager) + if "experiment_name" in config: + experiment_name = config["experiment_name"] recorder = task_train(config.get("task"), experiment_name=experiment_name) recorder.save_objects(config=config)