0xbitches / sd-webui-lcm

Latent Consistency Model for AUTOMATIC1111 Stable Diffusion WebUI
MIT License
614 stars 43 forks source link

unable to install LCM #6

Open boomboom77365 opened 9 months ago

boomboom77365 commented 9 months ago

The config attributes {'force_upcast': True} were passed to AutoencoderKL, but are not expected and will be ignored. Please verify your config.json configuration file. * Error loading script: main.py Traceback (most recent call last): File "E:\stable diffusion\stable-diffusion-webui\modules\scripts.py", line 382, in load_scripts script_module = script_loading.load_module(scriptfile.path) File "E:\stable diffusion\stable-diffusion-webui\modules\script_loading.py", line 10, in load_module module_spec.loader.exec_module(module) File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "E:\stable diffusion\stable-diffusion-webui\extensions\sd-webui-lcm\scripts\main.py", line 71, in pipe = LatentConsistencyModelPipeline.from_pretrained( File "E:\stable diffusion\stable-diffusion-webui\venv\lib\site-packages\diffusers\pipelines\pipeline_utils.py", line 1039, in from_pretrained loaded_sub_model = load_sub_model( File "E:\stable diffusion\stable-diffusion-webui\venv\lib\site-packages\diffusers\pipelines\pipeline_utils.py", line 445, in load_sub_model loaded_sub_model = load_method(os.path.join(cached_folder, name), loading_kwargs) File "E:\stable diffusion\stable-diffusion-webui\venv\lib\site-packages\diffusers\models\modeling_utils.py", line 583, in from_pretrained raise ValueError( ValueError: Cannot load <class 'diffusers.models.autoencoder_kl.AutoencoderKL'> from C:\Users\Tr0uble.cache\huggingface\hub\models--SimianLuo--LCM_Dreamshaper_v7\snapshots\c7f9b672c65a664af57d1de926819fd79cb26eb8\vae because the following keys are missing: decoder.mid_block.attentions.0.value.weight, decoder.mid_block.attentions.0.query.bias, decoder.mid_block.attentions.0.value.bias, decoder.mid_block.attentions.0.query.weight, decoder.mid_block.attentions.0.key.bias, encoder.mid_block.attentions.0.query.bias, encoder.mid_block.attentions.0.value.weight, encoder.mid_block.attentions.0.value.bias, decoder.mid_block.attentions.0.proj_attn.bias, encoder.mid_block.attentions.0.key.bias, encoder.mid_block.attentions.0.key.weight, encoder.mid_block.attentions.0.proj_attn.weight, encoder.mid_block.attentions.0.proj_attn.bias, encoder.mid_block.attentions.0.query.weight, decoder.mid_block.attentions.0.proj_attn.weight, decoder.mid_block.attentions.0.key.weight. Please make sure to pass low_cpu_mem_usage=False and device_map=None if you want to randomly initialize those weights or else make sure your checkpoint file is correct.

0xbitches commented 9 months ago

Looks like the model download failed. Can you try deleting the huggingface model cache folderC:\Users\Tr0uble.cache\huggingface\hub\models--SimianLuo--LCM_Dreamshaper_v7\, then restart the UI?

boomboom77365 commented 9 months ago

Looks like the model download failed. Can you try deleting the huggingface model cache folderC:\Users\Tr0uble.cache\huggingface\hub\models--SimianLuo--LCM_Dreamshaper_v7\, then restart the UI?

I've deleted the Dreamshaper v7 model and let it download again.

The config attributes {'force_upcast': True} were passed to AutoencoderKL, but are not expected and will be ignored. Please verify your config.json configuration file. * Error loading script: main.py Traceback (most recent call last): File "E:\stable diffusion\stable-diffusion-webui\modules\scripts.py", line 382, in load_scripts script_module = script_loading.load_module(scriptfile.path) File "E:\stable diffusion\stable-diffusion-webui\modules\script_loading.py", line 10, in load_module module_spec.loader.exec_module(module) File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "E:\stable diffusion\stable-diffusion-webui\extensions\sd-webui-lcm\scripts\main.py", line 71, in pipe = LatentConsistencyModelPipeline.from_pretrained( File "E:\stable diffusion\stable-diffusion-webui\venv\lib\site-packages\diffusers\pipelines\pipeline_utils.py", line 1039, in from_pretrained loaded_sub_model = load_sub_model( File "E:\stable diffusion\stable-diffusion-webui\venv\lib\site-packages\diffusers\pipelines\pipeline_utils.py", line 445, in load_sub_model loaded_sub_model = load_method(os.path.join(cached_folder, name), loading_kwargs) File "E:\stable diffusion\stable-diffusion-webui\venv\lib\site-packages\diffusers\models\modeling_utils.py", line 583, in from_pretrained raise ValueError( ValueError: Cannot load <class 'diffusers.models.autoencoder_kl.AutoencoderKL'> from C:\Users\Tr0uble.cache\huggingface\hub\models--SimianLuo--LCM_Dreamshaper_v7\snapshots\c7f9b672c65a664af57d1de926819fd79cb26eb8\vae because the following keys are missing: encoder.mid_block.attentions.0.key.bias, decoder.mid_block.attentions.0.key.bias, decoder.mid_block.attentions.0.query.weight, encoder.mid_block.attentions.0.proj_attn.bias, decoder.mid_block.attentions.0.proj_attn.weight, encoder.mid_block.attentions.0.query.weight, decoder.mid_block.attentions.0.key.weight, decoder.mid_block.attentions.0.value.bias, encoder.mid_block.attentions.0.query.bias, decoder.mid_block.attentions.0.query.bias, encoder.mid_block.attentions.0.proj_attn.weight, encoder.mid_block.attentions.0.key.weight, encoder.mid_block.attentions.0.value.weight, decoder.mid_block.attentions.0.value.weight, decoder.mid_block.attentions.0.proj_attn.bias, encoder.mid_block.attentions.0.value.bias. Please make sure to pass low_cpu_mem_usage=False and device_map=None if you want to randomly initialize those weights or else make sure your checkpoint file is correct.

Still got hit by this. Is there anything else I can try?

0xbitches commented 9 months ago

Can you check the version of diffusers you have in E:\stable diffusion\stable-diffusion-webui\venv\lib\site-packages\? There is a chance it is outdated.

Talae06 commented 9 months ago

@boomboom77365 @0xbitches Had the same problem, diffusers version was 0.16.1, upgrading it to latest 0.21.4 did the trick indeed. Thanks :)

boomboom77365 commented 9 months ago

0.21.4

I've updated my diffusers to 0.21.4, problem persists

2blackbar commented 9 months ago

let us download model on our own just update docs where to keep it, autodownloading from hface is crap

Matti-Koopa commented 9 months ago

Diffusers update should go in requirements.txt for the extension, right? Otherwise this will never work.

miwgel commented 9 months ago

On comfyui I had to run this from the same virtual environment in a new .py file:

from diffusers import StableDiffusionPipeline

repo_id = "SimianLuo/LCM_Dreamshaper_v7"
pipe = StableDiffusionPipeline.from_pretrained(repo_id, use_safetensors=True)

That downloads the model to the folder the comfyui node expects. Try it in Auto1111

BryceBarbara commented 9 months ago

Got this error after updating diffusers and redownloading.

ValueError: Non-consecutive added token '<|startoftext|>' found. Should have index 49408 but has index 49406 in saved vocabulary.

Edit: nevermind. Noticed the trick mentioned in the readme for added_tokens.json and that worked.

jFkd1 commented 9 months ago

@2blackbar diffusers has a pretty good doc already. https://huggingface.co/docs/diffusers/v0.21.0/en/api/pipelines/overview#diffusers.DiffusionPipeline.from_pretrained

0xbitches commented 9 months ago

@2blackbar As @jFkd1 said, the diffusers library already supports loading models locally. To do that, simple replace the repo id ("SimianLuo/LCM_Dreamshaper_v7") in line 69 - 72 of scripts/main.py with the path to your local model directory.

boomboom77365 commented 9 months ago

@2blackbar As @jFkd1 said, the diffusers library already supports loading models locally. To do that, simple replace the repo id ("SimianLuo/LCM_Dreamshaper_v7") in line 69 - 72 of scripts/main.py with the path to your local model directory.

can I load any models or does it have to be dreamshaper v7? also, I found the file and the line in main.py, I how do I change the path? sorry I'm not familiar with this.

The config attributes {'force_upcast': True} were passed to AutoencoderKL, but are not expected and will be ignored. Please verify your config.json configuration file. * Error loading script: main.py Traceback (most recent call last): File "E:\stable diffusion\stable-diffusion-webui\modules\scripts.py", line 382, in load_scripts script_module = script_loading.load_module(scriptfile.path) File "E:\stable diffusion\stable-diffusion-webui\modules\script_loading.py", line 10, in load_module module_spec.loader.exec_module(module) File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "E:\stable diffusion\stable-diffusion-webui\extensions\sd-webui-lcm\scripts\main.py", line 71, in pipe = LatentConsistencyModelPipeline.from_pretrained( File "E:\stable diffusion\stable-diffusion-webui\venv\lib\site-packages\diffusers\pipelines\pipeline_utils.py", line 1039, in from_pretrained loaded_sub_model = load_sub_model( File "E:\stable diffusion\stable-diffusion-webui\venv\lib\site-packages\diffusers\pipelines\pipeline_utils.py", line 445, in load_sub_model loaded_sub_model = load_method(os.path.join(cached_folder, name), loading_kwargs) File "E:\stable diffusion\stable-diffusion-webui\venv\lib\site-packages\diffusers\models\modeling_utils.py", line 583, in from_pretrained raise ValueError( ValueError: Cannot load <class 'diffusers.models.autoencoder_kl.AutoencoderKL'> from C:\Users\Tr0uble.cache\huggingface\hub\models--SimianLuo--LCM_Dreamshaper_v7\snapshots\c7f9b672c65a664af57d1de926819fd79cb26eb8\vae because the following keys are missing: decoder.mid_block.attentions.0.key.weight, encoder.mid_block.attentions.0.query.bias, encoder.mid_block.attentions.0.proj_attn.weight, encoder.mid_block.attentions.0.key.bias, encoder.mid_block.attentions.0.key.weight, decoder.mid_block.attentions.0.query.weight, decoder.mid_block.attentions.0.value.weight, decoder.mid_block.attentions.0.key.bias, encoder.mid_block.attentions.0.value.weight, encoder.mid_block.attentions.0.value.bias, decoder.mid_block.attentions.0.query.bias, encoder.mid_block.attentions.0.proj_attn.bias, decoder.mid_block.attentions.0.proj_attn.weight, decoder.mid_block.attentions.0.proj_attn.bias, encoder.mid_block.attentions.0.query.weight, decoder.mid_block.attentions.0.value.bias. Please make sure to pass low_cpu_mem_usage=False and device_map=None if you want to randomly initialize those weights or else make sure your checkpoint file is correct.

AugmentedRealityCat commented 9 months ago

can I load any models or does it have to be dreamshaper v7?

As of now it's the only model that works with it. @0xbitches is very clear about it in the readme:

Note that LCMs are a completely different class of models than Stable Diffusion, and the only available checkpoint currently is LCM_Dreamshaper_v7.

taken from: https://github.com/0xbitches/sd-webui-lcm#latent-consistency-model-for-stable-diffusion-webui

boomboom77365 commented 9 months ago

can I load any models or does it have to be dreamshaper v7?

As of now it's the only model that works with it. @0xbitches is very clear about it in the readme:

Note that LCMs are a completely different class of models than Stable Diffusion, and the only available checkpoint currently is LCM_Dreamshaper_v7.

taken from: https://github.com/0xbitches/sd-webui-lcm#latent-consistency-model-for-stable-diffusion-webui

Understood. Is there a way that I can get it working? Tried all the recommendations.

navalguijo commented 9 months ago

I get the same Error, already tried solutions suggested here and no luck. Still don't get LCM tab. Any other ideas?

I get this in the startup:

The config attributes {'addition_time_embed_dim': None, 'attention_type': 'default', 'dropout': 0.0, 'encoder_hid_dim_type': None, 'num_attention_heads': None, 'transformer_layers_per_block': 1} were passed to UNet2DConditionModel, but are not expected and will be ignored. Please verify your config.json configuration file.3.44G/3.44G [01:11<00:00, 80.9MB/s] The config attributes {'force_upcast': True} were passed to AutoencoderKL, but are not expected and will be ignored. Please verify your config.json configuration file. * Error loading script: main.py Traceback (most recent call last): File "Y:\Automatic1111_130\stable-diffusion-webui\modules\scripts.py", line 382, in load_scripts script_module = script_loading.load_module(scriptfile.path) File "Y:\Automatic1111_130\stable-diffusion-webui\modules\script_loading.py", line 10, in load_module module_spec.loader.exec_module(module) File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "Y:\Automatic1111_130\stable-diffusion-webui\extensions\sd-webui-lcm\scripts\main.py", line 71, in pipe = LatentConsistencyModelPipeline.from_pretrained( File "Y:\Automatic1111_130\stable-diffusion-webui\venv\lib\site-packages\diffusers\pipelines\pipeline_utils.py", line 1039, in from_pretrained loaded_sub_model = load_sub_model( File "Y:\Automatic1111_130\stable-diffusion-webui\venv\lib\site-packages\diffusers\pipelines\pipeline_utils.py", line 445, in load_sub_model loaded_sub_model = load_method(os.path.join(cached_folder, name), loading_kwargs) File "Y:\Automatic1111_130\stable-diffusion-webui\venv\lib\site-packages\diffusers\models\modeling_utils.py", line 583, in from_pretrained raise ValueError( ValueError: Cannot load <class 'diffusers.models.autoencoder_kl.AutoencoderKL'> from C:\Users\navalNew03.cache\huggingface\hub\models--SimianLuo--LCM_Dreamshaper_v7\snapshots\fb9c5d167af11fd84454ae6493878b10bb63b067\vae because the following keys are missing: decoder.mid_block.attentions.0.query.weight, encoder.mid_block.attentions.0.proj_attn.bias, encoder.mid_block.attentions.0.proj_attn.weight, decoder.mid_block.attentions.0.query.bias, decoder.mid_block.attentions.0.value.bias, encoder.mid_block.attentions.0.query.bias, decoder.mid_block.attentions.0.key.bias, decoder.mid_block.attentions.0.key.weight, encoder.mid_block.attentions.0.value.weight, encoder.mid_block.attentions.0.key.weight, decoder.mid_block.attentions.0.proj_attn.weight, encoder.mid_block.attentions.0.key.bias, decoder.mid_block.attentions.0.value.weight, encoder.mid_block.attentions.0.query.weight, decoder.mid_block.attentions.0.proj_attn.bias, encoder.mid_block.attentions.0.value.bias. Please make sure to pass low_cpu_mem_usage=False and device_map=None if you want to randomly initialize those weights or else make sure your checkpoint file is correct.

Matti-Koopa commented 9 months ago

So did anyone find a solution that works on a clean install? Need this for a docker environment.

BryceBarbara commented 9 months ago

@navalguijo Make sure you install the updated diffusers version in the venv and not globally. I made that mistake initially and got the same result.

boomboom77365 commented 9 months ago

@navalguijo Make sure you install the updated diffusers version in the venv and not globally. I made that mistake initially and got the same result.

Here's what I did: cmd in the venv of stable diffusion and pip install --upgrade diffusers[torch] Didnt solve the issue.