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(unlearn): remove expired promises and guard helper refusals (#1405) (#1842)
Nurkhan Esenbekfe9bbfddb2f5
diff --git a/changelog.d/0.76.0/1842.fixed.md b/changelog.d/0.76.0/1842.fixed.mdnew file mode 100644index 00000000..a5ba812a--- /dev/null+++ b/changelog.d/0.76.0/1842.fixed.md@@ -0,0 +1 @@+- Remove outdated unlearning release promises and guard exception messages across the source tree against expired promises. (#1405 by @kok-o in #1842)diff --git a/src/soup_cli/commands/_eval_v0610.py b/src/soup_cli/commands/_eval_v0610.pyindex 9c895338..76c0055b 100644--- a/src/soup_cli/commands/_eval_v0610.py+++ b/src/soup_cli/commands/_eval_v0610.py@@ -2,9 +2,9 @@Computes Forget Quality + Model Utility + PrivLeak metrics fromoperator-supplied evidence JSON and emits an :class:`UnlearnReport`.-Live model-driven evaluation lands in v0.61.1; this release writes a-neutral OK report when no evidence is supplied so the schema + output-shape are usable today.+Scores come from the evidence file given with ``--evidence``; there is no+model-driven evaluation. With no evidence it writes a neutral OK report,+so the schema + output shape are usable."""from __future__ import annotationsdiff --git a/src/soup_cli/utils/unlearning.py b/src/soup_cli/utils/unlearning.pyindex 1e565cce..13ea3bcd 100644--- a/src/soup_cli/utils/unlearning.py+++ b/src/soup_cli/utils/unlearning.py@@ -11,10 +11,8 @@ Three method backends for the new ``task='unlearn'`` trainer:Adds a noise vector to the residual stream for forget-set inputs whilepreserving retain-set activations.-Schema-only release: validators here are reused by the SoupConfig-cross-validator, while the live trainer wrapper ships in v0.61.1-(mirrors v0.50.0 GRPO Plus / v0.52.0 Modality II / v0.53.0 Quant Menu II-stub-then-live pattern).+Validators here are reused by the SoupConfig cross-validator. The live+trainer uses the transformers backend; MLX unlearning is not supported."""from __future__ import annotations@@ -200,11 +198,10 @@ def apply_unlearn_loss(method: str):def build_unlearn_trainer(config: object, **kwargs: object) -> object:- """Live unlearn trainer factory — deferred stub.+ """Construct the transformers unlearning trainer lazily.- Lazy-imports the wrapper so the schema-only import path never pulls- in the heavy ``transformers`` / ``peft`` surface. The wrapper itself- is a stub that raises ``NotImplementedError`` on ``setup()``.+ Lazy-imports the wrapper so config validation never pulls in the heavy+ ``transformers`` / ``peft`` surface."""from soup_cli.trainer.unlearn import UnlearnTrainerWrapperdiff --git a/src/soup_cli/utils/unlearning_eval.py b/src/soup_cli/utils/unlearning_eval.pyindex 71ee5e58..fd100f52 100644--- a/src/soup_cli/utils/unlearning_eval.py+++ b/src/soup_cli/utils/unlearning_eval.py@@ -14,8 +14,7 @@ Scores three orthogonal axes after running a ``task='unlearn'`` job:Verdicts follow the project's OK / MINOR / MAJOR taxonomy (samethresholds as v0.26.0 Part D Quant-Lobotomy + v0.56.0 diagnose).-Live-model evaluation hooks are deferred to v0.61.1 — this module ships-pure-Python kernels + a frozen ``UnlearnReport`` + bundled TOFU / MUSE /+This module provides pure-Python kernels + a frozen ``UnlearnReport`` + bundled TOFU / MUSE /WMDP mini-fixtures (v0.71.1 #195 added the MUSE + WMDP loaders).Operators can supply pre-computed ``evidence`` JSON to drive theclassifier today.@@ -448,9 +447,9 @@ def get_fixture_path(benchmark: str) -> Optional[Path]:"""Return the bundled fixture path for a benchmark, or ``None`` ifnot yet bundled.- TOFU ships in v0.61.0 (synthetic author profile mini-set under- ``soup_cli/data/_fixtures/unlearning/``). MUSE / WMDP loaders are- deferred to v0.61.1.+ TOFU, MUSE and WMDP have bundled mini-fixtures under+ ``soup_cli/data/_fixtures/unlearning/``. These fixtures are synthetic,+ not the full upstream benchmarks.Routes through ``importlib.resources`` (review MEDIUM M6 — matchesv0.53.8 #93 `_bundle_source_path` policy; safe under zipapp /diff --git a/tests/test_issue823_stale_feature_descriptions.py b/tests/test_issue823_stale_feature_descriptions.pyindex 3cda5d8e..894eda47 100644--- a/tests/test_issue823_stale_feature_descriptions.py+++ b/tests/test_issue823_stale_feature_descriptions.py@@ -113,9 +113,8 @@ def _constant_text(node: ast.AST) -> str | None:return None-def _schema_raise_messages(path: Path = SCHEMA_PATH) -> list[tuple[int, str]]:- """Every string handed to an exception raised in ``schema.py`` (#1353):- these reach the user when a config is refused, same as a description."""+def _raise_messages(path: Path) -> list[tuple[int, str]]:+ """Literal exception arguments, including constant parts of f-strings."""tree = ast.parse(path.read_text(encoding="utf-8"))messages: list[tuple[int, str]] = []for node in ast.walk(tree):@@ -163,12 +162,19 @@ def test_schema_descriptions_have_no_expired_release_promises() -> None:assert offenders == []-def test_schema_raise_messages_have_no_expired_release_promises() -> None:- messages = _schema_raise_messages()+def test_source_raise_messages_have_no_expired_release_promises() -> None:+ paths = sorted((ROOT / "src" / "soup_cli").rglob("*.py"))+ # Helper refusals must remain covered if the scan root changes.+ assert ROOT / "src/soup_cli/utils/unlearning.py" in paths+ messages = [+ (path, line, text)+ for path in paths+ for line, text in _raise_messages(path)+ ]assert len(messages) >= 300offenders = [- f"schema.py:{line}: {text}"- for line, text in messages+ f"{path.relative_to(ROOT)}:{line}: {text}"+ for path, line, text in messagesif _has_expired_version_promise(text)]assert offenders == []@@ -182,12 +188,48 @@ def test_the_raise_scanner_reads_f_strings(tmp_path: Path) -> None:encoding="utf-8",)- ((line, text),) = _schema_raise_messages(sample)+ ((line, text),) = _raise_messages(sample)assert line == 2assert _has_expired_version_promise(text)+def test_unlearning_docstrings_have_no_expired_release_promises() -> None:+ paths = (+ SCHEMA_PATH,+ ROOT / "src/soup_cli/utils/unlearning.py",+ ROOT / "src/soup_cli/utils/unlearning_eval.py",+ ROOT / "src/soup_cli/commands/_eval_v0610.py",+ )+ offenders = []+ for path in paths:+ tree = ast.parse(path.read_text(encoding="utf-8"))+ for node in ast.walk(tree):+ if isinstance(node, (ast.Module, ast.ClassDef, ast.FunctionDef, ast.AsyncFunctionDef)):+ text = ast.get_docstring(node) or ""+ if _has_expired_version_promise(text):+ offenders.append(f"{path.relative_to(ROOT)}: {text}")+ assert offenders == []+++def test_unlearning_mlx_refusal_names_supported_backend() -> None:+ import pytest++ from soup_cli.config.schema import SoupConfig++ with pytest.raises(ValueError) as exc_info:+ SoupConfig(+ base="test/model", task="unlearn", backend="mlx",+ data={"train": "d.jsonl", "forget_set": "forget.jsonl"},+ training={"unlearn_method": "npo"},+ )+ message = str(exc_info.value)+ assert "task='unlearn'" in message+ assert "backend=mlx" in message+ assert "backend: transformers" in message+ assert not _has_expired_version_promise(message)++def test_cli_help_has_no_expired_promises_or_internal_phase_labels() -> None:help_strings = _cli_help_strings()assert len(help_strings) >= 1_000@@ -205,6 +247,7 @@ def test_stale_copy_scanner_can_fail_without_banning_future_notices() -> None:assert _has_expired_version_promise(f"Runtime lands in v{current}")assert _has_expired_version_promise("Runtime was deferred to v0.74.1")assert not _has_expired_version_promise(f"Removal ships in v{future}")+ assert not _has_expired_version_promise("Supported since v0.61.1")assert not _help_text_is_stale("Applies the post-v2 attention kernel")assert _schema_description_is_stale("reserved", "Reserved (schema-only).")assert not _schema_description_is_stale(