Fine-tune LLMs from one YAML. Layer streaming trains an 8B model on a 4 GB laptop GPU.
Python cliconsumer-gpudpofine-tuningggufhuggingfacellmllmopslocal-ailocal-llmloralow-vrammachine-learningollamapeftpythonpytorchqlorasfttransformers
docs: credit four merged contributions (#1963)
Alpamys Makazhan6f4e4381bfbc
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.mdindex a8670967..2d6dba36 100644--- a/CONTRIBUTORS.md+++ b/CONTRIBUTORS.md@@ -232,6 +232,7 @@ Listed by first contribution. PR numbers link the work.- Closed #1406: `training.citation_faithful: true` loaded on `task: pretrain`, whose trainer never reads it, so the citation-span weights were silently not applied. They narrowed the compat validator to `task: sft` with a refusal that names the field, the task and the way out, updated `docs/training.md`, and flipped the old `test_citation_faithful_on_pretrain_accepted`, which had pinned the bug, rather than deleting it. The pretrain-refusal test and the flipped one fail on `main` and pass; 7 of 7 validator mutations killed, and all 170 recipes, 21 packaged templates and 8 example configs still load ([#1406](https://github.com/MakazhanAlpamys/Soup/issues/1406), [#1843](https://github.com/MakazhanAlpamys/Soup/pull/1843))- Fixed #1910: a judge task with an empty or whitespace-only prompt file scored 0.0 without judging anything, so it could pass the gate at threshold 0 or mint a baseline. They made `_run_judge_task` raise a `ValueError` naming the file and task, which `run_gate`'s no-score path turns into a closed failure with no baseline written; measured scores keep their behaviour. 30 tests, 20 failing on main; 3 mutants killed ([#1910](https://github.com/MakazhanAlpamys/Soup/issues/1910), [#1928](https://github.com/MakazhanAlpamys/Soup/pull/1928))- Fixed #1819: judge and generation HTTP calls read whole response bodies without a limit. They added `utils/http_response.py`, a streamed reader whose budget counts decoded bytes, with a `Content-Length` pre-check and the stream closed on overflow (judge cap 1 MiB, generation and Magpie 8 MiB); errors name the cap and never a body or key, provider error logs drop bodies, and Magpie drops an oversized sample within its attempt bound. **The part worth copying is the read ratchet over `httpx.post`/`httpx.get`**, which makes the next unbounded read fail a test. 61 new tests; five mutation families (decoded-budget check, `Content-Length` check, judge cap x10, Magpie re-raise, a new unbounded read) each fail named tests ([#1819](https://github.com/MakazhanAlpamys/Soup/issues/1819), [#1929](https://github.com/MakazhanAlpamys/Soup/pull/1929))+ - Made custom-eval JSONL errors name the `scoring` field and physical line for non-string values, before model loading or result writes ([#1900](https://github.com/MakazhanAlpamys/Soup/issues/1900), [#1926](https://github.com/MakazhanAlpamys/Soup/pull/1926))- **AmixDigital** ([@Amix29](https://github.com/Amix29))- Gave `soup monitor` a real Apple Silicon path, where it had reported nothing but an NVIDIA-shaped blank since v0.44.1. The security work is the part worth naming: fixed absolute executable paths so `PATH` cannot influence what runs, `sudo -n` that never prompts and never reads a password, stderr pattern-matched for permission markers but never printed, and a parser that returns `[]` against a billion-laughs entity bomb, an XXE `file:///` reference, 5,000-deep nesting and embedded NUL bytes. **Three guards had no test holding them up and they closed all three in twenty minutes** — most importantly the call site that decides which implementation every Linux and Windows user gets, where `if True or detect_apple_silicon()` had left 126 tests passing. Their oversize-payload test had also been asserting on `b"x" * (CAP + 1)`, which is not a valid plist and returns `[]` whether the cap exists or not; they rebuilt it around a valid oversized document. The test file shrank by 18 lines and **every deletion was an upgrade** — membership assertions became adjacency assertions. Asked to confirm the live plist schema, they said plainly that the Mac is not theirs and they cannot authenticate `sudo`, rather than guessing — while confirming the two things they could check against the real binary ([#481](https://github.com/MakazhanAlpamys/Soup/pull/481))@@ -519,6 +520,7 @@ Listed by first contribution. PR numbers link the work.- Closed #1326: `training.expand_layers` (LLaMA Pro) with a LoRA rank trained the wrong thing. The block expansion runs before `get_peft_model`, which froze the appended blocks again, so only adapters on the original layers learned while the console said only the new blocks train. They took route 1 of the ruling: a refusal at config load that names `expand_layers`, `freeze_trainable_layers` and `lora.r` and points to `lora.r: 0` with `quantization: none` (on pretrain: needs `task: sft`), with an early return so `stream_layers`, Spectrum, LISA and QuEST keep their own message. **The part worth copying is the docs test**: it loads every `expand_layers` YAML block in `docs/peft-and-efficiency.md` and `docs/training.md`, requires both files to contribute at least one, and asserts each has `lora.r: 0`, so a docs example cannot drift away from the validator. They also measured on a tiny Llama what trains with and without the rank, and filed #1813 for the pretrain gap they left alone. 15 new tests; disabling the validator fails 4 and refusing `lora.r: 0` as well fails 9 ([#1326](https://github.com/MakazhanAlpamys/Soup/issues/1326), [#1783](https://github.com/MakazhanAlpamys/Soup/pull/1783))- Closed the pretrain half of the LLaMA Pro and full-fine-tune family. `task: pretrain` accepted `lora.r: 0` and `expand_layers`, then failed inside peft at trainer start, with an error that named neither Soup nor the field. The change refuses both at config load, **and the part to read is how they bounded it**: LISA genuinely trains pretrain with `lora.r: 0` (no adapter is attached), so they kept it loading and proved it through the real `PretrainTrainerWrapper.setup()` and one epoch instead of by argument, left `stream_layers` and mlx to their own messages, and reworded #1783's fragment when the change made its pretrain clause false. In review they made the pretrain sentence conditional on transformers text (it was false on unsloth), restored the sft negative assertion and showed that widening the refusal to dpo, classifier and asr is already caught by three existing controls. 18 tests, 8 failing on `main`; 16 mutations, all killed ([#1813](https://github.com/MakazhanAlpamys/Soup/issues/1813), [#1875](https://github.com/MakazhanAlpamys/Soup/pull/1875))- Part 1 of #1764: `soup registry push --run-id` left `data_hash` null; they added `--data PATH` (refused before any database opens), passed it through `register_from_run`, and showed the hash in `soup registry show`, worded as the registered input rather than proof; six mutations all killed ([#1764](https://github.com/MakazhanAlpamys/Soup/issues/1764), [#1907](https://github.com/MakazhanAlpamys/Soup/pull/1907))+ - Made ambiguous registry `name:tag` lookups refuse with candidate IDs and added `RegistryStore.list(run_id=...)` ([#1763](https://github.com/MakazhanAlpamys/Soup/issues/1763), [#1934](https://github.com/MakazhanAlpamys/Soup/pull/1934))- **GitFromRatatouille** ([@swalla02](https://github.com/swalla02))- First contribution, and it is the third instance of this repo's most persistent bug class found by someone else ([#363](https://github.com/MakazhanAlpamys/Soup/issues/363), [#423](https://github.com/MakazhanAlpamys/Soup/issues/423), [#659](https://github.com/MakazhanAlpamys/Soup/issues/659)): `soup migrate` refused **any** input named `*.jsonl`, a valid LLaMA-Factory YAML config included, because the guard branched on the filename while the content sniff written to gate it had **zero call sites in `src/`**. The diagnosis is worth more than the one-line fix — the test was named after the command and its body called the helper, so it passed on a codebase where `migrate` never imported it. **Then review found a regression their own fix introduced, and the way they closed it is the part to copy**: the sniff read `utf-8`, so a UTF-8 BOM survived as U+FEFF, which `str.strip()` does not remove, and a real BOM'd JSONL silently lost the friendly error it used to get — on a project with three Windows CI cells where PowerShell's `Out-File` writes that BOM by default. Their BOM test **guards its own fixture** (asserting the file really contains a BOM before asserting behaviour) and their bounded-read test measures the property with `tracemalloc` rather than pinning the spelling of the loop. Six mutations, six killed; zero assertions removed. They also **declined to widen the fix** to files whose name gives no hint, correctly citing the `.ipynb` case the original comment warns about, and left that as an open question rather than guessing ([#672](https://github.com/MakazhanAlpamys/Soup/issues/672), [#675](https://github.com/MakazhanAlpamys/Soup/pull/675))@@ -885,6 +887,7 @@ Listed by first contribution. PR numbers link the work.- Closed #1762: `utils.demo_bundles.copy_bundle_to` refused any `output_path` outside the process working directory, so an app with its own workspace (Soup Zero) had to call the private `_bundle_source_path` and lost the per-line JSON check, the size cap and the staged write. They took option 1 of the issue, a keyword-only `root` that defaults to the working directory, and reused the shared `is_under` helper (realpath + commonpath) for it. **The part worth copying is what they did when the review replaced `is_under` with a lexical `startswith` and all 41 tests still passed**: they added three boundary tests (a `..` traversal, a sibling directory `root2` next to `root`, and a directory symlink inside `root` that leads outside, asserting the target file was not created) and documented that `root=""` is refused while `root=Path("")` means the working directory, with a test. Ten mutants of the function each fail named tests and none survive; 146 passed across the touched and related files ([#1762](https://github.com/MakazhanAlpamys/Soup/issues/1762), [#1767](https://github.com/MakazhanAlpamys/Soup/pull/1767))- Closed #1596: square-bracket text in a model reply, a prompt file or a dataset key was read as Rich markup, so `arr[i]` lost its `[i]` and a closing-tag shape such as `[/INST]` or `[/b]` ended `soup chat`, `soup diff -o`, `soup eval human -o`, `soup data inspect` and `soup data validate` with exit 1, losing the results or judgments typed so far. They routed every such value through `for_terminal` (not plain `escape()`, so ESC and other control bytes are stripped too) at the chat reply and `/system` echo, the diff prompt line, panels, titles and summary headers, the eval human panels, and the data Columns, error and issue lines, and kept the `[dim]<empty>[/]` placeholder as markup. **The part worth copying is how the written output is pinned**: the tests read the `diff -o` JSONL and the `eval human -o` file back and compare the original strings (with `[/INST]`, `arr[i]`, backslashes and an ESC byte), so escaping or stripping the output fails them, and one ESC-bearing input goes through every site with `chr(27) not in out` asserted per command. In the review run, 83 tests passed with the neighbouring chat, diff, hygiene and fragment tests, and 39 of 45 mutations failed a named test; the six survivors are four equivalents and the untested empty-reply placeholder ([#1596](https://github.com/MakazhanAlpamys/Soup/issues/1596), [#1602](https://github.com/MakazhanAlpamys/Soup/pull/1602))- Closed #1792: seven CLI help strings held literal bracketed text (`[deprecated]`, `[doc-id]`, `[doc-N]`, `soup-cli[sigstore]`, `[data-pro]`) that Rich read as a style tag and dropped, so `--api-key` no longer said it was deprecated and the `--citation-style` help showed `()` instead of `([doc-id])`. They escaped all seven, including the two inside command docstrings, and added a ratchet that walks the live Click tree (2578 help strings, Click and Typer declarations) and fails on any bracketed tag Rich would drop. Review checked it: 19 passed on the merged tree and 8 failed on clean main; un-escaping each of the seven strings was caught by two tests (7 of 7); the rendered text of all 1419 command and option help strings changed in exactly those seven places ([#1792](https://github.com/MakazhanAlpamys/Soup/issues/1792), [#1840](https://github.com/MakazhanAlpamys/Soup/pull/1840))+ - Added schema descriptions for seven previously undocumented `soup.yaml` fields, including the core training settings ([#1794](https://github.com/MakazhanAlpamys/Soup/issues/1794), [#1831](https://github.com/MakazhanAlpamys/Soup/pull/1831))- **John Coplin** ([@johncoplin](https://github.com/johncoplin))- First contribution: the friendly-error formatter's `HTTP 401`/`HTTP 403` text patterns let two whitespace groups compete for the same run, so an exception message with `HTTP` followed by a long whitespace run and no status took about 13 s to print at 50,000 spaces. Since #1366, that check runs for every exception in the chain. They claimed the issue, rewrote both patterns so the optional whitespace is consumed only after a `:`/`=` separator, and added a timing test that fails on `main`. **The part worth copying is the equivalence test**: all 15 phrasings from the issue run against the old and the new pattern for both 401 and 403, so the speed-up provably changes nothing about what gets classified. 31 tests (1 fails on main), 7 of 7 mutations killed ([#1367](https://github.com/MakazhanAlpamys/Soup/issues/1367), [#1594](https://github.com/MakazhanAlpamys/Soup/pull/1594))@@ -920,6 +923,9 @@ Listed by first contribution. PR numbers link the work.- Fixed #1887: `soup data validate` did not count rows the loader skips, so a mostly unusable file could pass the valid-fraction gate and the exit code. They counted non-object rows and invalid-JSON lines as skipped, made an all-skipped file exit 2 (with `--format`) or 3 (without), and documented it; sixteen tests fail on main and eight mutations all killed ([#1887](https://github.com/MakazhanAlpamys/Soup/issues/1887), [#1908](https://github.com/MakazhanAlpamys/Soup/pull/1908))- Fixed #1853: `lora.use_rslora` loaded on `backend: mlx` and `backend: unsloth` but was never read, so an rsLoRA run trained at plain-LoRA scale (8x smaller update at the default `r: 64, alpha: 16`). They added one `mlx_lora_scale` helper read by both the MLX adapter-config writer and `_apply_lora`, forwarded `use_rslora` from all 11 Unsloth trainers to `get_peft_model`, and pinned every call site with a parametrised test plus a source guard; six mutations all killed ([#1853](https://github.com/MakazhanAlpamys/Soup/issues/1853), [#1899](https://github.com/MakazhanAlpamys/Soup/pull/1899))+- **DBVamsi** ([@DBVamsi](https://github.com/DBVamsi))+ - Refused `training.neftune_alpha` at config load on tasks that never apply it, and documented the supported tasks ([#1820](https://github.com/MakazhanAlpamys/Soup/issues/1820), [#1883](https://github.com/MakazhanAlpamys/Soup/pull/1883))+---Want to join this list? See [CONTRIBUTING.md](CONTRIBUTING.md) — good first issues are