AUTOMATIC1111 / stable-diffusion-webui

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

Error loading script #8551

Open Tobe2d opened 1 year ago

Tobe2d commented 1 year ago

Is there an existing issue for this?

What happened?

When I start webui-user.bat it shows this error:

Error loading script: two_shot.py
Traceback (most recent call last):
  File "C:\stable-diffusion-webui\modules\scripts.py", line 248, in load_scripts
    script_module = script_loading.load_module(scriptfile.path)
  File "C:\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:\stable-diffusion-webui\extensions\stable-diffusion-webui-two-shot\scripts\two_shot.py", line 16, in <module>
    from modules.script_callbacks import CFGDenoisedParams, on_cfg_denoised, on_after_ui
ImportError: cannot import name 'on_after_ui' from 'modules.script_callbacks' (C:\stable-diffusion-webui\modules\script_callbacks.py)

Steps to reproduce the problem

Update automatic1111 to latest and start webui-user.bat

What should have happened?

No error should show ;-)

Commit where the problem happens

Master

What platforms do you use to access the UI ?

Windows

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

set COMMANDLINE_ARGS= --autolaunch --api --xformers --vae-path "models\VAE\vae-ft-mse-840000-ema-pruned.pt"

List of extensions

a1111-sd-webui-haku-img a1111-stable-diffusion-webui-vram-estimator batch-face-swap clip-interrogator-ext ddetailer deforum-for-automatic1111-webui depth-image-io-for-SDWebui depthmap2mask DreamArtist-sd-webui-extension ebsynth_utility enhanced-img2img multidiffusion-upscaler-for-automatic1111 openOutpaint-webUI-extension openpose-editor sd-3dmodel-loader sd-civitai-browser sd-extension-steps-animation sd-extension-system-info sd-fractal-zoom sd-webui-additional-networks sd-webui-ar sd-webui-controlnet sd-webui-depth-lib sd-webui-model-converter sd-webui-riffusion seed_travel shift-attention stable-diffusion-webui stable-diffusion-webui-chatgpt-utilities stable-diffusion-webui-composable-lora stable-diffusion-webui-depthmap-script stable-diffusion-webui-images-browser stable-diffusion-webui-instruct-pix2pix stable-diffusion-webui-prompt-travel stable-diffusion-webui-Prompt_Generator stable-diffusion-webui-two-shot ultimate-upscale-for-automatic1111

Console logs

Already up to date.
venv "c:|stable-diffusion-webui\venv\Scripts\Python.exe"
Python 3.10.9 (tags/v3.10.9:1dd9be6, Dec  6 2022, 20:01:21) [MSC v.1934 64 bit (AMD64)]
Commit hash: 806aa5e8e7a9a6e9e8c213ecc539002b494e9f84
Installing requirements for Web UI
Installing requirements for Batch Face Swap

Installing requirements for scikit_learn

Installing requirements for Ebsynth Utility
Installing requirements for Ebsynth Utility

Initializing Riffusion

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

Launching Web UI with arguments: --autolaunch --api --xformers --vae-path models\VAE\vae-ft-mse-840000-ema-pruned.pt
*Deforum ControlNet support: enabled*
[AddNet] Updating model hashes...
0it [00:00, ?it/s]
[AddNet] Updating model hashes...
0it [00:00, ?it/s]
Error loading script: two_shot.py
Traceback (most recent call last):
  File "c:|stable-diffusion-webui\modules\scripts.py", line 248, in load_scripts
    script_module = script_loading.load_module(scriptfile.path)
  File "c:|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:|stable-diffusion-webui\extensions\stable-diffusion-webui-two-shot\scripts\two_shot.py", line 16, in <module>
    from modules.script_callbacks import CFGDenoisedParams, on_cfg_denoised, on_after_ui
ImportError: cannot import name 'on_after_ui' from 'modules.script_callbacks' (c:|stable-diffusion-webui\modules\script_callbacks.py)

Loading weights [e1441589a6] from c:|stable-diffusion-webui\models\Stable-diffusion\SD_SD\v1-5-pruned.ckpt
Creating model from config: c:|stable-diffusion-webui\configs\v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Loading VAE weights from commandline argument: models\VAE\vae-ft-mse-840000-ema-pruned.pt
Applying xformers cross attention optimization.
Textual inversion embeddings loaded(0):
Textual inversion embeddings skipped(3): 21charturnerv2, InkPunk768, InkPunkLandscapes768
Model loaded in 4.3s (load weights from disk: 2.1s, create model: 0.2s, apply weights to model: 0.3s, apply half(): 0.4s, load VAE: 0.2s, move model to device: 0.4s, load textual inversion embeddings: 0.7s).
3840 1600
1550
add tab
[VRAMEstimator] Loaded benchmark data.
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 28.9s (import gradio: 2.2s, import ldm: 1.4s, other imports: 1.8s, list extensions: 4.4s, load scripts: 3.4s, load SD checkpoint: 4.5s, create ui: 10.9s, gradio launch: 0.1s).

Additional information

It was working perfictly with 0 errors before pulling the last update, however I havent updated automatic1111 since few weeks ago. Yester day I added git pull in the webui.bat and it did update and the error start showing.

hananbeer commented 1 year ago

looks like it was added here: https://github.com/ashen-sensored/stable-diffusion-webui/commit/44d96f014e8cfd424955ac72994c5f557a0e7134

but perhaps it was not merged? try using that commit perhaps it will fix your issue

or revert the two_shot script to an older version:

cd C:\stable-diffusion-webui\extensions\stable-diffusion-webui-two-shot
git reset --hard
Tobe2d commented 1 year ago

I just try

git reset --hard

And still got the same ;-(

So maybe I should just wait and it sill be merged

G-force78 commented 1 year ago

I had similar issue, I fixed it by adding this in before the command line , obviously your file path may need to be changed

!git apply --ignore-whitespace /content/stable-diffusion-webui/extensions/sd-webui-two-shot/0001-Adding-after_ui_callback-for-scripts.patch

GawainProdigy commented 8 months ago

I just fixed the two-shot error. Using A1111 for quite a while. If I can't resolve an issue by digging and trying what others have had success with,

I delete the venv.

Afterwards, click your usual start file for A1111, and most of your requirements and extention requirements will be installed properly and eliminate conflicts.