{"record":{"id":"bd2b0c336518545c","repo":"unslothai/unsloth","slug":"the-requested-lora-adapters-could-not-be-applied","errorCode":null,"errorMessage":"The requested LoRA adapters could not be applied: baking adapters requires the quantized (int8/fp8) transformer build, which was declined or failed on this device (see the server log), and the GGUF fallback cannot carry them. Retry without transformer_quant adapters, free VRAM, or pick a smaller model.","messagePattern":"The requested LoRA adapters could not be applied: baking adapters requires the quantized \\(int8/fp8\\) transformer build, which was declined or failed on this device \\(see the server log\\), and the GGUF fallback cannot carry them\\. Retry without transformer_quant adapters, free VRAM, or pick a smaller model\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"studio/backend/core/inference/diffusion.py","lineNumber":3762,"sourceCode":"                        # Drop the exception before clearing the cache: its traceback pins the dense transformer's VRAM.\n                        del exc\n                        # Guarded: a sticky CUDA error can raise; the fallback must reach the GGUF build.\n                        try:\n                            clear_gpu_cache()\n                        except Exception:  # noqa: BLE001\n                            pass\n                if transformer_quant_engaged is not None and quant_plan is not None:\n                    # The engaged dense build uses the re-planned placement; the GGUF-size plan stays for fallback.\n                    plan = quant_plan\n\n                if (\n                    pipe is None\n                    and kind == \"gguf\"\n                    and normalize_transformer_quant(transformer_quant) is not None\n                    and _has_active_lora(loras)\n                ):\n                    # Adapters were requested BAKED but that build failed, and the GGUF fallback cannot carry them; fail loudly.\n                    raise RuntimeError(\n                        \"The requested LoRA adapters could not be applied: baking adapters \"\n                        \"requires the quantized (int8/fp8) transformer build, which was \"\n                        \"declined or failed on this device (see the server log), and the \"\n                        \"GGUF fallback cannot carry them. Retry without transformer_quant \"\n                        \"adapters, free VRAM, or pick a smaller model.\"\n                    )\n\n                # Fail closed on a declined EXPLICIT precision. Loading the GGUF here produced a\n                # perfectly good image at a precision the caller never asked for, and nothing in\n                # the response said so, which is why a successful render could not be taken as\n                # proof the requested precision ran. `auto` is untouched: falling down the ladder\n                # is what it asks for.\n                if (\n                    pipe is None\n                    and transformer_quant_pinned is not None\n                    and not precision_fallback_allowed()\n                ):\n                    raise RuntimeError(","sourceCodeStart":3744,"sourceCodeEnd":3780,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/core/inference/diffusion.py#L3744-L3780","documentation":"Raised during model load when LoRA adapters were requested alongside a transformer_quant (int8/fp8) build, that quantized build was declined or failed on the host (typically VRAM limits), and the code fell back to the GGUF pipeline. The GGUF fallback path cannot carry (bake) LoRA adapters, so rather than silently producing images without the requested adapters, the loader fails loudly. This is a deliberate fail-closed design: the render would succeed but not with the requested LoRA effects.","triggerScenarios":"Calling model load with both a non-empty `loras` list (with active adapters, checked via `_has_active_lora`) and `transformer_quant` set to int8/fp8, on a host where the quantized dense transformer build fails or is declined (insufficient VRAM), while the pipeline kind resolves to \"gguf\". The raise fires only when `pipe is None` (quant build produced no pipeline) and the GGUF fallback is the remaining path.","commonSituations":"Low-VRAM GPU hosts where torchao int8/fp8 quantization of the transformer OOMs during build; users combining GGUF checkpoint repos with quantized-transformer requests and LoRA stacks; drivers/compute caps that make the quantized build unavailable so the ladder falls to GGUF.","solutions":["Retry the load without the transformer_quant LoRA plan: drop the transformer_quant adapters from the request or set transformer_quant to a mode the host can actually build.","Free VRAM (close other models/GPU processes, unload resident pipelines) so the quantized int8/fp8 transformer build succeeds and adapters can be baked into it.","Pick a smaller model checkpoint whose quantized build fits, letting the LoRA bake proceed.","Run the LoRA on the native engine (sd_cpp) if keeping GGUF weights is required."],"exampleFix":"// before\nawait diffusion.load(model=\"big-gguf-repo\", transformer_quant=\"int8\", loras=[{\"id\":\"my-lora\",\"scale\":1.0}]);\n// after: host cannot build the quantized transformer, so do not request quant+baked LoRA\nawait diffusion.load(model=\"big-gguf-repo\", transformer_quant=null, loras=[{\"id\":\"my-lora\",\"scale\":1.0}]);","handlingStrategy":"fallback","validationCode":"# Before load: probe whether the quantized transformer build is viable on this host\n capabilities = diffusion.capabilities()  # or server status endpoint\n if loras and not capabilities.get(\"transformer_quant_build_ok\"):\n     plan = {\"transformer_quant\": None, \"loras\": loras}  # skip quant+bake\n else:\n     plan = {\"transformer_quant\": \"int8\", \"loras\": loras}","typeGuard":"def wants_baked_lora(req: LoadRequest) -> bool:\n    \"\"\"True when the request asks for adapters that must be baked into a quant build.\"\"\"\n    return bool(req.loras) and any(l.scale for l in req.loras) and req.transformer_quant in (\"int8\", \"fp8\")","tryCatchPattern":"try:\n    await diffusion.load(model, transformer_quant=\"int8\", loras=loras)\nexcept RuntimeError as e:\n    if \"could not be applied\" in str(e) and \"GGUF fallback\" in str(e):\n        await diffusion.load(model, transformer_quant=None, loras=loras)  # dense/GGUF without bake\n    else:\n        raise","preventionTips":["Treat quant+baked-LoRA as one atomic capability: probe host VRAM and quant-build support before requesting it.","Free VRAM (unload resident pipelines) before a load that must bake adapters.","Watch the server log for quant-build decline lines; they precede this error."],"tags":["diffusion","lora","quantization","vram","model-loading"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}