Skip to content

Fix CUDA CI: HF writes fail on read-only /mnt/hf_cache (HF_TOKEN + writable HF_HOME)#20782

Merged
Gasoonjia merged 4 commits into
mainfrom
fix-cuda-ci-hf-token
Jul 8, 2026
Merged

Fix CUDA CI: HF writes fail on read-only /mnt/hf_cache (HF_TOKEN + writable HF_HOME)#20782
Gasoonjia merged 4 commits into
mainfrom
fix-cuda-ci-hf-token

Conversation

@Gasoonjia

@Gasoonjia Gasoonjia commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Since pytorch/pytorch#188654 (landed 2026-07-03), the OSDC runner fleet mounts a shared, read-only HuggingFace cache at /mnt/hf_cache and defaults HF_HOME to it (to share a pre-seeded, S3-backed model cache). executorch's CUDA jobs were never adapted, so every HF write now lands on the read-only mount and fails:

OSError: [Errno 30] Read-only file system: '/mnt/hf_cache/...'

This broke the CUDA CI (export-model-cuda-artifact, benchmark-cuda, export-model-cuda-windows-artifact, test-cuda-pybind) starting Jul 3. pytorch/pytorch updated its own workflows in the same PR (use the read-only mount only in TRANSFORMERS_OFFLINE mode, otherwise download into a writable ${RUNNER_TEMP}/hf_cache); this PR does the equivalent for executorch.

@pytorch-bot

pytorch-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/20782

Note: Links to docs will display an error until the docs builds have been completed.

❌ 3 New Failures

As of commit 3d7cf15 with merge base 6018283 (image):

NEW FAILURES - The following jobs have failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 8, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

…cache)

The CUDA export/benchmark jobs on main fail in the Setup Huggingface step:

  + hf auth login --token ***
  Token is valid (permission: read).
  OSError: [Errno 30] Read-only file system: '/mnt/hf_cache/stored_tokens'

The token itself is valid. hf auth login validates it, then tries to persist
it to HF_HOME (which these ARC/k8s runners point at the read-only /mnt/hf_cache
mount) and crashes, so the job exits non-zero.

Replace 'hf auth login --token' with 'export HF_TOKEN' in the CUDA workflows
(cuda.yml x2, cuda-perf.yml, cuda-windows.yml). huggingface_hub and
transformers read HF_TOKEN directly, so authentication works without writing a
token file to the read-only cache.
@Gasoonjia Gasoonjia force-pushed the fix-cuda-ci-hf-token branch from a0fc49e to 415786e Compare July 8, 2026 05:35
@Gasoonjia Gasoonjia requested a review from digantdesai July 8, 2026 05:35
@Gasoonjia Gasoonjia changed the title Fix CUDA CI: use HF_TOKEN env instead of hf auth login (read-only HF cache mount) Fix CUDA CI: HF writes fail on read-only /mnt/hf_cache (HF_TOKEN + writable HF_HOME) Jul 8, 2026
OSDC runners now mount a shared, read-only HF cache at /mnt/hf_cache and
default HF_HOME to it. executorch's CUDA jobs write to the HF cache (token,
model + tokenizer downloads via hf_hub_download / snapshot_download / optimum),
so they now fail with:

  OSError: [Errno 30] Read-only file system: '/mnt/hf_cache/...'

Point HF_HOME at a writable ${RUNNER_TEMP}/hf_cache at the top of each CUDA
export/benchmark script (before the parakeet/dinov2 paths that skip the HF
setup block but still call hf_hub_download).
test-model-cuda-e2e (cuda.yml) and benchmark-cuda (cuda-perf.yml) run
.ci/scripts/test_model_e2e.sh, which downloads a sample dataset via
datasets.load_dataset -> hf_hub_download, writing to the HF cache. They were
missing the HF_HOME redirect, so they still failed with:

  OSError: [Errno 30] Read-only file system: '/mnt/hf_cache/hub/datasets--...'

Set the writable HF_HOME in these two jobs too.
The cuda-windows export job runs via 'docker exec' on an EC2 runner, where
RUNNER_TEMP (/home/ec2-user/.../_work/_temp) is not writable inside the
container, so 'mkdir -p ${RUNNER_TEMP}/hf_cache' fails with Permission denied.
ARC pods (the other CUDA jobs) can write RUNNER_TEMP. Try RUNNER_TEMP first and
fall back to /tmp/hf_cache when it isn't writable, so the writable HF_HOME
redirect works in both infra types.
@Gasoonjia Gasoonjia merged commit 477d278 into main Jul 8, 2026
341 of 344 checks passed
@Gasoonjia Gasoonjia deleted the fix-cuda-ci-hf-token branch July 8, 2026 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/cuda CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants