n00mkrad/text2image-gui

"Failed to load model. The model appears to be incompatible." (1.11.0)

ndu926 opened this issue · 3 comments

ndu926 commented

In the last version of SD GUI, when I'm trying to load any models I have, returns the following message:

Running Stable Diffusion - 1 Iterations, 1 Steps, Scales 7.5, 512x512, Starting Seed: 534695720
1 Prompt * 1 Image * 1 Step Value * 1 Scale = 1 Images Total.
Warning: Model is not in Diffusers format, this makes loading slower due to conversion. For a speedup, convert it to a Diffusers model.
No images generated.
Canceled: Process has errored: Failed to load model.  The model appears to be incompatible.

These models are based on SD 1.5 and trained using Dreambooth. In the previous version (1,9.1) they worked without any issues.

Same here, can duplicate issue.

UPDATE:

This is the log when trying to load such models:

[00000099] [09-15-2023 17:18:16] invoke_pid=10632
[00000100] [09-15-2023 17:18:16] * Initializing, be patient...
[00000101] [09-15-2023 17:18:17] >> Internet connectivity is True
[00000102] [09-15-2023 17:18:17] >> InvokeAI, version 2.3.5.post2
[00000103] [09-15-2023 17:18:17] >> InvokeAI runtime directory is "D:\Programas\NMKD SD\1.11.0\Data\invoke"
[00000104] [09-15-2023 17:18:17] >> Face restoration and upscaling disabled
[00000105] [09-15-2023 17:18:17] >> Using device_type cuda
[00000106] [09-15-2023 17:18:17] >> CUDA device 'NVIDIA GeForce GTX 1050 Ti' (GPU 0)
[00000107] [09-15-2023 17:18:17] >> xformers not installed
[00000108] [09-15-2023 17:18:17] >> NSFW checker is disabled
[00000109] [09-15-2023 17:18:17] >> Current VRAM usage: 0.00G
[00000110] [09-15-2023 17:18:17] >> Loading Nick88(Dreamlike).ckpt-vae-ft-mse-840000-ema-pruned from D:/Programas/NMKD SD/Data/models/Nick88 (Dreamlike).ckpt
[00000111] [09-15-2023 17:18:17] >> Converting legacy checkpoint Nick88(Dreamlike).ckpt-vae-ft-mse-840000-ema-pruned into a diffusers model...
[00000113] [09-15-2023 17:18:17] | Scanning Model: D:/Programas/NMKD SD/Data/models/Nick88 (Dreamlike).ckpt
[00000114] [09-15-2023 17:18:17] | Model scanned ok
[00000115] [09-15-2023 17:18:31] | global_step key not found in model
[00000116] [09-15-2023 17:18:36] | Converting VAE D:\Programas\NMKD SD\Data\models\vae\vae-ft-mse-840000-ema-pruned.ckpt
[00000117] [09-15-2023 17:18:39] ** model Nick88(Dreamlike).ckpt-vae-ft-mse-840000-ema-pruned could not be loaded: Error(s) in loading state_dict for CLIPTextModel:
[00000120] [09-15-2023 17:18:39] Traceback (most recent call last):
[00000121] [09-15-2023 17:18:39] File "D:\Programas\NMKD SD\1.11.0\Data\venv\lib\site-packages\ldm\generate.py", line 965, in set_model
[00000122] [09-15-2023 17:18:39] model_data = cache.get_model(model_name)
[00000123] [09-15-2023 17:18:39] File "D:\Programas\NMKD SD\1.11.0\Data\venv\lib\site-packages\ldm\invoke\model_manager.py", line 106, in get_model
[00000124] [09-15-2023 17:18:39] requested_model, width, height, hash = self._load_model(model_name)
[00000125] [09-15-2023 17:18:39] File "D:\Programas\NMKD SD\1.11.0\Data\venv\lib\site-packages\ldm\invoke\model_manager.py", line 318, in _load_model
[00000126] [09-15-2023 17:18:39] model, width, height, model_hash = self._load_ckpt_model(
[00000127] [09-15-2023 17:18:39] File "D:\Programas\NMKD SD\1.11.0\Data\venv\lib\site-packages\ldm\invoke\model_manager.py", line 377, in _load_ckpt_model
[00000128] [09-15-2023 17:18:39] pipeline = load_pipeline_from_original_stable_diffusion_ckpt(
[00000129] [09-15-2023 17:18:39] File "D:\Programas\NMKD SD\1.11.0\Data\venv\lib\site-packages\ldm\invoke\ckpt_to_diffuser.py", line 1297, in load_pipeline_from_original_stable_diffusion_ckpt
[00000130] [09-15-2023 17:18:39] text_model = convert_ldm_clip_checkpoint(checkpoint)
[00000131] [09-15-2023 17:18:39] File "D:\Programas\NMKD SD\1.11.0\Data\venv\lib\site-packages\ldm\invoke\ckpt_to_diffuser.py", line 861, in convert_ldm_clip_checkpoint
[00000132] [09-15-2023 17:18:39] text_model.load_state_dict(text_model_dict)
[00000133] [09-15-2023 17:18:39] File "D:\Programas\NMKD SD\1.11.0\Data\venv\lib\site-packages\torch\nn\modules\module.py", line 2041, in load_state_dict
[00000134] [09-15-2023 17:18:39] raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
[00000135] [09-15-2023 17:18:39] RuntimeError: Error(s) in loading state_dict for CLIPTextModel:
[00000136] [09-15-2023 17:18:39] Missing key(s) in state_dict: "text_model.embeddings.position_ids".
[00000139] [09-15-2023 17:18:39] Missing key(s) in state_dict: "text_model.embeddings.position_ids".
[00000140] [09-15-2023 17:18:39] ** An error occurred while attempting to initialize the model: "Error(s) in loading state_dict for CLIPTextModel:
[00000141] [09-15-2023 17:18:39] Missing key(s) in state_dict: "text_model.embeddings.position_ids". "

Found a temporary workaround doing a merge with the affected model(s) and the original SD 1.5 using 5% weights:

image