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(autopilot): keep DoRA off on GPTQ/AWQ/AQLM/EETQ bases (#1466) (#1473)
Y.B.5c0b0d1852cd
diff --git a/changelog.d/0.75.1/1473.fixed.md b/changelog.d/0.75.1/1473.fixed.mdnew file mode 100644index 00000000..83b91a6c--- /dev/null+++ b/changelog.d/0.75.1/1473.fixed.md@@ -0,0 +1,4 @@+- Autopilot no longer enables DoRA on a GPTQ / AWQ / AQLM / EETQ base. peft+ refuses DoRA on those layers, so a large dataset produced a config that+ failed after the model load. `decide_peft` takes the chosen `quantization`+ and keeps `use_dora` off for them (#1466 by @drakeo338 in #1473).diff --git a/src/soup_cli/autopilot/decisions.py b/src/soup_cli/autopilot/decisions.pyindex bc2fc8e9..ef966b9e 100644--- a/src/soup_cli/autopilot/decisions.py+++ b/src/soup_cli/autopilot/decisions.py@@ -259,9 +259,16 @@ def decide_quantization(def decide_peft(- data_size: int, model_size_b: float, vram_gb: float,+ data_size: int,+ model_size_b: float,+ vram_gb: float,+ quantization: str | None = None,) -> dict[str, Any]:- """Pick a LoRA rank and settings based on dataset + model + VRAM."""+ """Pick a LoRA rank and settings based on dataset + model + VRAM.++ ``quantization`` is the format chosen for the base. peft cannot apply DoRA+ to GPTQ / AWQ / AQLM / EETQ layers, so DoRA stays off for those.+ """if data_size < 1000:rank = 8elif data_size < 10_000:@@ -271,6 +278,8 @@ def decide_peft(rank = 32alpha = rank * 2use_dora = data_size > 100_000 and vram_gb >= 2.0 * model_size_b+ if quantization in ("gptq", "awq", "aqlm", "eetq"):+ use_dora = Falsereturn {"r": rank,"alpha": alpha,diff --git a/src/soup_cli/autopilot/generate_config.py b/src/soup_cli/autopilot/generate_config.pyindex 80a178a4..6437e7b5 100644--- a/src/soup_cli/autopilot/generate_config.py+++ b/src/soup_cli/autopilot/generate_config.py@@ -60,6 +60,7 @@ def build_soup_config(data_size=dataset_profile.samples,model_size_b=model_profile.params_b,vram_gb=target_vram,+ quantization=quantization,)max_length = decide_max_length(p95_tokens=dataset_profile.p95_tokens,diff --git a/tests/test_autopilot.py b/tests/test_autopilot.pyindex dd171d3a..b6c63579 100644--- a/tests/test_autopilot.py+++ b/tests/test_autopilot.py@@ -160,6 +160,16 @@ class TestDecisionEngine:spacious = decide_peft(data_size=200_000, model_size_b=8.0, vram_gb=80.0)assert spacious["use_dora"] is True+ @pytest.mark.parametrize("quant", ["gptq", "awq", "aqlm", "eetq"])+ def test_decide_peft_no_dora_on_prequantized(self, quant):+ """peft cannot apply DoRA to these layers; bnb / none keep it (#1466)."""+ from soup_cli.autopilot.decisions import decide_peft++ kwargs = {"data_size": 200_000, "model_size_b": 8.0, "vram_gb": 80.0}+ assert decide_peft(**kwargs, quantization=quant)["use_dora"] is False+ assert decide_peft(**kwargs, quantization="4bit")["use_dora"] is True+ assert decide_peft(**kwargs, quantization="none")["use_dora"] is True+def test_decide_lr_scales_with_rank(self):from soup_cli.autopilot.decisions import decide_lr@@ -280,6 +290,31 @@ class TestBuildConfig:assert cfg.task == "sft"assert cfg.training.quantization in ("4bit", "8bit", "none")+ @pytest.mark.parametrize(+ "model, expected",+ [+ ("TheBloke/Mistral-7B-Instruct-v0.2-GPTQ", "gptq"),+ ("TheBloke/Mistral-7B-Instruct-v0.2-AWQ", "awq"),+ ],+ )+ def test_build_soup_config_no_dora_on_prequantized_base(self, tmp_path, model, expected):+ """peft refuses DoRA on GPTQ / AWQ / AQLM / EETQ layers (#1466)."""+ from soup_cli.autopilot.generate_config import build_soup_config++ data_file = tmp_path / "big.jsonl"+ data_file.write_text(+ "".join(+ json.dumps({"instruction": f"q{i}", "output": f"a{i}"}) + "\n"+ for i in range(100_001)+ ),+ encoding="utf-8",+ )+ cfg = build_soup_config(+ model=model, data_path=str(data_file), goal="chat", vram_gb=24.0,+ )+ assert cfg.training.quantization == expected+ assert cfg.training.lora.use_dora is False+def test_write_yaml(self, tmp_path):from soup_cli.autopilot.generate_config import build_soup_config, write_yaml