Skip to content

Commit

Permalink
Ensure data dir paths are absolute (#21)
Browse files Browse the repository at this point in the history
* fix dst given to shutil.copy

* make sure to resolve paths
  • Loading branch information
thesofakillers authored Nov 28, 2024
1 parent 636c7d2 commit 51ec2b6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def prepare(raw: Path, public: Path, private: Path):
# Replace index part of filename with new index
new_sample_name = re.sub(r"TRAIN\d+", f"TRAIN{idx}", sample.name)
new_sample = public / "train2" / new_sample_name
shutil.copy(sample, public / "train2" / new_sample)
shutil.copy(sample, new_sample)

answer_rows = [] # While we're at it, collect answers for the new test set
(public / "test2").mkdir(exist_ok=True, parents=True)
Expand Down
4 changes: 2 additions & 2 deletions mlebench/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
logger = get_logger(__name__)


DEFAULT_DATA_DIR = Path(user_cache_dir()) / "mle-bench" / "data"
DEFAULT_DATA_DIR = (Path(user_cache_dir()) / "mle-bench" / "data").resolve()


@dataclass(frozen=True)
Expand Down Expand Up @@ -73,7 +73,7 @@ def from_dict(data: dict) -> "Competition":

class Registry:
def __init__(self, data_dir: Path = DEFAULT_DATA_DIR):
self._data_dir = data_dir
self._data_dir = data_dir.resolve()

def get_competition(self, competition_id: str) -> Competition:
"""Fetch the competition from the registry."""
Expand Down

0 comments on commit 51ec2b6

Please sign in to comment.