d8ahazard / sd_dreambooth_extension

Other
1.85k stars 281 forks source link

[Bug]: #1405

Closed ThePetePandaPablo closed 6 months ago

ThePetePandaPablo commented 7 months ago

Is there an existing issue for this?

What happened?

After making a model I doesnt load

Steps to reproduce the problem

make model as normal and try to run

Commit and libraries

Starting at Initializing Dreambooth and ending several lines below at [+] bitsandbytes version 0.35.4 installed..

Command Line Arguments

-none

Console logs

Saving C:\Users\peter\Downloads\stable-diffusion-webui\models\dreambooth\testv8\logging\loss_plot_14.png
Saving C:\Users\peter\Downloads\stable-diffusion-webui\models\dreambooth\testv8\logging\ram_plot_14.png
Cleanup log parse.
                                                                                                                       Cleanup completed.                                                                                | 0/3 [00:00<?, ?it/s]
Steps: 100%|████████████████████████████████████████████| 14/14 [00:24<00:00,  1.74s/it, loss=0.027, lr=6e-8, vram=6.3]
  0%|                                                                                            | 0/3 [00:00<?, ?it/s]
Duration: 00:00:28
Duration: 00:00:29
Reusing loaded model v1-5-pruned-emaonly.safetensors [6ce0161689] to load testv8\testv8_14.safetensors
Calculating sha256 for C:\Users\peter\Downloads\stable-diffusion-webui\models\Stable-diffusion\testv8\testv8_14.safetensors: 91cb4e5a130b107d9611f43b9e30d39534eb98644815ec8a3f686288060e7f34
Loading weights [91cb4e5a13] from C:\Users\peter\Downloads\stable-diffusion-webui\models\Stable-diffusion\testv8\testv8_14.safetensors
Creating model from config: C:\Users\peter\Downloads\stable-diffusion-webui\models\Stable-diffusion\testv8\testv8_14.yaml
changing setting sd_model_checkpoint to testv8\testv8_14.safetensors: RuntimeError
Traceback (most recent call last):
  File "C:\Users\peter\Downloads\stable-diffusion-webui\modules\options.py", line 140, in set
    option.onchange()
  File "C:\Users\peter\Downloads\stable-diffusion-webui\modules\call_queue.py", line 13, in f
    res = func(*args, **kwargs)
  File "C:\Users\peter\Downloads\stable-diffusion-webui\modules\initialize_util.py", line 170, in <lambda>
    shared.opts.onchange("sd_model_checkpoint", wrap_queued_call(lambda: sd_models.reload_model_weights()), call=False)
  File "C:\Users\peter\Downloads\stable-diffusion-webui\modules\sd_models.py", line 751, in reload_model_weights
    load_model(checkpoint_info, already_loaded_state_dict=state_dict)
  File "C:\Users\peter\Downloads\stable-diffusion-webui\modules\sd_models.py", line 626, in load_model
    load_model_weights(sd_model, checkpoint_info, state_dict, timer)
  File "C:\Users\peter\Downloads\stable-diffusion-webui\modules\sd_models.py", line 353, in load_model_weights
    model.load_state_dict(state_dict, strict=False)
  File "C:\Users\peter\Downloads\stable-diffusion-webui\modules\sd_disable_initialization.py", line 223, in <lambda>
    module_load_state_dict = self.replace(torch.nn.Module, 'load_state_dict', lambda *args, **kwargs: load_state_dict(module_load_state_dict, *args, **kwargs))
  File "C:\Users\peter\Downloads\stable-diffusion-webui\modules\sd_disable_initialization.py", line 221, in load_state_dict
    original(module, state_dict, strict=strict)
  File "C:\Users\peter\Downloads\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 2041, in load_state_dict
    raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for LatentDiffusion:
        size mismatch for first_stage_model.encoder.mid.attn_1.q.bias: copying a param with shape torch.Size([512, 1, 1]) from checkpoint, the shape in current model is torch.Size([512]).
        size mismatch for first_stage_model.encoder.mid.attn_1.k.bias: copying a param with shape torch.Size([512, 1, 1]) from checkpoint, the shape in current model is torch.Size([512]).
        size mismatch for first_stage_model.encoder.mid.attn_1.v.bias: copying a param with shape torch.Size([512, 1, 1]) from checkpoint, the shape in current model is torch.Size([512]).
        size mismatch for first_stage_model.encoder.mid.attn_1.proj_out.bias: copying a param with shape torch.Size([512, 1, 1]) from checkpoint, the shape in current model is torch.Size([512]).
        size mismatch for first_stage_model.decoder.mid.attn_1.q.bias: copying a param with shape torch.Size([512, 1, 1]) from checkpoint, the shape in current model is torch.Size([512]).
        size mismatch for first_stage_model.decoder.mid.attn_1.k.bias: copying a param with shape torch.Size([512, 1, 1]) from checkpoint, the shape in current model is torch.Size([512]).
        size mismatch for first_stage_model.decoder.mid.attn_1.v.bias: copying a param with shape torch.Size([512, 1, 1]) from checkpoint, the shape in current model is torch.Size([512]).
        size mismatch for first_stage_model.decoder.mid.attn_1.proj_out.bias: copying a param with shape torch.Size([512, 1, 1]) from checkpoint, the shape in current model is torch.Size([512]).

