unslothai/unsloth · error · ValueError
LoRA is not supported for this model/quantisation on the dif
Error message
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.
What it means
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.
Source
Thrown at studio/backend/core/inference/diffusion.py:5049
if not specs:
if current:
try:
pipe.unload_lora_weights()
except Exception: # noqa: BLE001 -- best-effort clear
pass
pipe._unsloth_loras = ()
return
if not diffusion_lora.supports_lora(
engine = "diffusers",
family = getattr(state.family, "name", None),
model_kind = state.kind,
transformer_quant = state.transformer_quant,
compiled = "compiled" in (getattr(state, "speed_optims", ()) or ()),
):
# Name only routes the user can actually reach: a GPU host never selects the native engine on its own.
raise ValueError(
"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."
)
desired = self._resolve_lora_set(
specs,
family = getattr(state.family, "name", None),
hf_token = state.hf_token,
cancel = cancel,
)
uniq = list(desired)
if desired == current:
return
try:View on GitHub (pinned to 203007d190)
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.
Example fix
# before: GGUF via diffusers + LoRA -> ValueError
diffusion.load(model="flux-gguf", speed="max")
diffusion.generate(prompt="...", loras=[("my-lora", 1.0)])
# after: int8 rebuild bakes LoRA capability
diffusion.load(model="flux-gguf", transformer_quant="int8", loras=[("my-lora", 1.0)]) Defensive patterns
Strategy: validation
Validate before calling
from core.inference import diffusion_lora
if loras and not diffusion_lora.supports_lora(
engine="diffusers", family=fam.name, model_kind=state.kind,
transformer_quant=state.transformer_quant,
compiled="compiled" in (state.speed_optims or ())):
raise ValueError("reload with transformer_quant int8/fp8 or eager bf16 before LoRA") Type guard
def lora_compatible(state) -> bool:
"""Loaded state can host LoRA: not GGUF-via-diffusers, not compiled."""
return state.kind != "gguf" and "compiled" not in (state.speed_optims or ()) Try / catch
try:
diffusion.generate(prompt=p, loras=loras)
except ValueError as e:
if "LoRA is not supported for this model/quantisation" in str(e):
await diffusion.load(model, transformer_quant="int8", loras=loras) # rebuild dense + bake
return diffusion.generate(prompt=p)
raise Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- The requested LoRA adapters could not be applied: baking ada
- GGUF LoRA adapters are not supported on the diffusers engine
- This quantized (int8/fp8) load was built without LoRA adapte
- The LoRA selection changed, but a quantized (int8/fp8) trans
- duplicate LoRA id '{spec.id}'; list each adapter at most onc
AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15).
Data as JSON: /api/errors/e3ec82395e754431.
Report an issue: GitHub.