Skip to content

Commit

Permalink
update cli.py (#1008)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
wan9c9 authored Apr 12, 2022
1 parent defd675 commit 08fd1d3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions qlib/workflow/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 08fd1d3

Please sign in to comment.