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

Commit

Permalink
add lm-buddy home path
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Friedowitz committed Apr 8, 2024
1 parent cffc80c commit a40b369
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
7 changes: 7 additions & 0 deletions src/lm_buddy/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import os
from pathlib import Path

LM_BUDDY_HOME_PATH: str = os.getenv(
"LM_BUDDY_HOME",
str(Path.home() / ".lm_buddy"),
)
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,10 +17,10 @@

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.jobs.asset_loader import HuggingFaceAssetLoader
from lm_buddy.jobs.common import EvaluationResult
from lm_buddy.preprocessing import format_dataset_with_prompt
from lm_buddy.storage import DEFAULT_STORAGE_PATH
from lm_buddy.tracking.artifact_utils import (
ArtifactType,
build_directory_artifact,
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 DEFAULT_STORAGE_PATH
result_dataset_path = Path(storage_path) / config.name / "evaluation" / "prometheus"
storage_path = config.evaluation.storage_path or LM_BUDDY_HOME_PATH
result_dataset_path = Path(storage_path) / "datasets" / 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,10 +8,10 @@
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.jobs.asset_loader import HuggingFaceAssetLoader
from lm_buddy.jobs.common import EvaluationResult
from lm_buddy.preprocessing import format_dataset_with_prompt
from lm_buddy.storage import DEFAULT_STORAGE_PATH
from lm_buddy.tracking.artifact_utils import (
ArtifactType,
build_directory_artifact,
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 DEFAULT_STORAGE_PATH
result_dataset_path = Path(storage_path) / config.name / "evaluation" / "ragas"
storage_path = config.evaluation.storage_path or LM_BUDDY_HOME_PATH
result_dataset_path = Path(storage_path) / "datasets" / config.name / "ragas"
result_dataset.save_to_disk(result_dataset_path)

return result_dataset_path
Expand Down
7 changes: 0 additions & 7 deletions src/lm_buddy/storage.py

This file was deleted.

0 comments on commit a40b369

Please sign in to comment.