Skip to content

[bug]: Krea 2 DoRA LoRAs fail with unsupported magnitude tensor format #9515

Description

@khronimo

Is there an existing issue for this problem?

  • I have searched the existing issues

Install method

Invoke's Launcher

Operating system

Windows

GPU vendor

Nvidia (CUDA)

GPU model

RTX3090

GPU VRAM

24GB

Version number

v6.14.0rc2

Browser

No response

System Information

No response

What happened

Krea 2 DoRA LoRAs trained with ai-toolkit fail to load

InvokeAI errors with:

ValueError: Unsupported lora format: dict_keys([
    'to_gate.magnitude',
    'to_k.magnitude',
    'to_q.magnitude',
    'to_v.magnitude'
])
Traceback ``` [2026-08-18 10:31:38,699]::[InvokeAI]::ERROR --> Error while invoking session a85e0f06-6bcf-42cc-bc0f-0 513da1f02f4, invocation 39a9bbcb-5292-4d62-941a-24ad7427ce0f (krea2_text_encoder): Unsupported lora for mat: dict_keys(['to_gate.magnitude', 'to_k.magnitude', 'to_q.magnitude', 'to_v.magnitude']) [2026-08-18 10:31:38,699]::[InvokeAI]::ERROR --> Traceback (most recent call last): File "I:\InvokeAI\.venv\Lib\site-packages\invokeai\app\services\session_processor\session_processor_d efault.py", line 167, in run_node output = invocation.invoke_internal(context=context, services=self._services) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "I:\InvokeAI\.venv\Lib\site-packages\invokeai\app\invocations\baseinvocation.py", line 248, in i nvoke_internal output = self.invoke(context) ^^^^^^^^^^^^^^^^^^^^ File "I:\InvokeAI\.venv\Lib\site-packages\torch\utils\_contextlib.py", line 116, in decorate_context return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "I:\InvokeAI\.venv\Lib\site-packages\invokeai\app\invocations\krea2_text_encoder.py", line 73, i n invoke prompt_embeds, prompt_mask = self._encode(context) ^^^^^^^^^^^^^^^^^^^^^ File "I:\InvokeAI\.venv\Lib\site-packages\invokeai\app\invocations\krea2_text_encoder.py", line 104, in _encode exit_stack.enter_context( File "C:\Users\niccj\AppData\Roaming\uv\python\cpython-3.12.9-windows-x86_64-none\Lib\contextlib.py", line 526, in enter_context result = _enter(cm) ^^^^^^^^^^ File "C:\Users\niccj\AppData\Roaming\uv\python\cpython-3.12.9-windows-x86_64-none\Lib\contextlib.py", line 137, in __enter__ return next(self.gen) ^^^^^^^^^^^^^^ File "I:\InvokeAI\.venv\Lib\site-packages\invokeai\backend\patches\layer_patcher.py", line 57, in app ly_smart_model_patches for patch_spec in patches: ^^^^^^^ File "I:\InvokeAI\.venv\Lib\site-packages\invokeai\app\invocations\krea2_text_encoder.py", line 165, in _lora_iterator lora_info = context.models.load(lora.lora) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "I:\InvokeAI\.venv\Lib\site-packages\invokeai\app\services\shared\invocation_context.py", line 5 39, in load return self._services.model_manager.load.load_model(model, submodel_type, user_id=self._data.queue_ item.user_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^ File "I:\InvokeAI\.venv\Lib\site-packages\invokeai\app\services\model_load\model_load_default.py", li ne 100, in load_model ).load_model(model_config, submodel_type) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "I:\InvokeAI\.venv\Lib\site-packages\invokeai\backend\model_manager\load\load_default.py", line 195, in load_model cache_record = self._load_and_cache(model_config, submodel_type) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "I:\InvokeAI\.venv\Lib\site-packages\invokeai\backend\model_manager\load\load_default.py", line 280, in _load_and_cache loaded_model = put_in_eval_mode(self._load_model(config, submodel_type)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "I:\InvokeAI\.venv\Lib\site-packages\invokeai\backend\model_manager\load\model_loaders\lora.py", line 182, in _load_model model = lora_model_from_krea2_state_dict(state_dict=state_dict, alpha=None) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "I:\InvokeAI\.venv\Lib\site-packages\invokeai\backend\patches\lora_conversions\krea2_lora_conver sion_utils.py", line 172, in lora_model_from_krea2_state_dict layers[final_key] = any_lora_layer_from_state_dict(values) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "I:\InvokeAI\.venv\Lib\site-packages\invokeai\backend\patches\layers\utils.py", line 35, in any_ lora_layer_from_state_dict raise ValueError(f"Unsupported lora format: {state_dict.keys()}") ValueError: Unsupported lora format: dict_keys(['to_gate.magnitude', 'to_k.magnitude', 'to_q.magnitude' , 'to_v.magnitude']) ```

What you expected to happen

The lora should load and apply normally.

How to reproduce the problem

  1. Use Krea 2 in InvokeAI.
  2. Add the test DoRA LoRA: https://huggingface.co/khronex/krea2-dora-ehrmantraut-test
  3. Apply the LoRA to a generation.
  4. Run the generation.

Additional context

The test LoRA was trained with ai-toolkit 0.10.17 using:

    network:
      type: dora
      linear: 32
      linear_alpha: 32
      lokr_full_rank: true
      lokr_factor: -1

The huggingface repo linked above also includes the SafeTensors header, tensor key list, and traceback for InvokeAI error.

This appears separate from #9424, which is for Krea 2 LoKr/LyCORIS support.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions