From 1d22ee56d30aa8ddab2dadb1fe8e242a777b215d Mon Sep 17 00:00:00 2001 From: Young Date: Sun, 25 Jul 2021 16:35:16 +0000 Subject: [PATCH] recorder support upload both raw file and directory --- qlib/workflow/recorder.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qlib/workflow/recorder.py b/qlib/workflow/recorder.py index 7edb0ebb9..1b391cbe2 100644 --- a/qlib/workflow/recorder.py +++ b/qlib/workflow/recorder.py @@ -299,7 +299,11 @@ class MLflowRecorder(Recorder): def save_objects(self, local_path=None, artifact_path=None, **kwargs): assert self.uri is not None, "Please start the experiment and recorder first before using recorder directly." if local_path is not None: - self.client.log_artifacts(self.id, local_path, artifact_path) + path = Path(local_path) + if path.is_dir(): + self.client.log_artifacts(self.id, local_path, artifact_path) + else: + self.client.log_artifact(self.id, local_path, artifact_path) else: temp_dir = Path(tempfile.mkdtemp()).resolve() for name, data in kwargs.items():