InvokeAI icon indicating copy to clipboard operation
InvokeAI copied to clipboard

[bug]: SDXL Lora no longer works: The base model quantization format is not compatible with DoRA patches

Open CubeTheThird opened this issue 2 months ago • 1 comments

Is there an existing issue for this problem?

  • [x] I have searched the existing issues

Install method

Manual

Operating system

Linux

GPU vendor

AMD (ROCm)

GPU model

RX 6700XT

GPU VRAM

12GB

Version number

5.9.0

Browser

Firefox 143.0.4

System Information

{ "version": "6.9.0", "dependencies": { "absl-py" : "2.3.1", "accelerate" : "1.10.1", "annotated-types" : "0.7.0", "anyio" : "4.11.0", "attrs" : "25.4.0", "bidict" : "0.23.1", "bitsandbytes" : "0.48.1", "blake3" : "1.0.8", "certifi" : "2022.12.7", "cffi" : "2.0.0", "charset-normalizer" : "2.1.1", "click" : "8.3.0", "coloredlogs" : "15.0.1", "compel" : "2.1.1", "contourpy" : "1.3.3", "CUDA" : "N/A", "cycler" : "0.12.1", "Deprecated" : "1.2.18", "diffusers" : "0.33.0", "dnspython" : "2.8.0", "dynamicprompts" : "0.31.0", "einops" : "0.8.1", "fastapi" : "0.118.3", "fastapi-events" : "0.12.2", "filelock" : "3.19.1", "flatbuffers" : "25.9.23", "fonttools" : "4.60.1", "fsspec" : "2025.9.0", "gguf" : "0.17.1", "h11" : "0.16.0", "hf-xet" : "1.1.10", "httptools" : "0.7.1", "huggingface-hub" : "0.35.3", "humanfriendly" : "10.0", "idna" : "3.4", "importlib_metadata" : "8.7.0", "iniconfig" : "2.1.0", "invisible-watermark" : "0.2.0", "InvokeAI" : "6.9.0", "jax" : "0.7.1", "jaxlib" : "0.7.1", "Jinja2" : "3.1.6", "kiwisolver" : "1.4.9", "lion-pytorch" : "0.2.3", "MarkupSafe" : "2.1.5", "matplotlib" : "3.10.7", "mediapipe" : "0.10.14", "ml_dtypes" : "0.5.3", "mpmath" : "1.3.0", "networkx" : "3.5", "numpy" : "1.26.3", "onnx" : "1.16.1", "onnxruntime" : "1.19.2", "opencv-contrib-python": "4.11.0.86", "opencv-python" : "4.11.0.86", "opt_einsum" : "3.4.0", "packaging" : "24.1", "pandas" : "2.2.3", "picklescan" : "0.0.31", "pillow" : "11.3.0", "pluggy" : "1.5.0", "prompt_toolkit" : "3.0.52", "protobuf" : "4.25.8", "psutil" : "7.1.0", "pycparser" : "2.23", "pydantic" : "2.12.2", "pydantic-settings" : "2.11.0", "pydantic_core" : "2.41.4", "pyparsing" : "3.2.5", "PyPatchMatch" : "1.0.2", "pytest" : "8.3.5", "python-dateutil" : "2.9.0.post0", "python-dotenv" : "1.1.1", "python-engineio" : "4.12.3", "python-multipart" : "0.0.20", "python-socketio" : "5.14.2", "pytorch-triton-rocm" : "3.3.1", "pytz" : "2025.2", "PyWavelets" : "1.9.0", "PyYAML" : "6.0.3", "regex" : "2025.9.18", "requests" : "2.28.1", "safetensors" : "0.6.2", "scipy" : "1.16.2", "semver" : "3.0.4", "sentencepiece" : "0.2.0", "setuptools" : "70.2.0", "simple-websocket" : "1.1.0", "six" : "1.17.0", "sniffio" : "1.3.1", "sounddevice" : "0.5.2", "spandrel" : "0.4.1", "starlette" : "0.48.0", "sympy" : "1.14.0", "tokenizers" : "0.22.1", "torch" : "2.7.1+rocm6.2.4", "torchsde" : "0.2.6", "torchvision" : "0.22.1+rocm6.2.4", "tqdm" : "4.66.5", "trampoline" : "0.1.2", "transformers" : "4.57.1", "typing-inspection" : "0.4.2", "typing_extensions" : "4.15.0", "tzdata" : "2025.2", "urllib3" : "1.26.13", "uvicorn" : "0.37.0", "uvloop" : "0.22.1", "watchfiles" : "1.1.1", "wcwidth" : "0.2.14", "websockets" : "15.0.1", "wheel" : "0.43.0", "wrapt" : "1.17.3", "wsproto" : "1.2.0", "zipp" : "3.23.0" }, "config": { "schema_version": "4.0.2", "legacy_models_yaml_path": null, "host": "127.0.0.1", "port": 9090, "allow_origins": [], "allow_credentials": true, "allow_methods": [""], "allow_headers": [""], "ssl_certfile": null, "ssl_keyfile": null, "log_tokenization": false, "patchmatch": true, "models_dir": "models", "convert_cache_dir": "models/.convert_cache", "download_cache_dir": "models/.download_cache", "legacy_conf_dir": "configs", "db_dir": "databases", "outputs_dir": "outputs", "custom_nodes_dir": "nodes", "style_presets_dir": "style_presets", "workflow_thumbnails_dir": "workflow_thumbnails", "log_handlers": ["console"], "log_format": "color", "log_level": "info", "log_sql": false, "log_level_network": "warning", "use_memory_db": false, "dev_reload": false, "profile_graphs": false, "profile_prefix": null, "profiles_dir": "profiles", "max_cache_ram_gb": null, "max_cache_vram_gb": null, "log_memory_usage": false, "device_working_mem_gb": 8, "enable_partial_loading": true, "keep_ram_copy_of_weights": true, "ram": null, "vram": null, "lazy_offload": true, "pytorch_cuda_alloc_conf": null, "device": "auto", "precision": "auto", "sequential_guidance": false, "attention_type": "sliced", "attention_slice_size": "balanced", "force_tiled_decode": false, "pil_compress_level": 1, "max_queue_size": 10000, "clear_queue_on_startup": false, "allow_nodes": null, "deny_nodes": null, "node_cache_size": 512, "hashing_algorithm": "blake3_single", "remote_api_tokens": null, "scan_models_on_startup": false, "unsafe_disable_picklescan": false, "allow_unknown_models": true }, "set_config_fields": [ "outputs_dir", "attention_type", "legacy_models_yaml_path", "device_working_mem_gb", "enable_partial_loading", "attention_slice_size" ] }

