sd-forge-layerdiffuse icon indicating copy to clipboard operation
sd-forge-layerdiffuse copied to clipboard

SD1.5 models problem

Open wly-ai-bj opened this issue 11 months ago • 8 comments

When i run with as follows: layerdiffuser_method = (SD1.5) From Background to Foreground (need batch size 2), base model is sd1.5,

I met such errors:

'BaseModel' object has no attribute 'diffusion_model.input_blocks.1.1.transformer_blocks.0.attn1'

wly-ai-bj avatar Mar 12 '24 12:03 wly-ai-bj

same question

LeeYN-43 avatar Mar 12 '24 12:03 LeeYN-43

same, even with the realisticVision model, with the same error msg of 'BaseModel' object has no attribute 'diffusion_model.input_blocks.1.1.transformer_blocks.0.attn1'

dranzerstar avatar Mar 13 '24 04:03 dranzerstar

I successfully solved this problem because the author updated the SD1.5 model while also updating Forge. After merging the new commit of stable-diffusion-webui-forge, I can use the SD1.5 model. image

LeeYN-43 avatar Mar 13 '24 05:03 LeeYN-43

I successfully solved this problem because the author updated the SD1.5 model while also updating Forge. After merging the new commit of Forge, I can use the SD1.5 model. image

My repo already up to date.

The commits I can see is different with you .

image

wly-ai-bj avatar Mar 13 '24 06:03 wly-ai-bj

I successfully solved this problem because the author updated the SD1.5 model while also updating Forge. After merging the new commit of Forge, I can use the SD1.5 model. image

My repo already up to date.

The commits I can see is different with you .

image

I mean the stable-diffusion-webui-forge repo image

LeeYN-43 avatar Mar 13 '24 06:03 LeeYN-43

The error message BaseModel object has no attribute diffusion_model.input_blocks.1.1.transformer_blocks.0.attn1 indicates that the code is trying to access an attribute that doesn't exist in the BaseModel object.

This could be due to several reasons: 1. Incorrect Model Structure: It relies on accessing specific attention modules within the model. If you're using a different base model, the internal structure and attribute names might be different, leading to this error.

2. Missing Patching: The AttentionSharingPatcher class is designed to modify the Stable Diffusion 1.5 model by replacing specific attention modules with custom AttentionSharingUnit modules. If you haven't applied this patcher to your base model, the expected attributes won't be present.

3. Module Name Mismatch: Double-check the module names in the module_mapping_sd15 dictionary. If there's a mismatch between these names and the actual attribute names in your base model, the code won't be able to find the correct modules.

Here are some steps you can take to troubleshoot and fix the error:

1. Verify Base Model: Make sure you're using the correct base model (Stable Diffusion 1.5) that is compatible with the code you're using.

2. Apply Patcher: If you haven't already, apply the AttentionSharingPatcher to your base model to inject the custom attention modules.

3. Inspect Model Structure: Print the structure of your base model using print(base_model) or a similar method to see if the attribute names match the ones expected by the code.

4. Debug: Use a debugger to step through the code and see where the attribute access fails. This can help you pinpoint the exact location of the issue.

oslook avatar Mar 13 '24 09:03 oslook

i have a similar error message, though independent of the model. but dependent of lora. if i activate one (any, really), i get this message:


