Skip to content

Commit 2ad0a8e

Browse files
authored
Set xet cache dir (#3192)
set xet cache dir
1 parent 779164c commit 2ad0a8e

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

services/worker/src/worker/job_runners/_job_runner_with_datasets_cache.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ def set_datasets_cache(self, cache_subdirectory: Optional[Path]) -> None:
4141
)
4242
huggingface_hub.constants.HF_HUB_CACHE = str(cache_subdirectory / "hub")
4343
logging.debug(f"huggingface_hub cache set to: {huggingface_hub.constants.HF_HUB_CACHE}")
44+
huggingface_hub.constants.HF_XET_CACHE = str(cache_subdirectory / "xet")
45+
logging.debug(f"huggingface_hub xet cache set to: {huggingface_hub.constants.HF_XET_CACHE}")
4446

4547
def pre_compute(self) -> None:
4648
super().pre_compute()

services/worker/tests/job_runners/test__job_runner_with_datasets_cache.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def test_set_datasets_cache(app_config: AppConfig, get_job_runner: GetJobRunner)
7777
job_runner.set_datasets_cache(dummy_path)
7878
assert datasets.config.HF_DATASETS_CACHE.is_relative_to(dummy_path)
7979
assert Path(huggingface_hub.constants.HF_HUB_CACHE).is_relative_to(dummy_path)
80+
assert Path(huggingface_hub.constants.HF_XET_CACHE).is_relative_to(dummy_path)
8081

8182

8283
def test_pre_compute_post_compute(app_config: AppConfig, get_job_runner: GetJobRunner) -> None:
@@ -100,9 +101,11 @@ def assert_datasets_cache_path(path: Optional[Path], exists: bool) -> None:
100101
if exists:
101102
datasets_cache_path = path / "datasets"
102103
hub_cache_path = path / "hub"
104+
xet_cache_path = path / "xet"
103105
assert datasets.config.HF_DATASETS_CACHE == datasets_cache_path
104106
assert (
105107
datasets.config.DOWNLOADED_DATASETS_PATH == datasets_cache_path / datasets.config.DOWNLOADED_DATASETS_DIR
106108
)
107109
assert datasets.config.EXTRACTED_DATASETS_PATH == datasets_cache_path / datasets.config.EXTRACTED_DATASETS_DIR
108110
assert huggingface_hub.constants.HF_HUB_CACHE == str(hub_cache_path)
111+
assert huggingface_hub.constants.HF_XET_CACHE == str(xet_cache_path)

0 commit comments

Comments
 (0)