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
fix(export): --format awq and gptq print a deprecation notice that names the formats to move to (#1690)
Alpamys Makazhan232269af9618
diff --git a/changelog.d/0.75.1/1690.deprecated.md b/changelog.d/0.75.1/1690.deprecated.mdnew file mode 100644index 00000000..fe4998cc--- /dev/null+++ b/changelog.d/0.75.1/1690.deprecated.md@@ -0,0 +1 @@+- **`soup export --format awq` and `--format gptq` are deprecated and will be removed in the next release.** Both upstream projects (AutoAWQ and AutoGPTQ) are archived, neither extra can be installed next to `[train]`, and `auto-gptq` has no Python 3.12 wheel, so the two formats could not be reached from a normal install. Until the removal they work as before. The command now starts with a `Deprecated:` notice that names the formats to move to (`gguf`, `onnx`, `tensorrt`, `bitnet`, `tq1_0`), so it is there whatever stops the run, the missing extra included; `soup quantize --to awq` and `--to gptq` print the same notice after the command they hand you; and the `--format` and `--to` help texts mark both formats (#1690).diff --git a/docs/commands.md b/docs/commands.mdindex 79ffbb4a..fd8ecbfb 100644--- a/docs/commands.md+++ b/docs/commands.md@@ -46,8 +46,8 @@ soup export --model ./output --format gguf Export to GGUF (Ollama)soup export --model ./output --deploy ollama Export GGUF + auto-deploy to Ollamasoup export --model ./output --format onnx Export to ONNXsoup export --model ./output --format tensorrt Export to TensorRT-LLM-soup export --model ./output --format awq --calibration-data cal.jsonl Export to AWQ (4-bit)-soup export --model ./output --format gptq --calibration-data cal.jsonl Export to GPTQ (4-bit)+soup export --model ./output --format awq --calibration-data cal.jsonl Export to AWQ (4-bit; deprecated, removed in the next release)+soup export --model ./output --format gptq --calibration-data cal.jsonl Export to GPTQ (4-bit; deprecated, removed in the next release)soup deploy ollama --model m.gguf --name x Deploy GGUF to Ollamasoup deploy ollama --list List Soup-deployed modelssoup deploy ollama --remove <name> Remove model from Ollamadiff --git a/docs/models.md b/docs/models.mdindex 8e04b45c..b447c066 100644--- a/docs/models.md+++ b/docs/models.md@@ -162,6 +162,6 @@ spelling is unchanged. See [the README's install section](../README.md#1-install| `remote` | `pip install "soup-cli[remote]"` | Remote datasets (s3 / gs / az / oci) || `dev` | `pip install "soup-cli[dev]"` | Tests + lint + types (pytest, ruff, mypy, pre-commit) |-**`[awq]` and `[gptq]` cannot be installed alongside `[train]`.** AWQ export was measured working only with `transformers` 4.52.4 or older, while `[train]` requires `transformers>=5.16.1`; `auto-gptq` publishes no Python 3.12 wheel; and both upstream projects (AutoAWQ and AutoGPTQ) are archived. Run AWQ or GPTQ export from a separate environment. Whether these two export formats stay is tracked in [#338](https://github.com/MakazhanAlpamys/Soup/issues/338).+**`[awq]` and `[gptq]` cannot be installed alongside `[train]`.** AWQ export was measured working only with `transformers` 4.52.4 or older, while `[train]` requires `transformers>=5.16.1`; `auto-gptq` publishes no Python 3.12 wheel; and both upstream projects (AutoAWQ and AutoGPTQ) are archived. Run AWQ or GPTQ export from a separate environment. Both export formats are deprecated and will be removed in the next release ([#338](https://github.com/MakazhanAlpamys/Soup/issues/338)); until then `soup export --format awq` and `--format gptq` start with a notice that names the formats to move to (`gguf`, `onnx`, `tensorrt`, `bitnet`, `tq1_0`).The complete, authoritative extras list is in [`pyproject.toml`](../pyproject.toml).diff --git a/docs/performance-and-quantization.md b/docs/performance-and-quantization.mdindex ebb95f16..faa3e837 100644--- a/docs/performance-and-quantization.md+++ b/docs/performance-and-quantization.md@@ -1345,7 +1345,7 @@ group_size: 32EOFsoup export --model ./merged --format torchao --quant-config ./q.yaml --output ./out-# AWQ/GPTQ export — an explicit local calibration set is required+# AWQ/GPTQ export (deprecated, removed in the next release) — an explicit local calibration set is requiredsoup export --model ./merged --format awq \--calibration-data ./calib.jsonl --output ./out-awqsoup export --model ./merged --format gptq \@@ -1366,6 +1366,8 @@ soup deploy autopilot --target rtx-4090-24gb \Autopilot also detects pre-quantized bases automatically — `TheBloke/Llama-2-7B-Chat-GPTQ` is recommended `gptq` instead of stacking 4-bit on top. Detection runs against the base-model name regex AND any local `config.json`'s `quantization_config.quant_method`. Out-of-cwd model paths are silently skipped (soft-probe semantics).+AWQ and GPTQ export are deprecated and will be removed in the next release: both upstream projects (AutoAWQ and AutoGPTQ) are archived and neither extra can be installed next to `[train]`. Until then `soup export --format awq` and `--format gptq` work as before and start with a `Deprecated:` notice that names the formats to move to (`gguf`, `onnx`, `tensorrt`, `bitnet`, `tq1_0`).+Direct AWQ and GPTQ exports require `--calibration-data`. Soup refuses a missing or unusable JSONL before importing the quantizer or loading the model. This keeps calibration inputs explicit and prevents AutoAWQ from silently downloading its large default dataset. Use `--calibration-samples` to cap the number of usable JSONL rows (default: 128).The advanced GGUF pipeline uses POSIX `O_NOFOLLOW` to defeat the TOCTOU race between the dispatch-time symlink check and the actual open of the calibration data — a crafted environment cannot race-swap the calibration file between validate and read.diff --git a/docs/serving-and-export.md b/docs/serving-and-export.mdindex e936fe98..d09e0276 100644--- a/docs/serving-and-export.md+++ b/docs/serving-and-export.md@@ -707,10 +707,10 @@ Each line: `{"ts": ..., "prompt": ..., "response": ..., "latency_ms": ..., "toke```bashsoup quantize ./out --to gguf --bits 4-soup quantize ./out --to gptq --bits 4 -o ./out-gptq+soup quantize ./out --to onnx -o ./out-onnx```-Prints the equivalent `soup export …` invocation (escaped via `shlex.quote`) for copy-paste. Intentionally does NOT in-process call `soup export` — Typer commands aren't safe to re-enter.+Prints the equivalent `soup export …` invocation (escaped via `shlex.quote`) for copy-paste. Intentionally does NOT in-process call `soup export` — Typer commands aren't safe to re-enter. `--to awq` and `--to gptq` still print their command, followed by a notice that the two formats are deprecated and will be removed in the next release.## Llama.cpp Proxydiff --git a/src/soup_cli/commands/export.py b/src/soup_cli/commands/export.pyindex b3a3a07d..dfe23cf5 100644--- a/src/soup_cli/commands/export.py+++ b/src/soup_cli/commands/export.py@@ -28,12 +28,42 @@ SUPPORTED_FORMATS = (# v0.53.1 #139 — UD/IQ/Apple-ARM GGUFs via llama.cpp imatrix."gguf-ud",)+# #338 — AWQ and GPTQ export are deprecated: both upstream projects are archived+# and neither extra installs next to the train extra. The two formats still run+# for one more release; the notice names the formats to move to. Maps the format+# to the upstream project the notice names.+DEPRECATED_FORMATS = {"awq": "AutoAWQ", "gptq": "AutoGPTQ"}+REPLACEMENT_FORMATS = ("gguf", "onnx", "tensorrt", "bitnet", "tq1_0")GGUF_QUANT_TYPES = ("q4_0", "q4_k_m", "q5_k_m", "q8_0", "f16", "f32")LLAMA_CPP_DIR_NAME = "llama.cpp"# Pin to a known release tag for supply-chain safetyLLAMA_CPP_TAG = "b5270"+def deprecated_format_notice(fmt: str) -> Optional[str]:+ """The deprecation line for an export format, or ``None`` when it stays.++ Plain text with no console markup: ``soup export`` and ``soup quantize``+ both print it behind a ``Deprecated:`` label.+ """+ upstream = DEPRECATED_FORMATS.get(fmt)+ if upstream is None:+ return None+ replacements = ", ".join(REPLACEMENT_FORMATS[:-1]) + f" or {REPLACEMENT_FORMATS[-1]}"+ return (+ f"--format {fmt} is deprecated and will be removed in the next release: "+ f"{upstream} is archived upstream and the {fmt} extra cannot be installed "+ f"next to the train extra. Use --format {replacements} instead."+ )+++def _warn_deprecated_format(fmt: str) -> None:+ """Print the deprecation notice for ``fmt``, if it has one."""+ notice = deprecated_format_notice(fmt)+ if notice is not None:+ console.print(f"[yellow]Deprecated:[/] {notice}")++def export(model: str = typer.Option(...,@@ -45,7 +75,10 @@ def export("gguf","--format","-f",- help="Export format: gguf, onnx, tensorrt, awq, gptq, bitnet, tq1_0",+ help=(+ "Export format: gguf, onnx, tensorrt, awq, gptq, bitnet, tq1_0 "+ "(awq and gptq are deprecated and will be removed in the next release)"+ ),),quant: str = typer.Option("q4_k_m",@@ -928,6 +961,8 @@ def _export_awq(trust_remote_code: bool = False,) -> None:"""Export model to AWQ format via autoawq."""+ # First, so it is there whatever stops the run (most stop at the extra).+ _warn_deprecated_format("awq")# Validate bitsvalid_bits = {4, 8}if bits not in valid_bits:@@ -1069,6 +1104,8 @@ def _export_gptq(trust_remote_code: bool = False,) -> None:"""Export model to GPTQ format via auto-gptq."""+ # First, so it is there whatever stops the run (most stop at the extra).+ _warn_deprecated_format("gptq")# Validate bitsvalid_bits = {4, 8}if bits not in valid_bits:diff --git a/src/soup_cli/commands/quantize.py b/src/soup_cli/commands/quantize.pyindex ec565d80..2ff92f69 100644--- a/src/soup_cli/commands/quantize.py+++ b/src/soup_cli/commands/quantize.py@@ -28,7 +28,10 @@ def quantize(to: str = typer.Option("gguf","--to",- help="Target format: gguf | gptq | awq | onnx | tensorrt.",+ help=(+ "Target format: gguf | gptq | awq | onnx | tensorrt "+ "(awq and gptq are deprecated and will be removed in the next release)."+ ),),bits: int = typer.Option(4,@@ -72,3 +75,9 @@ def quantize(console.print("[dim]Tip: `soup export --help` lists every advanced quantization flag.[/]")+ # #338 -- the command above still runs, but the format is on its way out.+ from soup_cli.commands.export import deprecated_format_notice++ notice = deprecated_format_notice(canonical)+ if notice is not None:+ console.print(f"[yellow]Deprecated:[/] {notice}")diff --git a/tests/test_issue338_awq_gptq_deprecated.py b/tests/test_issue338_awq_gptq_deprecated.pynew file mode 100644index 00000000..daac49a3--- /dev/null+++ b/tests/test_issue338_awq_gptq_deprecated.py@@ -0,0 +1,191 @@+"""#338 -- AWQ and GPTQ export are deprecated, and the commands say so.++Both upstream projects are archived and neither extra installs next to the+train extra, so the two formats go away one release after this notice. Until+then they keep working: ``soup export --format awq / gptq`` prints the notice+first and then does what it did, and ``soup quantize --to awq / gptq`` prints+it next to the command it hands the user.+"""++from __future__ import annotations++import re++import pytest+from typer.testing import CliRunner++import soup_cli.commands.export as export_mod+from soup_cli.cli import app+from soup_cli.commands.export import (+ DEPRECATED_FORMATS,+ REPLACEMENT_FORMATS,+ SUPPORTED_FORMATS,+ deprecated_format_notice,+)++# Rich colours per character on a colour-capable runner and wraps at the+# terminal width, drawing box borders between the fragments of a wrapped help+# line. Strip ANSI escapes and box-drawing characters, then collapse+# whitespace, before any substring match on CLI output.+_ANSI_RE = re.compile(r"\x1b\[[0-9;?]*[A-Za-z]")+_BOX_RE = re.compile(r"[\u2500-\u257f]")++DEPRECATED = ("awq", "gptq")+# The formats the decision on #338 names as the way out.+REPLACEMENTS = ("gguf", "onnx", "tensorrt", "bitnet", "tq1_0")+++def _plain(text: str) -> str:+ """ANSI- and border-stripped, whitespace-collapsed CLI output."""+ return " ".join(_BOX_RE.sub(" ", _ANSI_RE.sub("", text)).split())+++class TestTheNotice:+ def test_exactly_awq_and_gptq_are_deprecated(self) -> None:+ assert sorted(DEPRECATED_FORMATS) == sorted(DEPRECATED)++ def test_the_deprecated_formats_still_run(self) -> None:+ """Deprecated is not removed: the formats stay selectable for one more release."""+ assert set(DEPRECATED) <= set(SUPPORTED_FORMATS)++ def test_the_replacements_are_the_ones_the_decision_names(self) -> None:+ assert tuple(REPLACEMENT_FORMATS) == REPLACEMENTS++ def test_every_replacement_is_a_format_that_stays(self) -> None:+ assert set(REPLACEMENT_FORMATS) <= set(SUPPORTED_FORMATS)+ assert not set(REPLACEMENT_FORMATS) & set(DEPRECATED_FORMATS)++ @pytest.mark.parametrize("fmt", DEPRECATED)+ def test_it_names_the_format_the_removal_and_every_replacement(self, fmt: str) -> None:+ notice = deprecated_format_notice(fmt)+ assert notice is not None+ assert f"--format {fmt} is deprecated" in notice+ assert "will be removed in the next release" in notice+ for replacement in REPLACEMENTS:+ assert re.search(rf"\b{re.escape(replacement)}\b", notice), (replacement, notice)++ @pytest.mark.parametrize("fmt", DEPRECATED)+ def test_it_does_not_send_the_user_to_the_other_deprecated_format(self, fmt: str) -> None:+ other = "gptq" if fmt == "awq" else "awq"+ assert other not in deprecated_format_notice(fmt).lower()++ @pytest.mark.parametrize("fmt", DEPRECATED)+ def test_it_says_why(self, fmt: str) -> None:+ notice = deprecated_format_notice(fmt)+ assert "archived upstream" in notice+ assert f"the {fmt} extra cannot be installed next to the train extra" in notice++ @pytest.mark.parametrize("fmt", sorted(set(SUPPORTED_FORMATS) - set(DEPRECATED)))+ def test_a_format_that_stays_has_no_notice(self, fmt: str) -> None:+ assert deprecated_format_notice(fmt) is None++ @pytest.mark.parametrize("fmt", ["", "AWQ", "awq ", "exl2", "nope"])+ def test_an_unknown_spelling_has_no_notice(self, fmt: str) -> None:+ """The command lower-cases nothing: ``--format AWQ`` is refused as unsupported."""+ assert deprecated_format_notice(fmt) is None++ def test_the_notice_carries_no_console_markup(self) -> None:+ """It is printed through Rich: a square bracket in it would be read as a style."""+ for fmt in DEPRECATED:+ assert "[" not in deprecated_format_notice(fmt)+++class TestExportPrintsIt:+ @pytest.mark.parametrize("fmt", DEPRECATED)+ def test_the_notice_comes_first_and_the_export_path_still_runs(self, fmt, tmp_path) -> None:+ model_dir = tmp_path / "model"+ model_dir.mkdir()++ result = CliRunner().invoke(app, ["export", "--model", str(model_dir), "--format", fmt])++ output = _plain(result.output)+ assert f"Deprecated: --format {fmt} is deprecated" in output, (+ result.output,+ repr(result.exception),+ )+ # What the command did before, it still does: with no calibration data+ # it stops at the same requirement, with the same exit code.+ requirement = f"{fmt.upper()} export requires --calibration-data"+ assert requirement in output+ assert output.index("Deprecated:") < output.index(requirement)+ assert result.exit_code == 1++ @pytest.mark.parametrize("fmt", DEPRECATED)+ def test_the_notice_leads_when_the_extra_is_missing(self, fmt, tmp_path, monkeypatch) -> None:+ """Most users meet these formats through the "not installed" message."""+ model_dir = tmp_path / "model"+ model_dir.mkdir()+ cal_file = tmp_path / "cal.jsonl"+ cal_file.write_text('{"text": "sample"}\n', encoding="utf-8")+ monkeypatch.chdir(tmp_path)++ result = CliRunner().invoke(+ app,+ [+ "export", "--model", str(model_dir), "--format", fmt,+ "--calibration-data", str(cal_file),+ ],+ )++ output = _plain(result.output)+ assert result.exit_code != 0+ assert output.startswith(f"Deprecated: --format {fmt} is deprecated"), result.output++ @pytest.mark.parametrize("fmt", DEPRECATED)+ def test_the_notice_is_printed_once(self, fmt, tmp_path) -> None:+ model_dir = tmp_path / "model"+ model_dir.mkdir()++ result = CliRunner().invoke(app, ["export", "--model", str(model_dir), "--format", fmt])++ assert _plain(result.output).count("is deprecated") == 1++ def test_a_format_that_stays_prints_no_notice(self, tmp_path, monkeypatch) -> None:+ model_dir = tmp_path / "model"+ model_dir.mkdir()+ calls = []+ monkeypatch.setattr(export_mod, "_export_onnx", lambda *args, **kwargs: calls.append(args))++ result = CliRunner().invoke(app, ["export", "--model", str(model_dir), "--format", "onnx"])++ assert result.exit_code == 0, (result.output, repr(result.exception))+ assert len(calls) == 1+ assert "deprecated" not in _plain(result.output).lower()++ def test_the_help_marks_both_formats(self) -> None:+ result = CliRunner().invoke(app, ["export", "--help"])++ assert result.exit_code == 0, (result.output, repr(result.exception))+ assert "awq and gptq are deprecated" in _plain(result.output)+++class TestQuantizePrintsIt:+ @pytest.mark.parametrize("fmt", DEPRECATED)+ def test_it_still_prints_the_command_and_adds_the_notice(self, fmt: str) -> None:+ result = CliRunner().invoke(app, ["quantize", "./out", "--to", fmt])++ output = _plain(result.output)+ assert result.exit_code == 0, (result.output, repr(result.exception))+ assert f"soup export --model ./out --format {fmt} --bits 4" in output+ assert f"Deprecated: --format {fmt} is deprecated" in output++ @pytest.mark.parametrize("fmt", DEPRECATED)+ def test_an_upper_case_target_gets_the_notice_too(self, fmt: str) -> None:+ """``soup quantize`` lower-cases ``--to``, so the notice follows the canonical name."""+ result = CliRunner().invoke(app, ["quantize", "./out", "--to", fmt.upper()])++ assert result.exit_code == 0, (result.output, repr(result.exception))+ assert f"Deprecated: --format {fmt} is deprecated" in _plain(result.output)++ @pytest.mark.parametrize("fmt", ["gguf", "onnx", "tensorrt"])+ def test_a_target_that_stays_prints_no_notice(self, fmt: str) -> None:+ result = CliRunner().invoke(app, ["quantize", "./out", "--to", fmt])++ assert result.exit_code == 0, (result.output, repr(result.exception))+ assert "deprecated" not in _plain(result.output).lower()++ def test_the_help_marks_both_targets(self) -> None:+ result = CliRunner().invoke(app, ["quantize", "--help"])++ assert result.exit_code == 0, (result.output, repr(result.exception))+ assert "awq and gptq are deprecated" in _plain(result.output)