HUB
Sign inSign up
hf-cli logo

swaleio/hf-cli

By swaleio

•Updated 4 days ago

Hugging Face Hub CLI for Swale workflows. Backs the hf-download and hf-upload tasks.

Image
0

984

swaleio/hf-cli repository overview

⁠hf-cli

Swale-built image backing the hf-download and hf-upload task definitions. It wraps the Hugging Face CLI⁠ (hf) so a workflow can pull models/datasets into the shared workspace or push artifacts back to the Hub.

  • Base: python:3.13-slim
  • Installed: huggingface_hub[cli,hf_xet] (the hf CLI plus the Xet accelerated transfer backend), at the version pinned in requirements.txt⁠
  • User: non-root swale (uid 1000)
  • Hub cache — defaults to the CLI location under the home directory, which the platform mounts writable and per-task, so it is discarded with the task. INPUT_CACHE_DIR relocates it: a workspace path keeps the staged blobs for later downloads in the same run and keeps the staging copy off task scratch.
  • WORKDIR /mnt/workspace, ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

⁠Invocation

The task definition's exec.args are appended to the entrypoint as the hf command line, e.g. ["download", "${{inputs.repo}}", "--local-dir", "${{inputs.dest}}"]. The entrypoint then augments that command line from these inputs before running hf "$@":

Input envApplies toEffect
INPUT_INCLUDEdownloadComma-separated glob patterns; each becomes a repeated --include <glob>. Patterns are passed literally (no shell globbing).
INPUT_REVISIONallAppended as --revision <ref> to pin a branch, tag, or commit.
INPUT_CACHE_DIRallExported as HF_HOME when non-empty, moving the Hub cache off the per-task home directory.
INPUT_DESTdownloadThe full local path the caller chose for the download; emitted verbatim as the path output.
INPUT_PATH_IN_REPOuploadAppended as the trailing positional destination path inside the target repository.

⁠Output

After a successful download, the entrypoint appends

path=<dest>

to $WORKFLOW_TASK_OUTPUT, where <dest> is the full path from INPUT_DEST (the caller-supplied, required dest input). The consuming task must declare a path output. upload emits nothing.

⁠Tags

Each tag is the version of the Hugging Face Hub client (huggingface_hub) the image packages, such as 1.29.0. A rebuild that keeps that version, to pick up a fixed base image or wrapper, adds -r1, -r2, and so on. A tag is never reused; latest follows the newest publish.

⁠Building

From the repository root:

docker build -t swaleio/hf-cli:dev images/hf-cli

Merging a change under images/hf-cli publishes the image under its next tag; task definitions reference it by digest.


Built from images/hf-cli⁠ in the swaleio/task-definitions⁠ repository. For how a task definition references an image, see the task definition reference⁠ in the Swale documentation⁠.

The Dockerfile and entrypoint are covered by the MIT License⁠. The Hugging Face CLI is Apache-2.0-licensed.

This image also contains software from other projects, each under its own license. The license texts those projects ship are inside the image: /usr/share/doc/<package>/copyright for Debian packages, /usr/local/lib/python3.13/LICENSE.txt for Python itself and the *.dist-info directory of each Python package. Source code for its GPL and LGPL components:

  • Debian packages: https://snapshot.debian.org/package/<source-package>/<version>/
  • Python packages: https://pypi.org/project/<name>/<version>/#files

We also provide that source code on request: see Third-party software⁠.

Tag summary
Recent tags
Content type
Image
Digest
sha256:e9da92f8f…
Size
54.6 MB
Last updated
4 days ago
docker pull swaleio/hf-cli:latest