AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
141.45k stars 26.73k forks source link

[Bug]: Error loading scripts - multiple main py scripts and unable to use additional_networks.py #7580

Closed GrandlordVaxid closed 1 year ago

GrandlordVaxid commented 1 year ago

Is there an existing issue for this?

What happened?

When launching webui-user.bat, I'm greeted by a slew of errors regarding loading scripts. Not sure if its related to reinstalling SD, reinstalling PY or attempting to use new Loras.

Steps to reproduce the problem

  1. Go to .... stable-diffusion-webui
  2. Press .... webui-user.bat
  3. Errors present themselves on launch.

What should have happened?

Loading without so many loading errors

Commit where the problem happens

https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/82725f0ac439f7e3b67858d55900e95330bbd326

What platforms do you use to access the UI ?

Windows

What browsers do you use to access the UI ?

Mozilla Firefox

Command Line Arguments

--medvram --autolaunch

List of extensions

8a5c0b607e38fcc585168b90c686eb05 https://gist.github.com/jachiam/8a5c0b607e38fcc585168b90c686eb05 latest BooruDatasetTagManager https://github.com/starik222/BooruDatasetTagManager latest DreamArtist-sd-webui-extension https://github.com/7eu7d7/DreamArtist-sd-webui-extension.git latest Hypernetwork-MonkeyPatch-Extension https://github.com/aria1th/Hypernetwork-MonkeyPatch-Extension.git latest animator_extension https://github.com/Animator-Anon/animator_extension latest lora https://github.com/cloneofsimo/lora latest sd-scripts https://github.com/kohya-ss/sd-scripts latest sd-webui-additional-networks https://github.com/kohya-ss/sd-webui-additional-networks latest sd-webui-gelbooru-prompt https://github.com/antis0007/sd-webui-gelbooru-prompt.git latest sd-webui-model-converter https://github.com/Akegarasu/sd-webui-model-converter latest sd-webui-multiple-hypernetworks https://github.com/antis0007/sd-webui-multiple-hypernetworks.git latest sd_dreambooth_extension https://github.com/d8ahazard/sd_dreambooth_extension latest sd_smartprocess https://github.com/d8ahazard/sd_smartprocess latest sdweb-merge-block-weighted-gui https://github.com/bbc-mc/sdweb-merge-block-weighted-gui.git latest stable-diffusion-webui-artists-to-study https://github.com/camenduru/stable-diffusion-webui-artists-to-study latest stable-diffusion-webui-wd14-tagger https://github.com/toriato/stable-diffusion-webui-wd14-tagger latest ultimate-upscale-for-automatic1111 https://github.com/Coyote-A/ultimate-upscale-for-automatic1111.git unknown LDSR built-in
Lora built-in
ScuNET built-in
SwinIR built-in
prompt-bracket-checker built-in

Console logs

Updating 82725f0..ea9bd9f
error: Your local changes to the following files would be overwritten by merge:
        .github/ISSUE_TEMPLATE/bug_report.yml
        .gitignore
        README.md
        extensions-builtin/LDSR/ldsr_model_arch.py
        extensions-builtin/SwinIR/scripts/swinir_model.py
        extensions-builtin/prompt-bracket-checker/javascript/prompt-bracket-checker.js
        javascript/aspectRatioOverlay.js
        javascript/edit-attention.js
        javascript/extensions.js
        javascript/hints.js
        javascript/hires_fix.js
        javascript/imageviewer.js
        javascript/localization.js
        javascript/progressbar.js
        javascript/textualInversion.js
        javascript/ui.js
        launch.py
        modules/api/api.py
        modules/api/models.py
        modules/call_queue.py
        modules/codeformer_model.py
        modules/deepbooru_model.py
        modules/devices.py
        modules/errors.py
        modules/extensions.py
        modules/extras.py
        modules/generation_parameters_copypaste.py
        modules/gfpgan_model.py
        modules/hypernetworks/hypernetwork.py
        modules/hypernetworks/ui.py
        modules/images.py
        modules/img2img.py
        modules/interrogate.py
        modules/modelloader.py
        modules/paths.py
        modules/processing.py
        modules/prompt_parser.py
        modules/realesrgan_model.py
        modules/script_callbacks.py
        modules/script_loading.py
        modules/scripts.py
        modules/sd_disable_initialization.py
        modules/sd_hijack.py
        modules/sd_hijack_checkpoint.py
        modules/sd_hijack_clip.py
        modules/sd_hijack_inpainting.py
        modules/sd_hijack_optimizations.py
        modules/sd_hijack_unet.py
        modules/sd_models.py
        modules/sd_samplers.py
        modules/sd_vae.py
        modules/sd_vae_approx.py
        modules/shared.py
        modules/styles.py
        modules/sub_quadratic_attention.py
        modules/textual_inversion/logging.py
        modules/textual_inversion/preprocess.py
        modules/textual_inversion/textual_inversion.py
        modules/txt2img.py
        modules/ui.py
        modules/ui_components.py
        modules/ui_extensions.py
        modules/upscaler.py
        requirements.txt
        requirements_versions.txt
        script.js
        scripts/img2imgalt.py
        scripts/prompt_matrix.py
        scripts/prompts_from_file.py
        style.css
        test/basic_features/utils_test.py
        webui-macos-env.sh
        webui.bat
        webui.py
        webui.sh