What happened

An SDXL LoRA that previously worked (Either on 6.6.0 or 6.7.0) is no longer able to load.

The model file can be found here https://civitai.com/models/971952/stabilizer-ilnai

Note this is a LoRA for NoobAIXL Vpred, however base models of this flavour work fine.

Using it results in this stacktrace:

[2025-10-08 08:13:30,264]::[InvokeAI]::ERROR --> Error while invoking session 106a5ee4-548c-4cab-86cd-9c1139935d0d, invocation 9260f05b-234b-4fc5-9348-95a3ea847361 (denoise_latents): The base model quantization format (likely bitsandbytes) is not compatible with DoRA patches.
[2025-10-08 08:13:30,264]::[InvokeAI]::ERROR --> Traceback (most recent call last):
  File ".venv2/lib/python3.12/site-packages/invokeai/app/services/session_processor/session_processor_default.py", line 130, in run_node
    output = invocation.invoke_internal(context=context, services=self._services)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv2/lib/python3.12/site-packages/invokeai/app/invocations/baseinvocation.py", line 241, in invoke_internal
    output = self.invoke(context)
             ^^^^^^^^^^^^^^^^^^^^
  File ".venv2/lib/python3.12/site-packages/invokeai/app/invocations/denoise_latents.py", line 825, in invoke
    return self._old_invoke(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv2/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File ".local/share/uv/python/cpython-3.12.10-linux-x86_64-gnu/lib/python3.12/contextlib.py", line 81, in inner
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
  File ".venv2/lib/python3.12/site-packages/invokeai/app/invocations/denoise_latents.py", line 1088, in _old_invoke
    result_latents = pipeline.latents_from_embeddings(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv2/lib/python3.12/site-packages/invokeai/backend/stable_diffusion/diffusers_pipeline.py", line 397, in latents_from_embeddings
    step_output = self.step(
                  ^^^^^^^^^^
  File ".venv2/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File ".venv2/lib/python3.12/site-packages/invokeai/backend/stable_diffusion/diffusers_pipeline.py", line 548, in step
    uc_noise_pred, c_noise_pred = self.invokeai_diffuser.do_unet_step(
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv2/lib/python3.12/site-packages/invokeai/backend/stable_diffusion/diffusion/shared_invokeai_diffusion.py", line 199, in do_unet_step
    ) = self._apply_standard_conditioning(
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv2/lib/python3.12/site-packages/invokeai/backend/stable_diffusion/diffusion/shared_invokeai_diffusion.py", line 343, in _apply_standard_conditioning
    both_results = self.model_forward_callback(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv2/lib/python3.12/site-packages/invokeai/backend/stable_diffusion/diffusers_pipeline.py", line 611, in _unet_forward
    return self.unet(
           ^^^^^^^^^^
  File ".venv2/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1751, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv2/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1762, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv2/lib/python3.12/site-packages/diffusers/models/unets/unet_2d_condition.py", line 1279, in forward
    sample = upsample_block(
             ^^^^^^^^^^^^^^^
  File ".venv2/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1751, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv2/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1762, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv2/lib/python3.12/site-packages/diffusers/models/unets/unet_2d_blocks.py", line 2457, in forward
    hidden_states = resnet(hidden_states, temb)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv2/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1751, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv2/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1762, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv2/lib/python3.12/site-packages/diffusers/models/resnet.py", line 369, in forward
    input_tensor = self.conv_shortcut(input_tensor.contiguous())
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv2/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1751, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv2/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1762, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv2/lib/python3.12/site-packages/invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_conv2d.py", line 39, in forward
    return self._autocast_forward_with_patches(input)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv2/lib/python3.12/site-packages/invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_conv2d.py", line 22, in _autocast_forward_with_patches
    aggregated_param_residuals = self._aggregate_patch_parameters(
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv2/lib/python3.12/site-packages/invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_module_mixin.py", line 71, in _aggregate_patch_parameters
    layer_params = patch.get_parameters(orig_params, weight=patch_weight)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv2/lib/python3.12/site-packages/invokeai/backend/patches/layers/dora_layer.py", line 99, in get_parameters
    raise RuntimeError(
RuntimeError: The base model quantization format (likely bitsandbytes) is not compatible with DoRA patches.

What you expected to happen

For the model to load correctly.

How to reproduce the problem

Download the lora (currently version 0.271) and use it with an SDXL model.

Additional context

As I am on AMD, I do not have bitsandbytes support, so I am unsure why the log references it.

Discord username

cubethethird

CubeTheThird avatar Oct 17 '25 01:10 CubeTheThird

I have found the cause of this error. It only occurs when setting enable_partial_loading=true, due to the way this chunk of the dora_layer.py code works:

def get_parameters(self, orig_parameters: dict[str, torch.Tensor], weight: float) -> dict[str, torch.Tensor]:
        if any(p.device.type == "meta" for p in orig_parameters.values()):
            # If any of the original parameters are on the 'meta' device, we assume this is because the base model is in
            # a quantization format that doesn't allow easy dequantization.
            raise RuntimeError(
                "The base model quantization format (likely bitsandbytes) is not compatible with DoRA patches."
            )

CubeTheThird avatar Oct 21 '25 13:10 CubeTheThird