AUTOMATIC1111 / stable-diffusion-webui

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

[Bug]: Prompt Traveler and Sonar extensions no longer work aftere recent commits #7402

Closed illtellyoulater closed 1 year ago

illtellyoulater commented 1 year ago

Is there an existing issue for this?

What happened?

After git pulling webui latest commits I'm getting the below webui errors related to Sonar and Prompt Traveler extensions. Can anyone help fixing these?

I already updated all extensions in the extensions tab.

I am currently on 2c1bb46c7ad5b4536f6587d327a03f0ff7811c5d on Windows 10.

Not sure when this started happening but until a couple of days ago everything was working without problems.

I am no expert of this codebase but from the error messages it apparently has to do with changes to samplers code? This was also happening with the Step Animation extension which returned similar errors, but a recent extension update fixed it so this is possibly another clue indicating that these extensions are failing to catchup with some change in webui code?

Steps to reproduce the problem

as documented above

What should have happened?

extensions should load

Commit where the problem happens

2c1bb46c7ad5b4536f6587d327a03f0ff7811c5d

What platforms do you use to access the UI ?

Windows

What browsers do you use to access the UI ?

Brave

Command Line Arguments

--xformers --api

List of extensions

DreamArtist-sd-webui-extension - https://github.com/7eu7d7/DreamArtist-sd-webui-extension.git
StylePile - https://github.com/some9000/StylePile
a1111-sd-webui-haku-img - https://github.com/KohakuBlueleaf/a1111-sd-webui-haku-img.git a1111-sd-webui-tagcomplete - https://github.com/DominikDoom/a1111-sd-webui-tagcomplete
batch-face-swap - https://github.com/kex0/batch-face-swap.git
deforum-for-automatic1111-webui - https://github.com/deforum-art/deforum-for-automatic1111-webui
depthmap2mask - https://github.com/Extraltodeus/depthmap2mask.git
embedding-inspector - https://github.com/tkalayci71/embedding-inspector.git model-keyword - https://github.com/mix1009/model-keyword
openOutpaint-webUI-extension - https://github.com/zero01101/openOutpaint-webUI-extension
sd-dynamic-prompts - https://github.com/adieyal/sd-dynamic-prompts
sd-extension-steps-animation - https://github.com/vladmandic/sd-extension-steps-animation
sd-infinity-grid-generator-script - https://github.com/mcmonkeyprojects/sd-infinity-grid-generator-script.git sd-webui-model-converter - https://github.com/Akegarasu/sd-webui-model-converter sd_dreambooth_extension - https://github.com/d8ahazard/sd_dreambooth_extension
sd_smartprocess - https://github.com/d8ahazard/sd_smartprocess
seed_travel - https://github.com/yownas/seed_travel.git stable-diffusion-webui-aesthetic-image-scorer - https://github.com/tsngo/stable-diffusion-webui-aesthetic-image-scorer
stable-diffusion-webui-depthmap-script - https://github.com/thygate/stable-diffusion-webui-depthmap-script.git
stable-diffusion-webui-embedding-editor - https://github.com/CodeExplode/stable-diffusion-webui-embedding-editor.git
stable-diffusion-webui-images-browser - https://github.com/yfszzx/stable-diffusion-webui-images-browser stable-diffusion-webui-inspiration - https://github.com/yfszzx/stable-diffusion-webui-inspiration
stable-diffusion-webui-instruct-pix2pix - https://github.com/Klace/stable-diffusion-webui-instruct-pix2pix.git
stable-diffusion-webui-prompt-travel - https://github.com/Kahsolt/stable-diffusion-webui-prompt-travel.git stable-diffusion-webui-sonar - https://github.com/Kahsolt/stable-diffusion-webui-sonar.git

Console logs

Already up to date.
venv "C:\Users\username\desktop\stable-diffusion-webui\venv\Scripts\Python.exe"
Python 3.10.5 (tags/v3.10.5:f377153, Jun  6 2022, 16:14:13) [MSC v.1929 64 bit (AMD64)]
Commit hash: 2c1bb46c7ad5b4536f6587d327a03f0ff7811c5d
Installing requirements for Web UI
Installing requirements for Batch Face Swap

