Skip to content

Commit 2d2ed2c

Browse files
authored
Set xet cache env var (#3194)
* set xet cache env var * style
1 parent 2ad0a8e commit 2d2ed2c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Copyright 2022 The HuggingFace Authors.
33

44
import logging
5+
import os
56
from pathlib import Path
67
from typing import Optional
78

@@ -39,9 +40,12 @@ def set_datasets_cache(self, cache_subdirectory: Optional[Path]) -> None:
3940
datasets.config.EXTRACTED_DATASETS_PATH = (
4041
datasets.config.HF_DATASETS_CACHE / datasets.config.EXTRACTED_DATASETS_DIR
4142
)
43+
4244
huggingface_hub.constants.HF_HUB_CACHE = str(cache_subdirectory / "hub")
45+
os.environ["HF_HUB_CACHE"] = str(cache_subdirectory / "hub")
4346
logging.debug(f"huggingface_hub cache set to: {huggingface_hub.constants.HF_HUB_CACHE}")
4447
huggingface_hub.constants.HF_XET_CACHE = str(cache_subdirectory / "xet")
48+
os.environ["HF_XET_CACHE"] = str(cache_subdirectory / "xet")
4549
logging.debug(f"huggingface_hub xet cache set to: {huggingface_hub.constants.HF_XET_CACHE}")
4650

4751
def pre_compute(self) -> None:

0 commit comments

Comments
 (0)