Please commit your changes or stash them before you merge.
error: The following untracked working tree files would be overwritten by merge:
        LICENSE.txt
        configs/instruct-pix2pix.yaml
        configs/v1-inpainting-inference.yaml
        extensions-builtin/Lora/extra_networks_lora.py
        extensions-builtin/Lora/lora.py
        extensions-builtin/Lora/preload.py
        extensions-builtin/Lora/scripts/lora_script.py
        extensions-builtin/Lora/ui_extra_networks_lora.py
        html/card-no-preview.png
        html/extra-networks-card.html
        html/extra-networks-no-cards.html
        html/image-update.svg
        javascript/extraNetworks.js
        modules/extra_networks.py
        modules/extra_networks_hypernet.py
        modules/hashes.py
        modules/mac_specific.py
        modules/models/diffusion/ddpm_edit.py
        modules/postprocessing.py
        modules/progress.py
        modules/scripts_auto_postprocessing.py
        modules/scripts_postprocessing.py
        modules/sd_hijack_ip2p.py
        modules/sd_hijack_utils.py
        modules/sd_models_config.py
        modules/sd_samplers_common.py
        modules/sd_samplers_compvis.py
        modules/sd_samplers_kdiffusion.py
        modules/shared_items.py
        modules/timer.py
        modules/ui_common.py
        modules/ui_extra_networks.py
        modules/ui_extra_networks_checkpoints.py
        modules/ui_extra_networks_hypernets.py
        modules/ui_extra_networks_textual_inversion.py
        modules/ui_postprocessing.py
        scripts/postprocessing_codeformer.py
        scripts/postprocessing_gfpgan.py
        scripts/postprocessing_upscale.py
        scripts/xyz_grid.py
Please move or remove them before you merge.
Aborting
venv "C:\Users\David\OneDrive\Desktop\stable-diffusion-webui\venv\Scripts\Python.exe"
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Commit hash: 82725f0ac439f7e3b67858d55900e95330bbd326
Installing requirements for Web UI

Installing requirements for scikit_learn

#######################################################################################################
Initializing Dreambooth
If submitting an issue on github, please provide the below text for debugging purposes:

Python revision: 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Dreambooth revision: 21ddebabb47274255d516e655f997d9ddadc0fe4
SD-WebUI revision: 82725f0ac439f7e3b67858d55900e95330bbd326

Checking Dreambooth requirements...
[+] bitsandbytes version 0.35.0 installed.
[+] diffusers version 0.10.2 installed.
[+] transformers version 4.25.1 installed.
[+] xformers version 0.0.14.dev0 installed.
[+] torch version 1.12.1+cu113 installed.
[+] torchvision version 0.13.1+cu113 installed.

#######################################################################################################

loading Smart Crop reqs from C:\Users\David\OneDrive\Desktop\stable-diffusion-webui\extensions\sd_smartprocess\requirements.txt
Checking Smart Crop requirements.

Launching Web UI with arguments: --medvram --autolaunch
No module 'xformers'. Proceeding without it.
==============================================================================
You are running torch 1.12.1+cu113.
The program is tested to work with torch 1.13.1.
To reinstall the desired version, run with commandline flag --reinstall-torch.
Beware that this will cause a lot of large files to be downloaded, as well as
there are reports of issues with training tab on the latest version.