Installing requirements for scikit_learn
Installing sd-dynamic-prompts requirements.txt

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

Python revision: 3.10.5 (tags/v3.10.5:f377153, Jun  6 2022, 16:14:13) [MSC v.1929 64 bit (AMD64)]
Dreambooth revision: 9f4d931a319056c537d24669cb950d146d1537b0
SD-WebUI revision: 2c1bb46c7ad5b4536f6587d327a03f0ff7811c5d

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.13.1+cu117 installed.
[+] torchvision version 0.14.1+cu117 installed.

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

loading Smart Crop reqs from C:\Users\username\desktop\stable-diffusion-webui\extensions\sd_smartprocess\requirements.txt
Checking Smart Crop requirements.

Installing imageio-ffmpeg requirement for depthmap script
Installing pyqt5 requirement for depthmap script

Launching Web UI with arguments: --xformers --api
SD-Webui API layer loaded
Installing pywin32

Error loading script: prompt_travel.py
Traceback (most recent call last):
  File "C:\Users\username\desktop\stable-diffusion-webui\modules\scripts.py", line 229, in load_scripts
    script_module = script_loading.load_module(scriptfile.path)
  File "C:\Users\username\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\username\desktop\stable-diffusion-webui\extensions\stable-diffusion-webui-prompt-travel\scripts\prompt_travel.py", line 26, in <module>
    from modules.sd_samplers import single_sample_to_image
ImportError: cannot import name 'single_sample_to_image' from 'modules.sd_samplers' (C:\Users\username\desktop\stable-diffusion-webui\modules\sd_samplers.py)

Error loading script: sonar.py
Traceback (most recent call last):
  File "C:\Users\username\desktop\stable-diffusion-webui\modules\scripts.py", line 229, in load_scripts
    script_module = script_loading.load_module(scriptfile.path)
  File "C:\Users\username\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\username\desktop\stable-diffusion-webui\extensions\stable-diffusion-webui-sonar\scripts\sonar.py", line 445, in <module>
    def sample_naive(model:CFGDenoiser, x:Tensor, sigmas:List, extra_args={}, callback=None, *args):
NameError: name 'CFGDenoiser' is not defined

Loading weights [cc6cb27103] from C:\Users\username\desktop\stable-diffusion-webui\models\Stable-diffusion\SDv1-5-pruned-emaonly.ckpt
Creating model from config: C:\Users\username\desktop\stable-diffusion-webui\configs\v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Loading VAE weights specified in settings: C:\Users\username\desktop\stable-diffusion-webui\models\VAE\SDv1-5-vae-ft-mse-840000-ema-pruned.vae.pt
Applying xformers cross attention optimization.
Textual inversion embeddings loaded(0):
Model loaded in 8.7s (load weights from disk: 2.0s, create model: 0.6s, apply weights to model: 0.9s, apply husername(): 1.0s, load VAE: 0.4s, move model to device: 0.9s, load textual inversion embeddings: 2.7s).
add tab
Running on local URL:  http://127.0.0.1:7860

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


### Additional information

_No response_
dchatel commented 1 year ago

You need to edit the file C:\Users\username\desktop\stable-diffusion-webui\modules\sd_samplers.py such that the line 26 looks like this:

from modules.sd_samplers_common import single_sample_to_image

illtellyoulater commented 1 year ago

but, will this cancel out the recent samplers reorganization/optimization added with recent commits?

illtellyoulater commented 1 year ago

also, line 26 of sd_samplers.py currently looks like this:

sampler.config = config

are you sure that's the line I should edit?

dchatel commented 1 year ago

You're right. This is the right line number, but the wrong file.

You should edit this one: C:\Users\username\desktop\stable-diffusion-webui\extensions\stable-diffusion-webui-prompt-travel\scripts\prompt_travel.py

And it won't cancel any recent change done to automatic1111 webui, since the file is part of prompt-travel extension.

illtellyoulater commented 1 year ago

@dchatel seems to work, many thanks! :)

illtellyoulater commented 1 year ago

(reopening this since it was also related to Sonar, which is still not working)

dchatel commented 1 year ago

It got fixed in sonar, 7 hours ago: https://github.com/Kahsolt/stable-diffusion-webui-sonar/issues/4