Additional information

No response

iansharoo commented 7 months ago

Encountering this same issue.

MVPWendi commented 7 months ago

Same issue

MVPWendi commented 7 months ago

btw, works on 1.0.14

fulleclip commented 7 months ago

And can you change the version without uninstalling?

fulleclip commented 7 months ago

I have deleted the latest version and copied the 1.0.14 folder and shortly after starting to work this error appears

Exception training model: '[WinError 5] Acceso denegado: 'C:\Users\Home\AppData\Local\Temp\tmp0gz5tifm\text_encoder\model.safetensors''.

I will wait for some solution

MVPWendi commented 7 months ago

I have deleted the latest version and copied the 1.0.14 folder and shortly after starting to work this error appears

Exception training model: '[WinError 5] Acceso denegado: 'C:\Users\Home\AppData\Local\Temp\tmp0gz5tifm\text_encoder\model.safetensors''.

I will wait for some solution

1) Delete folder "sd_dreambooth_extension" from extensions folder 2) Download 1.0.14 version frome releases 3) Extract folder to extensions and rename to "sd_dreambooth_extension"

Works for me as temp solution

fulleclip commented 7 months ago

Correct, the error that appears is due to a part of the configuration, at the moment it is generating a new model, we will see what happens when it finishes, as you say, it may be a temporary option

fulleclip commented 7 months ago

1.0.14 without problems

JaneLu666 commented 7 months ago

I have encountered the same issue. May I ask where I can download version 1.0.14? Thank you.

MVPWendi commented 7 months ago

I have encountered the same issue. May I ask where I can download version 1.0.14? Thank you.

Go to releases and scroll down

JaneLu666 commented 7 months ago

我遇到了同樣的問題。請問哪裡可以下載1.0.14版本?謝謝。

轉到版本並向下滾動

I've found it. Thank you.

potesd commented 7 months ago

Using the 1.0.14 version did NOT fix this for me.

elismasilva commented 7 months ago

the lasted commit [797cb64723add661d9c009347cdb9e42b0de32c8] generate this erros, I manually reverted these changes to my code and everything worked again.

MengChhh commented 7 months ago

the lasted commit [797cb64] generate this erros, I manually reverted these changes to my code and everything worked again.

Is it changed in version 1.0.14, or in the latest Dreambooth version?

elismasilva commented 7 months ago

the lasted commit [797cb64] generate this erros, I manually reverted these changes to my code and everything worked again.

Is it changed in version 1.0.14, or in the latest Dreambooth version?

this is the penultimate commit from main branch, the best is do a checkout to commit hash 7e38eeddd085e44ddfb799d6ec8d03573122b571 (current released version)

georgesung commented 7 months ago

Similar issue seen in https://github.com/huggingface/diffusers/issues/6226 (for HuggingFace Diffusers convert_diffusers_to_original_stable_diffusion.py script) with similar code changes, that once reverted, the model works again

VladAdushev commented 7 months ago

the lasted commit [797cb64] generate this erros, I manually reverted these changes to my code and everything worked again.

Is it changed in version 1.0.14, or in the latest Dreambooth version?

this is the penultimate commit from main branch, the best is do a checkout to commit hash 7e38eed (current released version)

I don't understand much about all this. Could you upload the files where the changes were made?

ousinkou commented 7 months ago

the lasted commit [797cb64] generate this erros, I manually reverted these changes to my code and everything worked again.

Thanks. After deleting the renaming operations, everything works fine

github-actions[bot] commented 6 months ago

This issue is stale because it has been open 5 days with no activity. Remove stale label or comment or this will be closed in 5 days