{"record":{"id":"e3ec82395e754431","repo":"unslothai/unsloth","slug":"lora-is-not-supported-for-this-model-quantisation","errorCode":null,"errorMessage":"LoRA is not supported for this model/quantisation on the diffusers engine (GGUF-via-diffusers, or a torch.compile'd Speed=default/max load). Reload with transformer_quant int8 or fp8, which rebuilds the GGUF into a LoRA-capable dense transformer, or use a bf16 / bnb-4bit load at Speed=off/eager. To keep the GGUF weights themselves, run the native engine, which a GPU host selects only when UNSLOTH_DIFFUSION_ENGINE=sd_cpp is set.","messagePattern":"LoRA is not supported for this model/quantisation on the diffusers engine \\(GGUF-via-diffusers, or a torch\\.compile'd Speed=default/max load\\)\\. Reload with transformer_quant int8 or fp8, which rebuilds the GGUF into a LoRA-capable dense transformer, or use a bf16 / bnb-4bit load at Speed=off/eager\\. To keep the GGUF weights themselves, run the native engine, which a GPU host selects only when UNSLOTH_DIFFUSION_ENGINE=sd_cpp is set\\.","errorType":"validation","errorClass":"ValueError","httpStatus":400,"severity":"error","filePath":"studio/backend/core/inference/diffusion.py","lineNumber":5049,"sourceCode":"\n        if not specs:\n            if current:\n                try:\n                    pipe.unload_lora_weights()\n                except Exception:  # noqa: BLE001 -- best-effort clear\n                    pass\n                pipe._unsloth_loras = ()\n            return\n\n        if not diffusion_lora.supports_lora(\n            engine = \"diffusers\",\n            family = getattr(state.family, \"name\", None),\n            model_kind = state.kind,\n            transformer_quant = state.transformer_quant,\n            compiled = \"compiled\" in (getattr(state, \"speed_optims\", ()) or ()),\n        ):\n            # Name only routes the user can actually reach: a GPU host never selects the native engine on its own.\n            raise ValueError(\n                \"LoRA is not supported for this model/quantisation on the diffusers engine \"\n                \"(GGUF-via-diffusers, or a torch.compile'd Speed=default/max load). Reload with \"\n                \"transformer_quant int8 or fp8, which rebuilds the GGUF into a LoRA-capable dense \"\n                \"transformer, or use a bf16 / bnb-4bit load at Speed=off/eager. To keep the GGUF \"\n                \"weights themselves, run the native engine, which a GPU host selects only when \"\n                \"UNSLOTH_DIFFUSION_ENGINE=sd_cpp is set.\"\n            )\n\n        desired = self._resolve_lora_set(\n            specs,\n            family = getattr(state.family, \"name\", None),\n            hf_token = state.hf_token,\n            cancel = cancel,\n        )\n        uniq = list(desired)\n        if desired == current:\n            return\n        try:","sourceCodeStart":5031,"sourceCodeEnd":5067,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/core/inference/diffusion.py#L5031-L5067","documentation":"Raised by `_apply_loras` when `diffusion_lora.supports_lora` reports the current combination -- diffusers engine, this family, model_kind (GGUF-via-diffusers), transformer_quant state, or a compiled Speed=default/max load -- cannot host LoRA adapters. GGUF-via-diffusers transformers and torch.compile'd quantized builds have immutable module topology, so `load_lora_weights` cannot inject adapters. The long message enumerates only routes the user can actually reach: GPU hosts never auto-select the native engine.","triggerScenarios":"Calling generate() with non-empty loras on a state where `state.kind` is gguf (GGUF loaded through diffusers) or where 'compiled' is in state.speed_optims (Speed=default/max), with transformer_quant not producing a LoRA-capable dense build. `supports_lora(engine, family, model_kind, transformer_quant, compiled)` returns False.","commonSituations":"Loading a GGUF checkpoint for VRAM savings then attaching LoRAs; enabling torch.compile speed optimizations and expecting hot-swappable adapters; users unaware that int8/fp8 rebuilds GGUF into a dense, LoRA-capable transformer.","solutions":["Reload with transformer_quant int8 or fp8, which rebuilds the GGUF into a LoRA-capable dense transformer.","Reload as bf16 or bnb-4bit with Speed=off/eager (no compile) and apply the LoRAs.","Run the native engine (set UNSLOTH_DIFFUSION_ENGINE=sd_cpp) to keep the GGUF weights themselves with LoRA support."],"exampleFix":"# before: GGUF via diffusers + LoRA -> ValueError\ndiffusion.load(model=\"flux-gguf\", speed=\"max\")\ndiffusion.generate(prompt=\"...\", loras=[(\"my-lora\", 1.0)])\n# after: int8 rebuild bakes LoRA capability\ndiffusion.load(model=\"flux-gguf\", transformer_quant=\"int8\", loras=[(\"my-lora\", 1.0)])","handlingStrategy":"validation","validationCode":"from core.inference import diffusion_lora\nif loras and not diffusion_lora.supports_lora(\n    engine=\"diffusers\", family=fam.name, model_kind=state.kind,\n    transformer_quant=state.transformer_quant,\n    compiled=\"compiled\" in (state.speed_optims or ())):\n    raise ValueError(\"reload with transformer_quant int8/fp8 or eager bf16 before LoRA\")","typeGuard":"def lora_compatible(state) -> bool:\n    \"\"\"Loaded state can host LoRA: not GGUF-via-diffusers, not compiled.\"\"\"\n    return state.kind != \"gguf\" and \"compiled\" not in (state.speed_optims or ())","tryCatchPattern":"try:\n    diffusion.generate(prompt=p, loras=loras)\nexcept ValueError as e:\n    if \"LoRA is not supported for this model/quantisation\" in str(e):\n        await diffusion.load(model, transformer_quant=\"int8\", loras=loras)  # rebuild dense + bake\n        return diffusion.generate(prompt=p)\n    raise","preventionTips":["Decide LoRA usage at load time, not generate time, on quantized builds.","Know the three viable LoRA routes: quant int8/fp8 rebuild, eager bf16/bnb-4bit, native sd_cpp engine.","Speed=default/max implies torch.compile -- plan LoRAs before enabling it."],"tags":["diffusion","lora","gguf","quantization","torch-compile","engine"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}