Skip to content

Releases

v0.5.0

Choose a tag to compare

@github-actions github-actions released this 20 Nov 19:14

Mirrors that keep themselves up to date. This closes #1, the first feature request the project received.

Before you upgrade: this release changes the metadata database (schema version 4). The upgrade runs by itself at start and a v0.4.1 data directory needs nothing done to it, but v0.4.1 cannot open the database afterwards. Take a backup first if you might go back: modelctl backup now.

Keeping mirrors up to date

Until now a mirror was a snapshot: picking up a newer upstream revision meant running modelctl mirror again.

modelctl mirror openai-community/gpt2 --follow     # mirror it, and keep it up to date
modelctl serve --sync-interval 1h                  # check followed repositories every hour
modelctl sync openai-community/gpt2                # or check one now, for example from CI
modelctl follow list                               # what is followed, and when each last synced
  • When a followed branch moves upstream, the registry mirrors the new revision and moves the branch. Earlier revisions stay, so anything pinned to a revision id keeps getting exactly the same files. Only files that changed are downloaded.
  • A sync never removes anything. A branch or tag deleted upstream stays in the registry and is reported.
  • Only repositories that were mirrored or cached from upstream can be followed. One you pushed yourself is refused.
  • An upstream that keeps failing is retried less often, up to once a day, without holding up other repositories. A revision that fails verification is not recorded and the branch does not move.
  • --sync-interval (REGISTRY_SYNC_INTERVAL) is off unless set; the minimum is five minutes. POST /api/v1/repos/{repo}/sync is the call for a CI job or a webhook receiver.
  • Works for datasets with --repo-type dataset.

The operations guide has the details, including how this interacts with pull-through caching.

Mirror every branch and tag

modelctl mirror openai-community/gpt2 --all-refs

Copies every branch and tag the upstream reports, in one command, storing shared files once. Each ref's outcome is printed; refs that succeeded are kept if another fails. Add --follow to keep all of them up to date.

Tags stay tags

Mirroring an upstream tag by name used to record it as a local branch. It is now recorded as a tag, by modelctl mirror and by pull-through. A tag never moves in the registry: if the upstream has moved one since it was mirrored, the local tag stays where it is and the difference is reported.

Also new

  • Metrics for sync: checks, changes and failures by cause, repositories followed, and the age of the oldest successful check, with an alert for a followed repository that has stopped syncing.
  • A repository's page in the web UI shows whether it is followed, when it last synced, and the last error.
  • GET /api/v1/follows, and "all_refs": true on POST /api/v1/mirror.

Upgrade notes

  • The database upgrade is described at the top. A backup taken by v0.4.1 restores and is upgraded on start.
  • Databases written by earlier versions may hold branches that are tags upstream, from the behaviour fixed above. A sync reports such a name as a conflict and leaves it as it is; delete and re-mirror the repository if you want it corrected.
  • Mirroring or caching a repository by branch or tag name now makes one more small request to the upstream, to learn whether the name is a branch or a tag.

Full Changelog: v0.4.1...v0.5.0

v0.4.1

Choose a tag to compare

@github-actions github-actions released this 19 Nov 17:26

Datasets, a faster first download through the pull-through cache, and a metrics endpoint.

This is the first published release since v0.3.1. A v0.4.0 tag exists but nothing was published from it: it did not compile for 32-bit ARM, which stopped the release at the image build. v0.4.1 is that release with the fix.

Before you upgrade: this release changes the metadata database (schema version 3). The upgrade runs by itself at start and a v0.3.1 data directory needs nothing done to it, but v0.3.1 cannot open the database afterwards. Take a backup first if you might go back: modelctl backup now.

Datasets

Dataset repositories work everywhere model repositories do: mirror them, cache them on demand, push, pull, upload and serve them.

