Skip to content
Closed
9 changes: 9 additions & 0 deletions .ci/scripts/test_torchao_huggingface_checkpoints.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ if [[ -z "${PYTHON_EXECUTABLE:-}" ]]; then
PYTHON_EXECUTABLE=python3
fi

# OSDC runners may expose a read-only shared HF cache at /mnt/hf_cache.
# Redirect hf downloads to a writable per-job cache before the first download.
HF_CACHE_ROOT="${RUNNER_TEMP:-/tmp}/hf_cache"
if [[ -z "${HF_HOME:-}" || "${HF_HOME}" == /mnt/hf_cache* ]]; then
export HF_HOME="${HF_CACHE_ROOT}"
fi
mkdir -p "${HF_HOME}" 2>/dev/null || export HF_HOME=/tmp/hf_cache
mkdir -p "${HF_HOME}"

MODEL_OUT=model.pte

# Hugging Face Hub revisions, pinned. On OSDC runners HF_HUB_CACHE is a read-only
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/trunk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,12 @@ jobs:
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
conda activate "${CONDA_ENV}"

# OSDC mounts HF_HOME read-only at /mnt/hf_cache; redirect to a writable dir
# (RUNNER_TEMP, or /tmp when RUNNER_TEMP isn't writable inside the container).
export HF_HOME="${RUNNER_TEMP:-/tmp}/hf_cache"
mkdir -p "${HF_HOME}" 2>/dev/null || export HF_HOME=/tmp/hf_cache
mkdir -p "${HF_HOME}"

PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh --build-tool cmake

if [[ "${{ matrix.backend }}" == "torchao" ]]; then
Expand Down