Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

Commit

Permalink
do a flatter level results path
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Friedowitz committed Apr 8, 2024
1 parent a40b369 commit 36d6b15
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions src/lm_buddy/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@
"LM_BUDDY_HOME",
str(Path.home() / ".lm_buddy"),
)

LM_BUDDY_RESULTS_PATH: str = os.getenv(
"LM_BUDDY_RESULTS",
f"{LM_BUDDY_HOME_PATH}/results",
)
6 changes: 3 additions & 3 deletions src/lm_buddy/jobs/evaluation/prometheus.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from lm_buddy.configs.huggingface import AutoTokenizerConfig
from lm_buddy.configs.jobs.prometheus import PrometheusJobConfig
from lm_buddy.constants import LM_BUDDY_HOME_PATH
from lm_buddy.constants import LM_BUDDY_RESULTS_PATH
from lm_buddy.jobs.asset_loader import HuggingFaceAssetLoader
from lm_buddy.jobs.common import EvaluationResult
from lm_buddy.preprocessing import format_dataset_with_prompt
Expand Down Expand Up @@ -161,8 +161,8 @@ def data_generator():
result_dataset = Dataset.from_generator(data_generator)

# Save dataset to disk
storage_path = config.evaluation.storage_path or LM_BUDDY_HOME_PATH
result_dataset_path = Path(storage_path) / "datasets" / config.name / "prometheus"
storage_path = config.evaluation.storage_path or LM_BUDDY_RESULTS_PATH
result_dataset_path = Path(storage_path) / config.name / "prometheus"
result_dataset.save_to_disk(result_dataset_path)

return result_dataset_path
Expand Down
6 changes: 3 additions & 3 deletions src/lm_buddy/jobs/evaluation/ragas.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from ragas.metrics import answer_relevancy, context_precision, context_recall, faithfulness

from lm_buddy.configs.jobs.ragas import RagasJobConfig
from lm_buddy.constants import LM_BUDDY_HOME_PATH
from lm_buddy.constants import LM_BUDDY_RESULTS_PATH
from lm_buddy.jobs.asset_loader import HuggingFaceAssetLoader
from lm_buddy.jobs.common import EvaluationResult
from lm_buddy.preprocessing import format_dataset_with_prompt
Expand Down Expand Up @@ -60,8 +60,8 @@ def run_eval(config: RagasJobConfig) -> Path:
result_dataset = Dataset.from_pandas(result.to_pandas())

# Save dataset to disk
storage_path = config.evaluation.storage_path or LM_BUDDY_HOME_PATH
result_dataset_path = Path(storage_path) / "datasets" / config.name / "ragas"
storage_path = config.evaluation.storage_path or LM_BUDDY_RESULTS_PATH
result_dataset_path = Path(storage_path) / config.name / "ragas"
result_dataset.save_to_disk(result_dataset_path)

return result_dataset_path
Expand Down

0 comments on commit 36d6b15

Please sign in to comment.