modelctl mirror --repo-type dataset stanfordnlp/imdb
export HF_ENDPOINT=http://localhost:8080
python -c "from datasets import load_dataset; print(load_dataset('stanfordnlp/imdb'))"
  • snapshot_download(repo_type="dataset"), hf download --repo-type dataset, dataset_info, list_repo_tree, get_paths_info and uploads are tested against the real huggingface_hub.
  • load_dataset("org/name") is tested with the real datasets library, including against datasets mirrored from huggingface.co in the two common layouts (split files at the top level, and configuration directories declared in the dataset card). Other layouts are expected to work but are not tested.
  • The Hub's dataset viewer (parquet conversion, row previews) is not implemented; the library falls back to the repository's own files. See Datasets, including a note on the datasets-server. host name the library derives from HF_ENDPOINT.
  • A model and a dataset of the same name are two repositories.
  • modelctl mirror, push, pull, list, inspect and delete take --repo-type dataset. The REST API has /api/v1/datasets/... beside /api/v1/repos/....
  • In the pull-through allow list a dataset is matched as datasets/namespace/name, so acme/* still means models only.

Pull-through: the first download no longer waits

Until now the first download of a file the registry did not hold waited until the whole file had been fetched and verified, which is longer than Hugging Face clients wait for a large file. Now the file is sent to the clients waiting for it while it is being fetched.

  • The end of the file is held back until the whole of it has matched its digest. A mismatch cuts the download short, so a client cannot end up with a complete file that failed verification. Nothing unverified is ever stored.
  • Files of 1 MiB or less are still sent only after verification.
  • --pull-through-stream=false (REGISTRY_PULL_THROUGH_STREAM) restores the previous behaviour.
  • What this changes about the guarantee for that first request, and the remaining risks, are in the operations guide.

Monitoring

GET /metrics is a Prometheus endpoint: cache hits against upstream fetches, pull-through failures by cause, the fetch queue, uploads and mirrors, what is stored, and the age of the last backup. No metric names a repository, a file or a token. It follows read access. The operations guide lists every metric, with a scrape configuration and three alerts.

Also new

  • get_paths_info (POST /api/{models,datasets}/{repo}/paths-info/{rev}), which HfFileSystem uses, and file sizes in model_info and dataset_info when asked with files_metadata=True.
  • Security reports can be sent to security@model.delivery as well as through GitHub.
  • Release archives carry a signed build attestation, and the image carries build provenance and an SBOM. Base images are pinned by digest. Verifying a release.
  • Alternatives: other open-source projects in this space, and when one of them is the better choice.

Fixed

  • modelctl pull no longer fails on every retry when a partial file is stale or the server ignores a resume request; it discards the partial and downloads the file afresh.
  • A stored file that could not be removed from storage during delete or gc keeps its record, so a later gc retries it. Counts and bytes freed report only what was actually removed.
  • --backup-keep N keeps exactly N, and backup names are never reused, however many are taken in one second.

Upgrade notes

  • The database upgrade is described at the top. A backup taken by v0.3.1 restores and is upgraded on start.
  • datasets and metrics are now reserved and cannot be used as a namespace for new repositories. An existing repository under either name stays readable and can be deleted, but takes no new revisions.
  • The test suite now runs against huggingface_hub 2.4 and datasets 5.2.
  • The tenth and later backups taken within one second are named registry-<time>_a10.db and so on, so that names sort in the order taken.

Full Changelog: v0.3.1...v0.4.1

v0.3.1

Choose a tag to compare

@github-actions github-actions released this 19 Nov 01:27

Security fixes and a clean-up of the code after a security audit and a code-quality audit of v0.3.0. No critical or high severity issues were found. Upgrading is recommended, especially if pull-through caching is on.

Security

  • Pull-through no longer adds upstream content to repositories created locally. A repository created by modelctl push, hf upload or the API never goes to the upstream hub, so someone who registers the same name upstream cannot add branches or revisions to it. For names the registry does not hold at all, use --pull-through-allow to keep internal namespaces from being fetched.
  • Request bodies are bounded in size and time. An unauthenticated client could make the server write large files to its temporary directory through the web sign-in form.
  • Pull-through is bounded. At most 64 fetches wait (beyond that the answer is 503 with Retry-After), revisions are validated before the upstream is asked, and --pull-through-max-file-bytes optionally limits file size.
  • The upstream token is only sent to the configured upstream host, and redirects or pagination links to loopback, private or link-local addresses are refused.
  • A signed upload URL stops working when the token that obtained it is revoked or loses the write role.
  • The database file is created owner-only (0600) on Linux and macOS.
  • Files the upstream keeps in git are only reused from content that was itself mirrored.
  • modelctl pull stops at the listed size, and file paths containing control characters are refused on write.

New

  • modelctl verify re-hashes stored files and reports any that are missing or damaged. See the operations guide for the repair steps.
  • A flag for every non-secret server setting, for example --backup-interval, --s3-bucket and --pull-through-allow. The environment variables still work; secrets remain environment-only.
  • --max-blob-bytes optionally limits the size of an uploaded file.

Fixed

  • REGISTRY_REQUIRE_AUTH=yes (and on) left downloads open, because only true and 1 were understood. yes, no, on and off are now accepted, and an unrecognised value stops the server from starting.
  • modelctl restore --replace keeps the old database's write-ahead log with the old database, and a failed restore puts the old database back.
  • Two backups taken in the same second no longer overwrite each other.
  • A file that finished fetching at the wrong moment could briefly be reported as missing (404).
  • Background fetches and scheduled backups are stopped and waited for at shutdown, before the database closes.
  • A local failure during pull-through is reported as 500 with a generic message, not as an upstream failure that included a server path. A failing upstream during a mirror is now 502 with the reason.
  • A database failure is no longer reported as "already exists" or as a bad token.
  • modelctl token create could print an empty token and exit 0 if the answer could not be read.
  • File listings no longer wait behind large downloads in pull-through.

Upgrade notes

Nothing in the data directory changes, and a v0.3.0 data directory opens as it is. Things you may notice:

  • An unrecognised value in a boolean setting (REGISTRY_REQUIRE_AUTH, REGISTRY_REQUIRE_ADMIN_TOKEN, REGISTRY_PULL_THROUGH, REGISTRY_S3_REDIRECT, REGISTRY_RESTORE_IF_EMPTY) now stops start-up with a message naming the setting.
  • The example compose.yaml publishes the port on 127.0.0.1 only; change the port mapping to expose it.
  • A supplied admin token shorter than 32 characters logs a warning at start. It still works.
  • Mirroring from another registry that redirects downloads to a bucket on a private address is refused; turn REGISTRY_S3_REDIRECT off on the source registry.
  • GET /api/v1/backups/snapshot is the address for a snapshot; the v0.3.0 address GET /api/v1/backup/snapshot still works.
  • delete, gc and backup now answers can carry a warning field.

Full Changelog: v0.3.0...v0.3.1

v0.3.0

Choose a tag to compare

@github-actions github-actions released this 18 Nov 20:15

Full Changelog: v0.2.0...v0.3.0

v0.2.0

Choose a tag to compare

@github-actions github-actions released this 18 Nov 19:36

Full Changelog: v0.1.0...v0.2.0

v0.1.0

Choose a tag to compare

@github-actions github-actions released this 18 Nov 17:35