invoke-ai / InvokeAI

Invoke is a leading creative engine for Stable Diffusion models, empowering professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry leading WebUI, and serves as the foundation for multiple commercial products.
https://invoke-ai.github.io/InvokeAI/
Apache License 2.0
23.41k stars 2.41k forks source link

[bug]: Can't upscale anything. Keep getting "KeyError: 'middle_block_out.0.weight'" error #6925

Open evanerichards opened 3 weeks ago

evanerichards commented 3 weeks ago

Is there an existing issue for this problem?

Operating system

Windows

GPU vendor

Nvidia (CUDA)

GPU model

RTX 3090

GPU VRAM

24GB

Version number

v5.0.0.rc1

Browser

Firefox 130.0.1 (64-bit)

Python dependencies

No response

What happened

have a newly installed version of Invoke v5.0.0.rc1. I take a simple image and try to upscale but I receive this error message: have a newly installed version of Invoke v5.0.0.rc1. I take a simple image and try to upscale but I receive this error message:

[2024-09-23 15:05:39,510]::[InvokeAI]::ERROR --> Error while invoking session 9f8db22a-dc2e-4fef-b19b-5e9672a7e259, invocation d3477dbe-f38e-4ea6-b5bb-bc1c3232d273 (denoise_latents): 'middle_block_out.0.weight'
[2024-09-23 15:05:39,511]::[InvokeAI]::ERROR --> Traceback (most recent call last):
  File "E:\invokeai\.venv\lib\site-packages\invokeai\app\services\session_processor\session_processor_default.py", line 129, in run_node
    output = invocation.invoke_internal(context=context, services=self._services)
  File "E:\invokeai\.venv\lib\site-packages\invokeai\app\invocations\baseinvocation.py", line 290, in invoke_internal
    output = self.invoke(context)
  File "E:\invokeai\.venv\lib\site-packages\invokeai\app\invocations\denoise_latents.py", line 790, in invoke
    return self._old_invoke(context)
  File "E:\invokeai\.venv\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "C:\Users\evane\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "E:\invokeai\.venv\lib\site-packages\invokeai\app\invocations\denoise_latents.py", line 1022, in _old_invoke
    controlnet_data = self.prep_control_data(
  File "E:\invokeai\.venv\lib\site-packages\invokeai\app\invocations\denoise_latents.py", line 437, in prep_control_data
    control_model = exit_stack.enter_context(context.models.load(control_info.control_model))
  File "E:\invokeai\.venv\lib\site-packages\invokeai\app\services\shared\invocation_context.py", line 369, in load
    return self._services.model_manager.load.load_model(model, _submodel_type)
  File "E:\invokeai\.venv\lib\site-packages\invokeai\app\services\model_load\model_load_default.py", line 70, in load_model
    ).load_model(model_config, submodel_type)
  File "E:\invokeai\.venv\lib\site-packages\invokeai\backend\model_manager\load\load_default.py", line 56, in load_model
    locker = self._load_and_cache(model_config, submodel_type)
  File "E:\invokeai\.venv\lib\site-packages\invokeai\backend\model_manager\load\load_default.py", line 77, in _load_and_cache
    loaded_model = self._load_model(config, submodel_type)
  File "E:\invokeai\.venv\lib\site-packages\invokeai\backend\model_manager\load\model_loaders\controlnet.py", line 31, in _load_model
    return ControlNetModel.from_single_file(
  File "E:\invokeai\.venv\lib\site-packages\huggingface_hub\utils\_validators.py", line 114, in _inner_fn
    return fn(*args, **kwargs)
  File "E:\invokeai\.venv\lib\site-packages\diffusers\loaders\controlnet.py", line 124, in from_single_file
    component = create_diffusers_controlnet_model_from_ldm(
  File "E:\invokeai\.venv\lib\site-packages\diffusers\loaders\single_file_utils.py", line 973, in create_diffusers_controlnet_model_from_ldm
    diffusers_format_controlnet_checkpoint = convert_controlnet_checkpoint(checkpoint, diffusers_config)
  File "E:\invokeai\.venv\lib\site-packages\diffusers\loaders\single_file_utils.py", line 937, in convert_controlnet_checkpoint
    new_checkpoint["controlnet_mid_block.weight"] = controlnet_state_dict.pop("middle_block_out.0.weight")
KeyError: 'middle_block_out.0.weight'

What you expected to happen

I expected the photo to be upres'd

How to reproduce the problem

Start the app, try to upscale.

Additional context

No response

Discord username

No response

Poutchouli commented 1 week ago

I had the same issue, my fix was downloading the tile controlnet model directly from the model directory inside invokeAI instead of importing the one i had already. The one i had was from the same huggingFace directory with the same name but might have been a different format or something.

This issue seems related to this other one : https://github.com/invoke-ai/InvokeAI/issues/6707