Warning: field infotext in API payload not found in <modules.processing.StableDiffusionProcessingTxt2Img object at 0x00000275ECA339D0>. [LORA] Loaded E:\ai_gh_repos\sd.webui\webui\models\Lora\arch\analogFilmPhotography_10.safetensors for BaseModel-UNet with 192 keys at weight 1.0 (skipped 0 keys) [LORA] Loaded E:\ai_gh_repos\sd.webui\webui\models\Lora\arch\analogFilmPhotography_10.safetensors for BaseModel-CLIP with 72 keys at weight 1.0 (skipped 0 keys) To load target model SD1ClipModel Begin to load 1 model Reuse 1 loaded models [Memory Management] Current Free GPU Memory (MB) = 5977.4732303619385 [Memory Management] Model Memory (MB) = 0.0 [Memory Management] Minimal Inference Memory (MB) = 1024.0 [Memory Management] Estimated Remaining GPU Memory (MB) = 4953.4732303619385 Moving model(s) has taken 0.64 seconds [Layer Diffusion] LayerMethod.FG_ONLY_ATTN_SD15 Reuse 1 loaded models To load target model BaseModel Begin to load 1 model [Memory Management] Current Free GPU Memory (MB) = 6271.980878829956 [Memory Management] Model Memory (MB) = 178.406982421875 [Memory Management] Minimal Inference Memory (MB) = 1024.0 [Memory Management] Estimated Remaining GPU Memory (MB) = 5069.573896408081 could not patch. key doesn't exist in model: diffusion_model.input_blocks.1.1.transformer_blocks.0.attn1.to_k.weight could not patch. key doesn't exist in model: diffusion_model.input_blocks.1.1.transformer_blocks.0.attn2.to_q.weight could not patch. key doesn't exist in model: diffusion_model.input_blocks.1.1.transformer_blocks.0.attn2.to_out.0.weight could not patch. key doesn't exist in model: diffusion_model.input_blocks.1.1.transformer_blocks.0.attn2.to_k.weight could not patch. key doesn't exist in model: diffusion_model.input_blocks.1.1.transformer_blocks.0.attn1.to_q.weight could not patch. key doesn't exist in model: diffusion_model.input_blocks.1.1.transformer_blocks.0.attn1.to_v.weight could not patch. key doesn't exist in model: diffusion_model.input_blocks.1.1.transformer_blocks.0.attn2.to_v.weight could not patch. key doesn't exist in model: diffusion_model.input_blocks.1.1.transformer_blocks.0.attn1.to_out.0.weight ... it repeats that lines a few times and then renders the usual image as if i hadn't activated any lora.

dermesut avatar Mar 17 '24 13:03 dermesut

I have a similar error message, if activate LoRA.

i have a similar error message, though independent of the model. but dependent of lora. if i activate one (any, really), i get this message:

Warning: field infotext in API payload not found in <modules.processing.StableDiffusionProcessingTxt2Img object at 0x00000275ECA339D0>. [LORA] Loaded E:\ai_gh_repos\sd.webui\webui\models\Lora\arch\analogFilmPhotography_10.safetensors for BaseModel-UNet with 192 keys at weight 1.0 (skipped 0 keys) [LORA] Loaded E:\ai_gh_repos\sd.webui\webui\models\Lora\arch\analogFilmPhotography_10.safetensors for BaseModel-CLIP with 72 keys at weight 1.0 (skipped 0 keys) To load target model SD1ClipModel Begin to load 1 model Reuse 1 loaded models [Memory Management] Current Free GPU Memory (MB) = 5977.4732303619385 [Memory Management] Model Memory (MB) = 0.0 [Memory Management] Minimal Inference Memory (MB) = 1024.0 [Memory Management] Estimated Remaining GPU Memory (MB) = 4953.4732303619385 Moving model(s) has taken 0.64 seconds [Layer Diffusion] LayerMethod.FG_ONLY_ATTN_SD15 Reuse 1 loaded models To load target model BaseModel Begin to load 1 model [Memory Management] Current Free GPU Memory (MB) = 6271.980878829956 [Memory Management] Model Memory (MB) = 178.406982421875 [Memory Management] Minimal Inference Memory (MB) = 1024.0 [Memory Management] Estimated Remaining GPU Memory (MB) = 5069.573896408081 could not patch. key doesn't exist in model: diffusion_model.input_blocks.1.1.transformer_blocks.0.attn1.to_k.weight could not patch. key doesn't exist in model: diffusion_model.input_blocks.1.1.transformer_blocks.0.attn2.to_q.weight could not patch. key doesn't exist in model: diffusion_model.input_blocks.1.1.transformer_blocks.0.attn2.to_out.0.weight could not patch. key doesn't exist in model: diffusion_model.input_blocks.1.1.transformer_blocks.0.attn2.to_k.weight could not patch. key doesn't exist in model: diffusion_model.input_blocks.1.1.transformer_blocks.0.attn1.to_q.weight could not patch. key doesn't exist in model: diffusion_model.input_blocks.1.1.transformer_blocks.0.attn1.to_v.weight could not patch. key doesn't exist in model: diffusion_model.input_blocks.1.1.transformer_blocks.0.attn2.to_v.weight could not patch. key doesn't exist in model: diffusion_model.input_blocks.1.1.transformer_blocks.0.attn1.to_out.0.weight ... it repeats that lines a few times and then renders the usual image as if i hadn't activated any lora.

bloomxjb avatar Apr 17 '24 08:04 bloomxjb