I'm getting an KeyError: 'time_embed.0.weight'
[2024-05-01 19:46:14,292]::[InvokeAI]::ERROR --> Error while invoking session 0ba8d5ed-85eb-4634-be93-dba1b9899776, invocation da7aef85-9ffe-4efe-8776-918efd7bb237 (denoise_latents):
'time_embed.0.weight'
[2024-05-01 19:46:14,292]::[InvokeAI]::ERROR --> Traceback (most recent call last):
File "C:\Users*****\invokeai.venv\Lib\site-packages\invokeai\app\services\session_processor\session_processor_default.py", line 185, in _process
outputs = self._invocation.invoke_internal(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users*****\invokeai.venv\Lib\site-packages\invokeai\app\invocations\baseinvocation.py", line 281, in invoke_internal
output = self.invoke(context)
^^^^^^^^^^^^^^^^^^^^
File "C:\Users*****\invokeai.venv\Lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users*****\invokeai.venv\Lib\site-packages\invokeai\app\invocations\latent.py", line 964, in invoke
controlnet_data = self.prep_control_data(
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users*****\invokeai.venv\Lib\site-packages\invokeai\app\invocations\latent.py", line 641, in prep_control_data
control_model = exit_stack.enter_context(context.models.load(control_info.control_model))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users*****\invokeai.venv\Lib\site-packages\invokeai\app\services\shared\invocation_context.py", line 351, in load
return self._services.model_manager.load.load_model(model, _submodel_type, self._data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users*****\invokeai.venv\Lib\site-packages\invokeai\app\services\model_load\model_load_default.py", line 80, in load_model
).load_model(model_config, submodel_type)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users*****\invokeai.venv\Lib\site-packages\invokeai\backend\model_manager\load\load_default.py", line 62, in load_model
locker = self._convert_and_load(model_config, model_path, submodel_type)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users*****\invokeai.venv\Lib\site-packages\invokeai\backend\model_manager\load\load_default.py", line 89, in _convert_and_load
loaded_model = self._do_convert(config, model_path, cache_path, submodel_type)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users*****\invokeai.venv\Lib\site-packages\invokeai\backend\model_manager\load\load_default.py", line 121, in _do_convert
pipeline = self._convert_model(config, model_path, cache_path if self.convert_cache.max_size > 0 else None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users*****\invokeai.venv\Lib\site-packages\invokeai\backend\model_manager\load\model_loaders\controlnet.py", line 50, in _convert_model
result = convert_controlnet_to_diffusers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users*****\invokeai.venv\Lib\site-packages\invokeai\backend\model_manager\convert_ckpt_to_diffusers.py", line 77, in convert_controlnet_to_diffusers
pipe = download_controlnet_from_original_ckpt(checkpoint_path.as_posix(), **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users*****\invokeai.venv\Lib\site-packages\diffusers\pipelines\stable_diffusion\convert_from_ckpt.py", line 1849, in download_controlnet_from_original_ckpt
controlnet = convert_controlnet_checkpoint(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users*****\invokeai.venv\Lib\site-packages\diffusers\pipelines\stable_diffusion\convert_from_ckpt.py", line 1120, in convert_controlnet_checkpoint
converted_ctrl_checkpoint = convert_ldm_unet_checkpoint(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users*****\invokeai.venv\Lib\site-packages\diffusers\pipelines\stable_diffusion\convert_from_ckpt.py", line 431, in convert_ldm_unet_checkpoint
new_checkpoint["time_embedding.linear_1.weight"] = unet_state_dict["time_embed.0.weight"]
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'time_embed.0.weight'
Hi, this is just a clone of https://huggingface.co/thibaud/controlnet-openpose-sdxl-1.0 with fp16 weights. For what I can see in your code, you're using InvokeAI
but I'm not sure why or how are you using this model with InvokeAI. The error is because the code is trying to convert the controlnet model to diffusers
format, but this weights are already in diffusers
format.
So to solve it first I recommend opening the issue in the InvokeAI repo and second to use the original weights with full precision. I did this to just save space and bandwidth when I use them directly with diffusers
and they work without problem like that.
In fact I don't use it anymore because this doesn't work that good with SDXL and I haven't deleted it because maybe someone has it installed directly in their code and I don't want to break their apps or spaces.