|
25 | 25 | from __future__ import annotations |
26 | 26 |
|
27 | 27 | import asyncio |
| 28 | +import os |
28 | 29 | import tempfile |
29 | 30 | import uuid |
30 | | -import os |
31 | 31 | from pathlib import Path |
32 | 32 | from typing import Any |
33 | 33 | from typing import Mapping |
@@ -611,7 +611,10 @@ def evaluate( |
611 | 611 | loop = self._get_or_create_loop() |
612 | 612 | loop.run_until_complete(self.target_prompt.write_all(candidate)) |
613 | 613 |
|
614 | | - tmp_parent = Path(self.output_dir) / "tmp_batches" if getattr(self, "output_dir", None) else Path.cwd() / "tmp" / "optimizer_batches" |
| 614 | + if getattr(self, "output_dir", None): |
| 615 | + tmp_parent = Path(self.output_dir) / "tmp_batches" |
| 616 | + else: |
| 617 | + tmp_parent = Path.cwd() / "tmp" / "optimizer_batches" |
615 | 618 | tmp_parent.mkdir(parents=True, exist_ok=True) |
616 | 619 | with tempfile.TemporaryDirectory(dir=tmp_parent) as tmp: |
617 | 620 | tmp_path = Path(tmp) |
@@ -643,8 +646,14 @@ def evaluate( |
643 | 646 |
|
644 | 647 | outcome = loop.run_until_complete( |
645 | 648 | run_evaluator( |
646 | | - eval_dataset_path=os.path.relpath(evalset_path, Path.cwd()).replace("\\", "/"), |
647 | | - eval_metrics_path=os.path.relpath(metrics_path, Path.cwd()).replace("\\", "/"), |
| 649 | + eval_dataset_path=os.path.relpath( |
| 650 | + evalset_path, |
| 651 | + Path.cwd(), |
| 652 | + ).replace("\\", "/"), |
| 653 | + eval_metrics_path=os.path.relpath( |
| 654 | + metrics_path, |
| 655 | + Path.cwd(), |
| 656 | + ).replace("\\", "/"), |
648 | 657 | call_agent=self.call_agent, |
649 | 658 | callbacks=self.callbacks, |
650 | 659 | num_runs=self.num_runs, |
|
0 commit comments