hf jobs run accepts local directories for volume mounts
Introduced 2026-07-03 · score 0.95
HOW TO USE IT
When a Job needs files from a local repository directory, pass that directory to `-v`; Hugging Face syncs it to the `jobs-artifacts` bucket and mounts it. For Python Jobs, use `sync_job_volume` to create a mountable volume.
hf jobs run -v ./<local-dir>:/<mount-path> <image> <command> [<args>...]hf jobs uv run -v ./<local-dir>:/<mount-path> <script.py> [<args>...]from huggingface_hub import run_uv_job, sync_job_volume
volume = sync_job_volume("./<local-dir>", "/<mount-path>")
run_uv_job("<script.py>", volumes=[volume])WHY THIS HELPS
Run a Job that needs files from a local repository directory mounted as a volume.
REQUIREMENTS AND LIMITATIONS
- Version: v1.22.0
- -v, --volume: Repeatable volume mount argument: `LOCAL_DIR:/MOUNT_PATH[:ro|:rw]`. The mount path is required and absolute. Local directory volumes default to read-only; `:rw` enables writes.
- sync_job_volume(source) (required): Local directory path to sync.
- sync_job_volume(mount_path) (required): Absolute mount path inside the Job container; must start with `/`.
- sync_job_volume(remote_name): Bucket subfolder name; defaults to a name derived from the source path and machine hostname.
- sync_job_volume(read_only): Defaults to `True`; set `False` to allow the Job to write to the bucket folder.
- sync_job_volume(namespace): Namespace owning the `jobs-artifacts` bucket; defaults to the current user's namespace. Use the same namespace as the Job.
- sync_job_volume(token): Access token; defaults to the locally saved token. `False` disables authentication.
- Prerequisite: Hugging Face Jobs require pre-paid credits for the user or organization.
- Prerequisite: Authenticate with Hugging Face; `sync_job_volume` uses the locally saved token by default.
- The local directory is synced to a `jobs-artifacts` bucket and mounted.
FIRST-PARTY EVIDENCE
- https://github.com/huggingface/huggingface_hub/releases/tag/v1.22.0
- https://huggingface.co/docs/huggingface_hub/main/en/guides/cli
- https://huggingface.co/docs/huggingface_hub/main/en/guides/jobs
- https://github.com/huggingface/huggingface_hub/blob/main/docs/source/en/package_reference/cli.md
- https://huggingface.co/docs/huggingface_hub/main/en/package_reference/hf_api
- https://github.com/huggingface/huggingface_hub/blob/main/docs/source/en/guides/cli.md
Check the installed version and the source before using it. Entry JSON