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(fp8): a failed FP8 conversion stops the run instead of training on (#1152) (#1333)
Srinivasan R93eec14eca14
diff --git a/changelog.d/0.75.1/1333.changed.md b/changelog.d/0.75.1/1333.changed.mdnew file mode 100644index 00000000..821617e8--- /dev/null+++ b/changelog.d/0.75.1/1333.changed.md@@ -0,0 +1,2 @@+- **An explicitly requested FP8 conversion that fails now stops the run instead of training on (#1152 by @Srinivasan8888 in #1333).**+ With `quantization_aware: fp8`, a float8 conversion that raised used to print a yellow line and train in bf16; it now stops at setup and quotes torchao's error. With `fp8_attention: true`, a conversion that fails partway, or a model with no attention projections, used to print its own "PARTIALLY converted" or "refusing the silent no-op" message as a yellow line and train on anyway; both now stop the run, as those messages say. This follows #835's rule for a card that cannot run FP8 and for a missing torchao. `utils/fp8.py::validate_fp8_config`, which nothing called, is removed.diff --git a/docs/performance-and-quantization.md b/docs/performance-and-quantization.mdindex 32abeb62..7634a8b2 100644--- a/docs/performance-and-quantization.md+++ b/docs/performance-and-quantization.md@@ -249,7 +249,7 @@ training:Omitting `fp8_recipe` defaults to `tensorwise` (identical to v0.28.0 behavior).-Bool `true` is not a spelling of FP8: it selected the int8 path, which is refused at config load ([#1222](https://github.com/MakazhanAlpamys/Soup/issues/1222)). FP8 requires CUDA + an Ada or newer GPU (compute capability ≥ 8.9) and is rejected at config load on the mlx backend. (`soup train` refuses it on the unsloth backend: "QAT is not compatible with the unsloth backend".) `soup train --dry-run` reports this machine's card as a note and exits 0, since FP8 configs are often written for another machine; a missing torchao still fails it. The `rowwise` and `rowwise_with_gw_hp` recipes run a separate torch kernel with its own limits: it needs a torch that dispatches it on the card (Ada 8.9: torch ≥ 2.7; Hopper 9.x and Blackwell datacenter 10.x: any supported torch; RTX 50-series 12.x: torch ≥ 2.8; 11.x: torch ≥ 2.10; no release through 2.14 runs it on 13.x), it is **never built on Windows**, and before torch 2.11 it is only built against CUDA 12 or newer. `tensorwise` has none of these limits. When FP8 is requested and this card, OS or torch build cannot run it, **the run stops at setup** with the reason (`FP8HardwareUnsupportedError`), before any layer is converted, on every trainer that reaches the converter; it never trains on without FP8. **A missing torchao stops the run the same way** (`FP8DependencyMissingError`, naming `pip install "soup-cli[qat]"`), on a card that could run FP8 too. Until this release the trainers printed a yellow advisory and trained in bf16 under a config that said FP8 (#835). `soup train` asks both questions, card first, before it loads the model, so it stops with the same reason and no download. (SFT's audio and layer-streaming setup branches do not call the converter at all, so they still accept the flag without applying it; tracked in #1124.) `fp8_attention` asks the same gate (#835). Wired across every transformer-backend trainer (SFT, DPO, GRPO, KTO, ORPO, SimPO, IPO, PPO, Reward-Model, Embedding, Pretrain).+Bool `true` is not a spelling of FP8: it selected the int8 path, which is refused at config load ([#1222](https://github.com/MakazhanAlpamys/Soup/issues/1222)). FP8 requires CUDA + an Ada or newer GPU (compute capability ≥ 8.9) and is rejected at config load on the mlx backend. (`soup train` refuses it on the unsloth backend: "QAT is not compatible with the unsloth backend".) `soup train --dry-run` reports this machine's card as a note and exits 0, since FP8 configs are often written for another machine; a missing torchao still fails it. The `rowwise` and `rowwise_with_gw_hp` recipes run a separate torch kernel with its own limits: it needs a torch that dispatches it on the card (Ada 8.9: torch ≥ 2.7; Hopper 9.x and Blackwell datacenter 10.x: any supported torch; RTX 50-series 12.x: torch ≥ 2.8; 11.x: torch ≥ 2.10; no release through 2.14 runs it on 13.x), it is **never built on Windows**, and before torch 2.11 it is only built against CUDA 12 or newer. `tensorwise` has none of these limits. When FP8 is requested and this card, OS or torch build cannot run it, **the run stops at setup** with the reason (`FP8HardwareUnsupportedError`), before any layer is converted, on every trainer that reaches the converter; it never trains on without FP8. **A missing torchao stops the run the same way** (`FP8DependencyMissingError`, naming `pip install "soup-cli[qat]"`), on a card that could run FP8 too. So does a float8 conversion that fails: it quotes torchao's error and stops, instead of training in bf16 (#1152). Until this release the trainers printed a yellow advisory and trained in bf16 under a config that said FP8 (#835). `soup train` asks both questions, card first, before it loads the model, so it stops with the same reason and no download. (SFT's audio and layer-streaming setup branches do not call the converter at all, so they still accept the flag without applying it; tracked in #1124.) `fp8_attention` asks the same gate (#835). Wired across every transformer-backend trainer (SFT, DPO, GRPO, KTO, ORPO, SimPO, IPO, PPO, Reward-Model, Embedding, Pretrain).## Cut Cross-Entropy (Large-Vocab Models)@@ -1199,7 +1199,7 @@ soup serve --model ./output --kv-cache-type q8_0 # 8-bit quantized KV cacheThree TrainingConfig bools extend the v0.28.0 FP8 menu. `fp8_attention` and `nvfp4` are LIVEtorchao converters as of v0.71.21 (hardware-gated):-- `fp8_attention: true` — requires `quantization_aware: fp8` AND a non-MLX backend. Converts the attention projections (q/k/v/o and fused variants) to torchao float8 training on Ada or newer GPUs (the same gate as `quantization_aware: fp8`). A card, OS or torch build the gate refuses stops the run at setup, and so does a missing torchao (#835); a conversion-phase failure raises an honest "model may be PARTIALLY converted" error instead of training on a half-converted model.+- `fp8_attention: true` — requires `quantization_aware: fp8` AND a non-MLX backend. Converts the attention projections (q/k/v/o and fused variants) to torchao float8 training on Ada or newer GPUs (the same gate as `quantization_aware: fp8`). A card, OS or torch build the gate refuses stops the run at setup, and so does a missing torchao (#835); a conversion-phase failure raises an honest "model may be PARTIALLY converted" error instead of training on a half-converted model, and a model with no attention projections stops too, instead of training on as a no-op (#1152).- `nvfp4: true` — Blackwell-only FP4 training via torchao `NVFP4TrainingConfig` + `quantize_`, which replaces `nn.Linear` with `NVFP4Linear` and quantises the forward **and backward** GEMMs. (Through v0.75.0 Soup asked for `NVFP4Config`, a name torchao has never exported, so the flag degraded to a yellow advisory and a bf16 run — #826.) Gated to supported tasks (rejected on `task: distill` and tasks without v0.28 speed/memory wiring) + non-MLX + `modality: text`; the SM ≥ 10 runtime check fires at trainer construction. The fix makes the flag **reach** NVFP4 training — the linears really are replaced by `NVFP4Linear`. A training step on top of that has torchao's own requirements, which Soup does not check for you: the kernels are triton, and `nvfp4_mm_triton` raises `ValueError: requires M, K, N all divisible by 128` for a shape it cannot serve (`torchao/prototype/moe_training/nvfp4_training/nvfp4_linear.py`), so a model whose hidden/intermediate sizes are not multiples of 128 will fail there rather than train slowly.- `unsloth_bnb_4bit: true` — promotes "Unsloth Dynamic 4-bit" from an implicit `backend=unsloth + quantization=4bit` combo to a named flag. Mutual rejection of inconsistent combos at config load.diff --git a/src/soup_cli/utils/advanced_precision.py b/src/soup_cli/utils/advanced_precision.pyindex 567d87e0..861d53c7 100644--- a/src/soup_cli/utils/advanced_precision.py+++ b/src/soup_cli/utils/advanced_precision.py@@ -20,9 +20,9 @@ v0.71.21 #141 lifts the two ``apply_*`` stubs to live, BETA hw-gated code:SM 12.0 consumer RTX 50-series).Both raise friendly ``RuntimeError`` on missing hardware / torchao instead-of silently no-opping; the trainer-side wiring in-``utils/v028_features.apply_v028_speed_memory`` degrades those to yellow-advisories so a training kick-off never crashes on instrumentation.+of silently no-opping. ``utils/v028_features.apply_v028_speed_memory`` lets+every ``apply_fp8_attention`` error stop the run (#835, #1152); only+``apply_nvfp4``'s are still degraded to yellow advisories."""from __future__ import annotationsdiff --git a/src/soup_cli/utils/fp8.py b/src/soup_cli/utils/fp8.pyindex e1525ebb..30af15a4 100644--- a/src/soup_cli/utils/fp8.py+++ b/src/soup_cli/utils/fp8.py@@ -19,12 +19,6 @@ Requires:from __future__ import annotations-from typing import Literal, Union--from soup_cli.utils.torchao_compat import TORCHAO_MIN_VERSION--QuantizationAwareLike = Union[bool, Literal["fp8"]]-def is_torchao_float8_available() -> bool:"""True when torchao's float8 converter, the one Soup applies, is importable."""@@ -250,7 +244,7 @@ def apply_fp8_training(recipe: Scaling recipe name. Default ``"tensorwise"``.Returns:- True on success, False if the conversion itself failed.+ True: every failure raises instead (#1152).Raises:FP8HardwareUnsupportedError: this card, OS or torch build cannot run@@ -258,6 +252,9 @@ def apply_fp8_training(FP8DependencyMissingError: torchao's float8 training is not installed(#835 ruling). Checked after the card, so an unsupported card isnamed as the reason rather than a package that would not help.+ RuntimeError: the conversion itself failed. It converts in place, so+ the model may be partly converted; the run stops rather than train+ it in bf16 under a config that asked for FP8 (#1152)."""# The hardware gate runs FIRST, before the dependency probe (#1044 review).# torchao is not a default dependency, so "absent" is the common case: asking@@ -282,63 +279,10 @@ def apply_fp8_training(try:config = Float8LinearConfig.from_recipe_name(recipe)convert_to_float8_training(model, config=config)- return True- except (RuntimeError, ValueError):- return False---def validate_fp8_config(- quantization_aware: QuantizationAwareLike,- backend: str,- device: str,- recipe: str = "tensorwise",-) -> list[str]:- """Validate FP8 training config.-- Args:- quantization_aware: TrainingConfig.quantization_aware (False/True/'fp8').- backend: Training backend (transformers/unsloth/mlx).- device: Training device (cuda/cpu/mps).- recipe: TrainingConfig.fp8_recipe; rowwise has its own floor (#835).-- Returns:- List of error messages. Empty list means valid (or FP8 not requested).- """- errors: list[str] = []-- # Only validate when FP8 is explicitly requested- if quantization_aware != "fp8":- return errors-- if backend == "unsloth":- errors.append(- "FP8 training is not compatible with the unsloth backend. "- "Unsloth uses its own fused kernels. Use backend: transformers."- )- return errors-- if backend == "mlx":- errors.append(- "FP8 training is not supported on the mlx backend (Apple Silicon). "- "Use backend: transformers."- )- return errors-- if device != "cuda":- errors.append(- "FP8 training requires CUDA. "- f"Current device: {device}."- )- return errors-- ok, reason = fp8_training_supported(recipe)- if not ok:- errors.append(reason)-- if not is_fp8_available():- errors.append(- "FP8 training dependencies are not installed. "- f"Install with: pip install torchao (>={TORCHAO_MIN_VERSION})"- )-- return errors+ except Exception as exc: # noqa: BLE001 — in-place mutation honesty+ raise RuntimeError(+ "quantization_aware=fp8: the float8 conversion failed and the model may "+ "be partly converted, so the run stops instead of training without FP8 "+ f"({type(exc).__name__}: {exc})"+ ) from exc+ return Truediff --git a/src/soup_cli/utils/v028_features.py b/src/soup_cli/utils/v028_features.pyindex 0063ae21..9babade4 100644--- a/src/soup_cli/utils/v028_features.py+++ b/src/soup_cli/utils/v028_features.py@@ -40,8 +40,8 @@ def apply_v028_speed_memory(Returns a dict ``{feature_name: applied}`` so the caller can log thedecisions for the run record. Cut-CE degrades to a yellow advisory whenits library is missing. An explicitly requested FP8 does not: a card that- cannot run it, or a missing torchao, stops the run (#835), and only a- conversion that fails partway still prints a yellow line (#1152).+ cannot run it, a missing torchao (#835), or a conversion that fails+ (#1152) stops the run, before anything trains."""applied: dict[str, bool] = {"cut_ce": False,@@ -75,45 +75,28 @@ def apply_v028_speed_memory(# --- FP8 training --------------------------------------------------------if getattr(tcfg, "quantization_aware", None) == "fp8":recipe = getattr(tcfg, "fp8_recipe", "tensorwise")- from soup_cli.utils.fp8 import FP8DependencyMissingError, FP8HardwareUnsupportedError- try:- from soup_cli.utils.fp8 import apply_fp8_training- ok = bool(apply_fp8_training(model, recipe=recipe))- except (FP8HardwareUnsupportedError, FP8DependencyMissingError):- # #835 ruling: FP8 was asked for explicitly and cannot run here --- # this card, or no torchao. Warning and training on without it is the- # silent-setting defect; the run stops here, before anything trains.- raise- except Exception: # noqa: BLE001- ok = False- applied["fp8"] = ok- if ok:- _say(f"FP8 training enabled (Float8Linear, recipe={recipe})")- else:- # A missing torchao raises above, so False now only means the- # conversion itself failed; the old "(torchao.float8 missing)" would- # name the wrong cause (#1152 row 3).- _say(- "FP8 training requested but the float8 conversion failed",- style="yellow",- )+ # FP8 was asked for explicitly: a card that cannot run it, no torchao+ # (#835), or a conversion that fails (#1152) raises out of here and stops+ # the run. Warning and training on without it is the silent-setting defect.+ from soup_cli.utils.fp8 import apply_fp8_training++ apply_fp8_training(model, recipe=recipe)+ applied["fp8"] = True+ _say(f"FP8 training enabled (Float8Linear, recipe={recipe})")# --- FP8 attention (v0.71.21 #141) ---------------------------------------# Key added only when the flag is set — keeps the legacy 3-key dict# contract on the no-features path (test_part_c exact-equality).if getattr(tcfg, "fp8_attention", False):recipe = getattr(tcfg, "fp8_recipe", "tensorwise")- from soup_cli.utils.fp8 import FP8DependencyMissingError, FP8HardwareUnsupportedError- try:- from soup_cli.utils.advanced_precision import apply_fp8_attention- converted = apply_fp8_attention(model, recipe=recipe)- applied["fp8_attention"] = True- _say(f"FP8 attention enabled ({converted} projections)")- except (FP8HardwareUnsupportedError, FP8DependencyMissingError):- raise- except (RuntimeError, ValueError, TypeError) as exc:- applied["fp8_attention"] = False- _say(f"FP8 attention: {exc}", style="yellow")+ # Every refusal apply_fp8_attention raises stops the run (#835, #1152):+ # a partial conversion must not train, and neither may the no-op on a+ # model with no attention projections.+ from soup_cli.utils.advanced_precision import apply_fp8_attention++ converted = apply_fp8_attention(model, recipe=recipe)+ applied["fp8_attention"] = True+ _say(f"FP8 attention enabled ({converted} projections)")# --- NVFP4 (v0.71.21 #141 — Blackwell-only) ------------------------------if getattr(tcfg, "nvfp4", False):diff --git a/tests/test_issue1152_fp8_conversion_stops.py b/tests/test_issue1152_fp8_conversion_stops.pynew file mode 100644index 00000000..a5fd0423--- /dev/null+++ b/tests/test_issue1152_fp8_conversion_stops.py@@ -0,0 +1,177 @@+"""#1152 — an explicitly requested FP8 conversion that fails stops the run.++#1154 made a card that cannot run FP8, and a missing torchao, stop at setup. Three+failures were still turned into a yellow line while training went on, under a+config that said FP8 (ruled on #1152, 2026-09-22 and 2026-09-24):++- row 3: ``quantization_aware: fp8``, the float8 conversion raises -> trained bf16;+- row 4: ``fp8_attention``, the conversion fails partway -> trained the+ half-converted model that ``apply_fp8_attention``'s own error says not to;+- row 5: ``fp8_attention`` on a model with no attention projections -> trained+ on as the no-op its error says it refuses.++Every trainer's FP8 goes through ``apply_v028_speed_memory``, so that is where+these are exercised, plus SFT's call into it. The card is patched and torchao is+the #835 file's stub; nothing here needs a GPU.+"""++from __future__ import annotations++import sys+from types import SimpleNamespace++import pytest++torch = pytest.importorskip("torch")++from tests import test_issue835_fp8_gate as _gate # noqa: E402++_Attn, _card = _gate._Attn, _gate._card+converts = _gate.converts # the #835 torchao stub, as a fixture here too+++def _console():+ from io import StringIO++ from rich.console import Console++ out = StringIO()+ return out, Console(file=out, width=400, force_terminal=False, color_system=None)+++def _apply(tcfg, console):+ from soup_cli.utils.v028_features import apply_v028_speed_memory++ return apply_v028_speed_memory(+ model=_Attn(), tcfg=tcfg, base_model="m", console=console, device="cuda"+ )+++def _break_the_converter(monkeypatch, error):+ def _raise(*_a, **_k):+ raise error++ monkeypatch.setattr(sys.modules["torchao.float8"], "convert_to_float8_training", _raise)+++class _NoAttention(torch.nn.Module):+ def __init__(self) -> None:+ super().__init__()+ self.mlp = torch.nn.Linear(4, 4)+++class TestAFailedConversionStops:+ def test_row3_quantization_aware_stops_naming_torchao_s_error(self, monkeypatch, converts):+ from soup_cli.config.schema import TrainingConfig++ _card(monkeypatch, (9, 0))+ _break_the_converter(monkeypatch, RuntimeError("scaled_mm needs K % 16 == 0"))+ out, console = _console()++ with pytest.raises(RuntimeError, match="float8 conversion failed") as info:+ _apply(TrainingConfig(quantization_aware="fp8"), console)++ assert "scaled_mm needs K % 16 == 0" in str(info.value)+ assert "torchao.float8 missing" not in str(info.value)+ assert "enabled" not in out.getvalue()++ def test_row4_a_partial_fp8_attention_conversion_stops(self, monkeypatch, converts):+ from soup_cli.config.schema import TrainingConfig++ _card(monkeypatch, (9, 0))+ monkeypatch.setattr("soup_cli.utils.fp8.apply_fp8_training", lambda *_a, **_k: True)+ _break_the_converter(monkeypatch, RuntimeError("out of memory"))+ out, console = _console()++ with pytest.raises(RuntimeError, match="PARTIALLY converted"):+ _apply(TrainingConfig(quantization_aware="fp8", fp8_attention=True), console)++ assert "FP8 attention" not in out.getvalue()++ def test_row5_no_attention_projections_stops(self, monkeypatch, converts):+ from soup_cli.config.schema import TrainingConfig+ from soup_cli.utils.v028_features import apply_v028_speed_memory++ _card(monkeypatch, (9, 0))+ monkeypatch.setattr("soup_cli.utils.fp8.apply_fp8_training", lambda *_a, **_k: True)+ out, console = _console()++ with pytest.raises(ValueError, match="no attention projections"):+ apply_v028_speed_memory(+ model=_NoAttention(),+ tcfg=TrainingConfig(quantization_aware="fp8", fp8_attention=True),+ base_model="m", console=console, device="cuda",+ )++ assert "FP8 attention" not in out.getvalue()++ def test_sft_stops_at_setup(self, monkeypatch, converts):+ """Through ``SFTTrainerWrapper._apply_quantization_aware``, as #1154's stop."""+ from soup_cli.config.schema import TrainingConfig+ from soup_cli.trainer.sft import SFTTrainerWrapper++ _card(monkeypatch, (9, 0))+ _break_the_converter(monkeypatch, RuntimeError("boom"))+ wrapper = object.__new__(SFTTrainerWrapper)+ wrapper.model = _Attn()+ wrapper.config = SimpleNamespace(base="org/model", backend="transformers")+ wrapper.device = "cuda:0"++ with pytest.raises(RuntimeError, match="float8 conversion failed"):+ wrapper._apply_quantization_aware(TrainingConfig(quantization_aware="fp8"))+++class TestTheSuccessfulPathIsUnchanged:+ """Controls: a card that runs FP8 with torchao present still converts."""++ def test_quantization_aware_converts(self, monkeypatch, converts):+ from soup_cli.config.schema import TrainingConfig++ _card(monkeypatch, (9, 0))+ out, console = _console()++ applied = _apply(TrainingConfig(quantization_aware="fp8"), console)++ assert applied["fp8"] is True and converts == ["tensorwise"]+ assert "FP8 training enabled" in out.getvalue()++ def test_fp8_attention_converts(self, monkeypatch, converts):+ from soup_cli.config.schema import TrainingConfig++ _card(monkeypatch, (9, 0))+ out, console = _console()++ applied = _apply(TrainingConfig(quantization_aware="fp8", fp8_attention=True), console)++ assert applied["fp8"] is True and applied["fp8_attention"] is True+ assert "FP8 attention enabled (4 projections)" in out.getvalue()+++class TestEveryConversionErrorNamesFp8:+ """torchao 0.18's own conversion path raises AssertionError (swap_linear_layers,+ a root nn.Linear with children) and TypeError (Float8Linear.from_float, partway+ through the swap), not only RuntimeError/ValueError."""++ @pytest.mark.parametrize(+ "error",+ [+ RuntimeError("scaled_mm needs K % 16 == 0"),+ ValueError("bad shape"),+ AssertionError("Does not support a root nn.Linear with children"),+ TypeError("cannot assign 'torch.FloatTensor' as parameter 'weight'"),+ ],+ ids=lambda e: type(e).__name__,+ )+ def test_row3_every_conversion_error_names_fp8(self, monkeypatch, converts, error):+ from soup_cli.config.schema import TrainingConfig++ _card(monkeypatch, (9, 0))+ _break_the_converter(monkeypatch, error)+ out, console = _console()++ with pytest.raises(RuntimeError, match="float8 conversion failed") as info:+ _apply(TrainingConfig(quantization_aware="fp8"), console)++ assert f"{type(error).__name__}: {error}" in str(info.value)+ assert info.value.__cause__ is error+ assert "enabled" not in out.getvalue()diff --git a/tests/test_issue835_fp8_gate.py b/tests/test_issue835_fp8_gate.pyindex d290820f..dd128518 100644--- a/tests/test_issue835_fp8_gate.py+++ b/tests/test_issue835_fp8_gate.py@@ -399,28 +399,7 @@ class TestOneGate:assert seen == ["tensorwise", "tensorwise"]assert converts == ["tensorwise", "tensorwise"]- def test_validate_fp8_config_reports_the_gates_reason(self, gate):- from soup_cli.utils.fp8 import validate_fp8_config- seen, _ = gate- errors = validate_fp8_config("fp8", "transformers", "cuda", recipe="rowwise")- assert "SENTINEL-REASON" in errors- assert seen == ["rowwise"]---class TestValidateFp8Config:- def test_ada_has_no_hardware_error(self, monkeypatch, converts):- from soup_cli.utils.fp8 import validate_fp8_config-- _card(monkeypatch, (8, 9))- assert validate_fp8_config("fp8", "transformers", "cuda") == []-- def test_ampere_has_the_ada_error(self, monkeypatch, converts):- from soup_cli.utils.fp8 import validate_fp8_config-- _card(monkeypatch, (8, 6))- errors = validate_fp8_config("fp8", "transformers", "cuda")- assert any("8.9" in e for e in errors)class TestTheRunStops:@@ -928,18 +907,26 @@ class TestTheTorchaoProbeItself:class TestTheConversionFailedWording:- def test_a_failed_conversion_says_so(self, monkeypatch):- """Round 1 renamed the yellow line; nothing held it (non-blocking, taken)."""+ def test_a_failed_conversion_says_so(self, monkeypatch, converts):+ """Round 1 renamed the yellow line; nothing held it (non-blocking, taken).+ INVERTED by #1152 (ruled 2026-09-22): the failure now stops the run instead+ of printing that line, and its message still names the conversion, not a+ missing torchao."""from soup_cli.config.schema import TrainingConfigfrom soup_cli.utils.v028_features import apply_v028_speed_memory- monkeypatch.setattr("soup_cli.utils.fp8.apply_fp8_training", lambda *a, **k: False)+ def _fail(*_a, **_k):+ raise RuntimeError("conversion blew up")++ _card(monkeypatch, (9, 0))+ monkeypatch.setattr(sys.modules["torchao.float8"], "convert_to_float8_training", _fail)out, console = TestTheRunStops()._console()- applied = apply_v028_speed_memory(- model=_Attn(), tcfg=TrainingConfig(quantization_aware="fp8"), base_model="m",- console=console, device="cuda",- )+ with pytest.raises(RuntimeError) as info:+ apply_v028_speed_memory(+ model=_Attn(), tcfg=TrainingConfig(quantization_aware="fp8"), base_model="m",+ console=console, device="cuda",+ )- assert applied["fp8"] is False- assert "the float8 conversion failed" in out.getvalue()- assert "torchao.float8 missing" not in out.getvalue()+ assert "the float8 conversion failed" in str(info.value)+ assert "torchao.float8 missing" not in str(info.value)+ assert out.getvalue() == ""diff --git a/tests/test_training_speed.py b/tests/test_training_speed.pyindex c2970313..08ea4bfe 100644--- a/tests/test_training_speed.py+++ b/tests/test_training_speed.py@@ -674,42 +674,6 @@ class TestFP8Availability:assert is_fp8_gpu_supported() is True-class TestFP8Validation:- """FP8 training config validation."""-- def test_validate_fp8_not_requested_returns_empty(self):- from soup_cli.utils.fp8 import validate_fp8_config-- errors = validate_fp8_config(False, "transformers", "cuda")- assert errors == []-- def test_validate_fp8_bool_returns_empty(self):- """Bool True means int8 QAT (existing path), not FP8."""- from soup_cli.utils.fp8 import validate_fp8_config-- errors = validate_fp8_config(True, "transformers", "cuda")- # Bool True is int8 QAT, handled by qat.py, not fp8- assert errors == []-- def test_validate_fp8_cpu_rejected(self):- from soup_cli.utils.fp8 import validate_fp8_config-- errors = validate_fp8_config("fp8", "transformers", "cpu")- assert any("CUDA" in err for err in errors)-- def test_validate_fp8_unsloth_rejected(self):- from soup_cli.utils.fp8 import validate_fp8_config-- errors = validate_fp8_config("fp8", "unsloth", "cuda")- assert any("unsloth" in err.lower() for err in errors)-- def test_validate_fp8_mlx_rejected(self):- from soup_cli.utils.fp8 import validate_fp8_config-- errors = validate_fp8_config("fp8", "mlx", "mps")- assert any("mlx" in err.lower() or "CUDA" in err for err in errors)--# ─── Part C: Gradient checkpointing tiers ─────────────────────────────────diff --git a/tests/test_v07121.py b/tests/test_v07121.pyindex 78043781..094fe8a6 100644--- a/tests/test_v07121.py+++ b/tests/test_v07121.py@@ -419,7 +419,9 @@ class TestV028PrecisionWiring:"cut_ce": False, "fp8": False, "kernel_auto_compose": False,}- def test_fp8_attention_gate_failure_degrades(self, monkeypatch):+ def test_fp8_attention_gate_failure_stops(self, monkeypatch):+ """INVERTED by #1152 (ruled 2026-09-24): this pinned the failure degrading+ to ``fp8_attention: False`` while training went on. It now stops the run."""from soup_cli.utils.v028_features import apply_v028_speed_memorydef _gate(model, **kwargs):@@ -433,12 +435,12 @@ class TestV028PrecisionWiring:# quantization_aware: fp8 is set too, and a missing torchao now stops the# run (#835 ruling); this test is about fp8_attention, so stub that half.monkeypatch.setattr("soup_cli.utils.fp8.apply_fp8_training", lambda *_a, **_k: True)- result = apply_v028_speed_memory(- model=object(),- tcfg=self._tcfg(quantization_aware="fp8", fp8_attention=True),- base_model="x/y",- )- assert result["fp8_attention"] is False+ with pytest.raises(RuntimeError, match="no Hopper"):+ apply_v028_speed_memory(+ model=object(),+ tcfg=self._tcfg(quantization_aware="fp8", fp8_attention=True),+ base_model="x/y",+ )def test_fp8_attention_applied(self, monkeypatch):from soup_cli.utils.v028_features import apply_v028_speed_memory@@ -1765,7 +1767,8 @@ class TestReviewFollowupsPrecision:def test_v028_degrade_is_hermetic(self, monkeypatch):"""Force the degrade path by patching the converters directly —environment-independent (review fix: the original test relied on- the host lacking torchao/Hopper)."""+ the host lacking torchao/Hopper). #1152: ``fp8_attention`` no longer+ degrades, it stops the run, so NVFP4's degrade is checked without it."""from soup_cli.config.loader import load_config_from_stringfrom soup_cli.utils import advanced_precision, v028_features@@ -1779,23 +1782,29 @@ class TestReviewFollowupsPrecision:# quantization_aware: fp8 is set too, and a missing torchao now stops the# run (#835 ruling); this test is about fp8_attention, so stub that half.monkeypatch.setattr("soup_cli.utils.fp8.apply_fp8_training", lambda *_a, **_k: True)- cfg = load_config_from_string(- "base: test-llama\n"- "task: sft\n"- "training:\n"- " quantization_aware: fp8\n"- " fp8_attention: true\n"- " nvfp4: true\n"- "data:\n"- " train: data.jsonl\n"- "output: ./out\n"- )- applied = v028_features.apply_v028_speed_memory(- model=object(), tcfg=cfg.training, base_model=cfg.base,- console=None, device="cpu", backend="transformers",- )- assert applied.get("fp8_attention") is False+ def _cfg(fp8_attention):+ return load_config_from_string(+ "base: test-llama\n"+ "task: sft\n"+ "training:\n"+ " quantization_aware: fp8\n"+ f" fp8_attention: {str(fp8_attention).lower()}\n"+ " nvfp4: true\n"+ "data:\n"+ " train: data.jsonl\n"+ "output: ./out\n"+ )++ def _apply(cfg):+ return v028_features.apply_v028_speed_memory(+ model=object(), tcfg=cfg.training, base_model=cfg.base,+ console=None, device="cpu", backend="transformers",+ )++ applied = _apply(_cfg(False))assert applied.get("nvfp4") is False+ with pytest.raises(RuntimeError, match="gate fired"):+ _apply(_cfg(True))class TestReviewFollowupsSleepMode: