From c8f9e1b76c19af0c3c9bcd12398fe0c6721fe84b Mon Sep 17 00:00:00 2001 From: tstadel <60758086+tstadel@users.noreply.github.com> Date: Thu, 9 Jun 2022 19:26:12 +0200 Subject: [PATCH] Create target folder if not exists in EvalResult.save() (#2647) * Create target folder if not exists in EvalResult.save() * log out dir --- haystack/schema.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/haystack/schema.py b/haystack/schema.py index 80722bea9..429b0542d 100644 --- a/haystack/schema.py +++ b/haystack/schema.py @@ -1245,6 +1245,9 @@ class EvaluationResult: :param out_dir: Path to the target folder the csvs will be saved. """ out_dir = out_dir if isinstance(out_dir, Path) else Path(out_dir) + logger.info(f"Saving evaluation results to {out_dir}") + if not out_dir.exists(): + out_dir.mkdir(parents=True) for node_name, df in self.node_results.items(): target_path = out_dir / f"{node_name}.csv" df.to_csv(target_path, index=False, header=True)