Use --skip-version-check commandline argument to disable this check.
==============================================================================
[AddNet] Updating model hashes...
100%|███████████████████████████████████████████████████████████████████████████████| 62/62 [00:00<00:00, 41329.76it/s]
Error loading script: additional_networks.py
Traceback (most recent call last):
  File "C:\Users\David\OneDrive\Desktop\stable-diffusion-webui\modules\scripts.py", line 229, in load_scripts
    script_module = script_loading.load_module(scriptfile.path)
  File "C:\Users\David\OneDrive\Desktop\stable-diffusion-webui\modules\script_loading.py", line 11, in load_module
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\David\OneDrive\Desktop\stable-diffusion-webui\extensions\sd-webui-additional-networks\scripts\additional_networks.py", line 279, in <module>
    xyz_grid_support.initialize(Script)
  File "C:\Users\David\OneDrive\Desktop\stable-diffusion-webui\extensions\sd-webui-additional-networks\scripts\xyz_grid_support.py", line 156, in initialize
    model = xy_grid.AxisOption(f"AddNet Model {i+1}", str, lambda p, x, xs, i=i: apply_model(p, x, xs, i), format_lora_model, confirm_models, cost=0.5, choices=lambda i=i: get_axis_model_choices(i))
TypeError: AxisOption.__new__() got an unexpected keyword argument 'cost'

[AddNet] Updating model hashes...
100%|███████████████████████████████████████████████████████████████████████████████| 62/62 [00:00<00:00, 41329.76it/s]
Hypernetwork-MonkeyPatch-Extension found!
Error loading script: api.py
Traceback (most recent call last):
  File "C:\Users\David\OneDrive\Desktop\stable-diffusion-webui\modules\scripts.py", line 229, in load_scripts
    script_module = script_loading.load_module(scriptfile.path)
  File "C:\Users\David\OneDrive\Desktop\stable-diffusion-webui\modules\script_loading.py", line 11, in load_module
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\David\OneDrive\Desktop\stable-diffusion-webui\extensions\sd_dreambooth_extension\scripts\api.py", line 25, in <module>
    from extensions.sd_dreambooth_extension.dreambooth.diff_to_sd import compile_checkpoint
  File "C:\Users\David\OneDrive\Desktop\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\diff_to_sd.py", line 269
    def convert_text_enc_state_dict_v20(text_enc_dict)
                                                      ^
SyntaxError: expected ':'

Error loading script: main.py
Traceback (most recent call last):
  File "C:\Users\David\OneDrive\Desktop\stable-diffusion-webui\modules\scripts.py", line 229, in load_scripts
    script_module = script_loading.load_module(scriptfile.path)
  File "C:\Users\David\OneDrive\Desktop\stable-diffusion-webui\modules\script_loading.py", line 11, in load_module
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\David\OneDrive\Desktop\stable-diffusion-webui\extensions\sd_dreambooth_extension\scripts\main.py", line 9, in <module>
    from extensions.sd_dreambooth_extension.dreambooth.diff_to_sd import compile_checkpoint
  File "C:\Users\David\OneDrive\Desktop\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\diff_to_sd.py", line 269
    def convert_text_enc_state_dict_v20(text_enc_dict)
                                                      ^
SyntaxError: expected ':'

Loading weights [dde8801ab0] from C:\Users\David\OneDrive\Desktop\stable-diffusion-webui\models\Stable-diffusion\Zeiberry 5050.ckpt
Creating model from config: C:\Users\David\OneDrive\Desktop\stable-diffusion-webui\models\Stable-diffusion\Zeiberry 5050.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Applying cross attention optimization (Doggettx).
Textual inversion embeddings loaded(0):
Model loaded in 2.3s (load weights from disk: 1.1s, create model: 0.3s, apply weights to model: 0.4s, apply half(): 0.5s).
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.

Additional information

I have updated SD to the newest release, I updated Python and attempted to reinstall the modules folder and the scripts for additional_networks.py.

GrandlordVaxid commented 1 year ago

one thing I can see for sure is that my \modules\scripts.py and sprict_loading.py aren't configured properly, along with various other files for each section. I don't have a ton of knowledge about how to fully utilize code editing or even using git for that matter. However, I can learn quickly.

If someone could explain it to me step by step, I would greatly appreciate it.

GrandlordVaxid commented 1 year ago

I ended up doing a fresh, clean reinstall of my stable diffusion, and narrowed the issue down to my sd-smartprocess extension. Not sure why it was causing so many issues. Remember to always back up your Loras kids!