HuggingFace Hub Deep Integration
Soup v0.29.0 closes the loop between training and the Hub. Every checkpoint can auto-push as a branch, training can resume from the Hub after a crash, models deploy to a Gradio Space in one command (Streamlit is deprecated since v0.78.0), and self-hosted Hubs are supported via HF_ENDPOINT.
Auto-push every checkpoint
soup train --push-as alpamys/chat-llamaEvery save_steps checkpoint is uploaded to HuggingFace Hub as a checkpoint-<N> branch. The main branch is updated only at training completion. A sticky _repo_failed flag means push failures (bad token, rate limit) short-circuit subsequent saves — no log spam, no training crash.
The upload uses an explicit allow_patterns allowlist (*.safetensors, *.bin, *.pt, *.json, tokenizer*, trainer_state.json, training_args.bin, README.md) — an output_dir that overlaps with your project root cannot accidentally publish .env or source files.
Visibility (v0.78.0, #2802). A repository that --push-as creates is private; add --push-public to create a public one. --push-public without --push-as is refused with exit 1 (--push-public requires --push-as <repo>: it sets the visibility of the repository --push-as creates, so it does nothing without it., run on the v0.78.0 binary, also with --dry-run). An existing repository is used as it is: Soup sends nothing that could change its visibility, and --push-public does not change it either. Before training Soup prints one line saying what happened: Created private Hub repository <repo>., Created public Hub repository <repo>. or Using existing Hub repository <repo> (private|public); its visibility is unchanged. If the Hub refuses to create the private repository (HTTP 402 or 403: a plan limit, or a token without permission to create it), auto-push is switched off for the run and the message says: --push-as: the Hub refused to create the private repository <repo> (HTTP 402 or 403: a plan limit, or a token without permission to create it). Auto-push is disabled for this run. Pass --push-public to create a public repository instead, or create <repo> yourself first and run again. Soup never retries as public on its own. Through v0.77.2 the callback created a missing repository public (its private default was False), so a script that relied on a public repository now creates a private one, and the Created private Hub repository line is the only notice: add --push-public. The visibility of a repository actually created was not run (it needs the Hub); the flag and message texts are from soup train --help and the code at the tag. soup train --cloud refuses --push-as since v0.78.0 (exit 2, see CLI reference).
Resume from the Hub
soup train --push-as alpamys/chat-llama --hf-resume--hf-resume pulls the latest checkpoint-<N> branch via snapshot_download, places it in output_dir (containment-checked against cwd), and resumes. local_dir_use_symlinks=False defeats symlink-based filesystem escapes on older huggingface_hub versions.
Use this when a spot GPU dies, a preemption kicks you off, or you want to migrate training between machines.
HF Collections
soup push --model ./output \
--repo alpamys/chat-llama \
--collection alpamys/kazakh-llms-abc123Adds the pushed repo to an existing HuggingFace Collection. The slug follows the owner/slug-hash regex; null bytes, whitespace, and .. are rejected. Max 256 chars.
Self-hosted Hub (HF_ENDPOINT)
HF_ENDPOINT=https://hf.internal.example.com soup train --push-as team/my-modelEvery HF operation routes to your internal Hub. SSRF hardening:
- Scheme allowlist (http/https only)
- Plain HTTP permitted only for loopback (
localhost/127.0.0.1/::1) 0.0.0.0explicitly rejected- Plain HTTP to any non-loopback host is rejected (a private, link-local or cloud-metadata address such as RFC1918, 169.254.x or
100.64.0.0/10gets the message that says to use HTTPS; since v0.75.2 that message also covers100.64.0.0/10). Over HTTPS the address is not checked: anhttps://endpoint naming a private IP is accepted, and the private-address refusal added in v0.75.2 does not cover this variable. Hostnames are never resolved - Null bytes rejected
Publish datasets
soup data push --input data.jsonl --hf-dataset alpamys/kazakh-chatUploads a local JSONL as a HuggingFace dataset repo. Input path must stay under cwd, repo_id is validated, and a token is resolved via the unified utils/hf.resolve_token chain. Commit messages are stripped to the first line and capped at 200 chars to prevent multi-line injection into public HF commit history.
Deploy to HF Spaces
soup deploy hf-space \
--model alpamys/chat-llama \
--space alpamys/chat-llama-demo \
--template gradio-chatCreates a Space wrapping your fine-tuned model. Use gradio-chat for a new Space: streamlit-chat still exists but is deprecated (see below). render_space_template validates model_repo via validate_repo_id before substituting into app.py / README.md — a crafted repo id cannot inject Python code into the deployed Space.
To use your own template, pass --template-dir <dir> instead of --template. The directory must contain app.py and README.md and may contain requirements.txt; every {MODEL_REPO} in those files is replaced with the validated --model value. The directory has to sit under the working directory, a template file that is a symlink is refused, and each file is capped at 256 KB. The Space SDK is picked from the requirements.txt: the first line naming streamlit or gradio decides it, and a template with neither, or with no requirements.txt, is a Gradio Space. There is no --sdk flag. --private creates the Space as private and --yes skips the confirmation prompt. The command needs a Hugging Face token (HF_TOKEN or a cached login) and exits 1 without one.
Hardware tier and ZeroGPU (v0.78.0, #2745, by @capyriver). --hardware <slug> asks the Hub for that hardware tier when the Space is created: a lowercase slug of at most 32 letters, digits and single hyphens (for example cpu-basic or zero-a10g). Anything else exits 1 with Invalid --hardware: expected a lowercase hardware slug of at most 32 letters, digits, and single hyphens., before any credential is read (run on the v0.78.0 binary). A slug that starts with zero- selects ZeroGPU, and the built-in gradio-chat app is then generated ZeroGPU-aware: import spaces, an @spaces.GPU decorator on the reply function, and spaces in requirements.txt. The built-in streamlit-chat template with a zero- tier exits 1 (ZeroGPU does not support the built-in streamlit-chat template; use --template gradio-chat., run). A --template-dir of your own is uploaded as it is, so it must carry the decorator itself. Which tiers exist, what they cost and who may request them are the Hub's rules, not Soup's. The request goes to the Hub as space_hardware on create_repo (exist_ok=True); whether a slug changes a Space that already exists is Hub behaviour this page does not claim either way.
Streamlit is deprecated (v0.78.0, #2834, by @capyriver). Hugging Face no longer creates new Streamlit Spaces, so --template streamlit-chat, and a custom folder whose requirements.txt names streamlit, print Deprecation warning (v0.78.0): Hugging Face no longer creates new Streamlit Spaces. Use the built-in gradio-chat template or a custom Gradio template. The warning comes after the token check, so with no token the command exits 1 on No HuggingFace token found. first. When the Hub then refuses the Streamlit SDK, Soup says so (Hugging Face no longer creates new Streamlit Spaces. Use --template gradio-chat instead.) and prints the Hub response; unrelated Hub errors are unchanged. Existing Streamlit Spaces stay deployable.
The built-in chat templates run since v0.78.0. Through v0.77.2 the chat message dictionaries in both built-in apps were written with doubled braces and the Space raised TypeError: unhashable type: 'dict' when it ran (#2652, #2657, by @capyriver), and the generated README metadata used a thumbnail colour Hugging Face did not accept (#2639, #2641, by @harshitthek). If you deployed a Space from gradio-chat or streamlit-chat on an earlier version, redeploy it. The rendered files are now published in one commit (Soup CLI: deploy Space files), so a rejected update leaves the files of an existing Space intact (#2648, #2649, by @harshitthek). Upstream did not run Hub writes before the release (its Known Limitations: Hub writes are never part of a smoke), and this site sent nothing to the Hub: the ZeroGPU app on a real Space, the deprecation path and the one-commit upload were read from the code and the changelog.
Model card v2
Generated READMEs now include:
- Training config: task, base model, learning rate, optimizer
- Optional eval scorecard from an
eval_results.json - HTML-escaped
data_lineageparameter - Markdown-active chars neutralized in task names and non-numeric score values (
|,[,],(,),!,<,>, newlines, tabs) — no table-row / link / image / raw-HTML injection in the rendered README
Token resolution
utils/hf.resolve_token is the single source of truth:
- Env:
HF_TOKENorHUGGINGFACE_HUB_TOKEN ~/.cache/huggingface/token~/.huggingface/token
Non-printable tokens are rejected. The legacy soup push --token flag now warns deprecated and delegates to this chain. Since v0.78.0 (#2792, reported by @baurvtm-stack, by @Izumx in #2918), with --hub hf the warning prints only when --token is typed on the command line, not when the token comes from HF_TOKEN, and the missing-token hint names HF_TOKEN and the login command instead of the deprecated flag; the other hubs keep --token in their hint.
repo_id validation
Applied to soup push --repo, soup train --push-as, soup data push --hf-dataset, soup deploy hf-space --model/--space:
- Alphanumeric +
._-only - Per-component ≤ 96 chars
- Total ≤ 200 chars
- Null-byte / whitespace /
../ leading-/rejection
Which downloads get the namespace pin
Soup keeps a local trust-on-first-use pin of a Hugging Face model repo's author and creation time (see Supply chain security). The check runs inside Soup's own hub download wrapper, utils/hubs.snapshot_download, and five paths reach it at v0.78.0 (the same five as at v0.77.0; a caller search at the tag found no new one, and the downloads added since, for native MLX, Kimi K2 and soup ship, call huggingface_hub.snapshot_download directly):
soup spectrum scan <hf-id>soup probe sae-diff --auto-download- the base model of a
stream_layers: truetraining run - a Hub id given as
training.prm_reward(org/name, optionally@revision), which v0.76.0 now downloads before training starts instead of failing at the first reward call (#1466); any other value that is not an existing directory under the working directory is refused - since v0.77.0,
soup merge --low-memorywhen--base(or the base recorded in the adapter) is a Hub id: it downloads the base's weight shards, its.jsonfiles and, since v0.78.0, the tokenizer and template files a local base would have (.model,.txt,.tiktoken,.jinja, and.pyonly with--trust-remote-code) through the wrapper (#2006, #2235); see Model Export
Everything else on this page does not go through it. --hf-resume calls huggingface_hub.snapshot_download directly, and an ordinary from_pretrained load (soup train without streaming, chat, serve, merge without --low-memory, export) is not pinned either. The pin fails open when the Hub metadata is missing or the pin store cannot be read.
Pinned to a commit is a different thing (v0.77.0). On the transformers backend, a resident, layer-streamed or multi-GPU soup train on a Hub base resolves the base's current commit once before its first load, loads every part of the base at that commit and records it; Unsloth loads, the non-Hugging-Face hubs, and local or cached-path bases are not bound (#1902); through v0.77.2 MLX loads were on that list (see the v0.78.0 paragraph below). See Experiment tracking for what it prints and records. Since v0.77.2 soup merge pins too (#2485): both of its paths, the regular one and --low-memory, load the base at the Hub commit recorded in the adapter's training provenance instead of the latest one, and print Base revision: <commit> (recorded run), or Base revision: unknown (legacy, local source or base override) and load as before. So the scope is the transformers backend: soup train, soup merge (new in v0.77.2), and the merge step of soup export to GGUF, which already read the recorded commit and print the same Base revision: line. Unsloth loads, other hubs and local or cached-path hints are not bound, and #1902 stays open for them. One consequence: with HF_HUB_OFFLINE set and that commit not in the cache, the merge now fails, where v0.77.1 merged whatever snapshot was cached. That is reproducibility, not the namespace pin: the pin checks who owns the repo, the revision records which commit was loaded.
Since v0.78.0 the binding also covers soup sweep and native MLX text training (#2671, #2884). Upstream's v0.78.0 Known Limitations list it as covering the transformers backend, soup merge, soup sweep and native MLX text training, and still not Unsloth loads or local and cached-path hints (#1902, partly fixed and still open). For MLX the scope is a single-process soup train on backend: mlx with a Hugging Face base: the RoPE configuration read, the model and the tokenizer load at one commit, and the run row and soup_run.json record it. A provider other than Hugging Face (ModelScope through mlx-lm), a distributed launch, offline mode, a local directory and a cache path are not bound and print Base revision: unknown (<reason>; existing loading behavior preserved). MLX sweeps and the MLX inference, chat, serve, merge and export paths are outside it. The MLX part was read from upstream's changelog and the code and was not run on Apple Silicon.
License migration
As of v0.29.0, Soup is Apache-2.0 (previously MIT). If you redistribute Soup or a modified copy, sections 4 and 6 of the licence apply: keep LICENSE and NOTICE with every copy, mark the files you changed, and do not use the Soup name beyond saying where the work comes from. Since v0.77.0 NOTICE reads Copyright 2026 Makazhan Alpamys and the Soup contributors, and pyproject.toml names both files as license-files instead of relying on the build tool's defaults.
See also
- Registry — track every pushed run locally
- Eval-gated training — catch regressions before pushing to the Hub
- CLI reference
Soup is free and Apache-2.0. If it saved you a training run, starring the repo costs nothing and helps most. You can also fund the GPU time behind the work a 4 GB laptop cannot reach.