Sign inSign up

swaleio/hf-cli

By swaleio

•Updated about 2 months ago

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

Image
0

428

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)
  • 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.

⁠Building

From the repository root:

docker build -t docker.io/swaleio/hf-cli:1.0.0 images/hf-cli

CI pins the real base digest and publishes the image; task definitions reference it as docker.io/swaleio/hf-cli@sha256:<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 software this image packages keeps its own licenses, which ship inside the image.

Tag summary

Content type

Image

Digest

sha256:62c02b3e1…

Size

54 MB

Last updated

about 2 months ago

docker pull swaleio/hf-cli