AUTOMATIC1111 / stable-diffusion-webui

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

[Bug]: Image generation fails after one image is generated #10432

Open hectoreccles opened 1 year ago

hectoreccles commented 1 year ago

Is there an existing issue for this?

What happened?

Currently running macOS and Brave browser. After generating the first image this appears beneath it URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)> and where the image is supposed to be displayed displays a grey image icon. Originally I believed it was something to do with my python copy so I reinstalled that but still no luck. After a bit of googling I found that I need to run a certain file in my python 3.11 folder however even after running it I still am getting the same error. The issue is new previously it was fine.

Steps to reproduce the problem

  1. Open the WebUi
  2. Press generate image
  3. Set amount of images to 2
  4. Wait for first image to generate
  5. Second image fails to generate

What should have happened?

The second image should generate.

Commit where the problem happens

https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/89f9faa63388756314e8a1d96cf86bf5e0663045

What platforms do you use to access the UI ?

MacOS

What browsers do you use to access the UI ?

Brave

Command Line Arguments

No

List of extensions

No

Console logs

Last login: Tue May 16 12:25:36 on ttys000
HOME=/Users/User
LANG=en_US.UTF-8
LOGNAME=User
OLDPWD=/Users/User
PATH=/Library/Frameworks/Python.framework/Versions/3.11/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin
PWD=/Users/User
SHELL=/bin/zsh
SHLVL=1
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.ufW1fNwdpH/Listeners
TERM=xterm-256color
TERM_PROGRAM=Apple_Terminal
TERM_PROGRAM_VERSION=447
TERM_SESSION_ID=4F1A9475-C651-4185-8E5A-3C912EE993AA
TMPDIR=/var/folders/bb/kw1tyny91vx_vftpyp31fclw0000gn/T/
USER=User
XPC_FLAGS=0x0
XPC_SERVICE_NAME=0
__CFBundleIdentifier=com.apple.Terminal
/Users/User/.zshrc:3: unmatched "
User@User-MacBook-Pro ~ % cd applications
User@User-MacBook-Pro applications % cd python-1.11
cd: no such file or directory: python-1.11
User@User-MacBook-Pro applications % /Applications/Python-3.11/Install\ Certificates.command
 -- pip install --upgrade certifi
Requirement already satisfied: certifi in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (2023.5.7)
 -- removing any existing file or link
 -- creating symlink to certifi certificate bundle
 -- setting permissions
 -- update complete
User@User-MacBook-Pro applications % cd
User@User-MacBook-Pro ~ % cd stable-diffusion-webui
User@User-MacBook-Pro stable-diffusion-webui % ./webui.sh

################################################################
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye)
################################################################

################################################################
Running on User user
################################################################

################################################################
Repo already cloned, using it as install directory
################################################################

################################################################
Create and activate python venv
################################################################

################################################################
Launching launch.py...
################################################################
Python 3.10.10 (v3.10.10:aad5f6a891, Feb  7 2023, 08:47:40) [Clang 13.0.0 (clang-1300.0.29.30)]
Version: v1.2.1
Commit hash: 89f9faa63388756314e8a1d96cf86bf5e0663045
Installing requirements
Launching Web UI with arguments: --skip-torch-cuda-test --upcast-sampling --no-half-vae --use-cpu interrogate
No module 'xformers'. Proceeding without it.
Warning: caught exception 'Torch not compiled with CUDA enabled', memory monitor disabled
==============================================================================
You are running torch 1.12.1.
The program is tested to work with torch 2.0.0.
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.
==============================================================================
reading lora /Users/User/stable-diffusion-webui/models/Lora/liyuuLora_liyuuV1.safetensors: AssertionError
Traceback (most recent call last):
  File "/Users/User/stable-diffusion-webui/extensions-builtin/Lora/lora.py", line 84, in __init__
    self.metadata = sd_models.read_metadata_from_safetensors(filename)
  File "/Users/User/stable-diffusion-webui/modules/sd_models.py", line 232, in read_metadata_from_safetensors
    assert metadata_len > 2 and json_start in (b'{"', b"{'"), f"{filename} is not a safetensors file"
AssertionError: /Users/User/stable-diffusion-webui/models/Lora/liyuuLora_liyuuV1.safetensors is not a safetensors file

Loading weights [d319cb2188] from /Users/User/stable-diffusion-webui/models/Stable-diffusion/babes_20.safetensors
Creating model from config: /Users/User/stable-diffusion-webui/configs/v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 10.3s (import torch: 2.5s, import gradio: 1.8s, import ldm: 0.8s, other imports: 2.7s, setup codeformer: 0.3s, load scripts: 0.9s, create ui: 1.1s, gradio launch: 0.2s).
DiffusionWrapper has 859.52 M params.
Loading VAE weights specified in settings: /Users/User/stable-diffusion-webui/models/VAE/vae-ft-mse-840000-ema-pruned.ckpt
Applying cross attention optimization (InvokeAI).
Textual inversion embeddings loaded(0): 
Model loaded in 24.0s (load weights from disk: 0.7s, create model: 1.2s, apply weights to model: 14.7s, apply half(): 4.0s, load VAE: 1.9s, move model to device: 1.3s, load textual inversion embeddings: 0.2s).
/Users/User/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/amp/autocast_mode.py:198: UserWarning: User provided device_type of 'cuda', but CUDA is not available. Disabling
  warnings.warn('User provided device_type of \'cuda\', but CUDA is not available. Disabling')
/Users/User/stable-diffusion-webui/venv/lib/python3.10/site-packages/transformers/models/clip/modeling_clip.py:736: UserWarning: The operator 'aten::index.Tensor' is not currently supported on the MPS backend and will fall back to run on the CPU. This may have performance implications. (Triggered internally at  /Users/runner/work/pytorch/pytorch/pytorch/aten/src/ATen/mps/MPSFallback.mm:11.)
  pooled_output = last_hidden_state[
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 40/40 [05:43<00:00,  8.59s/it]
/Users/User/stable-diffusion-webui/venv/lib/python3.10/site-packages/torchvision/models/_utils.py:208: UserWarning: The parameter 'pretrained' is deprecated since 0.13 and will be removed in 0.15, please use 'weights' instead.
  warnings.warn(
/Users/User/stable-diffusion-webui/venv/lib/python3.10/site-packages/torchvision/models/_utils.py:223: UserWarning: Arguments other than a weight enum or `None` for 'weights' are deprecated since 0.13 and will be removed in 0.15. The current behavior is equivalent to passing `weights=None`.
  warnings.warn(msg)
Downloading: "https://github.com/xinntao/facexlib/releases/download/v0.1.0/detection_Resnet50_Final.pth" to /Users/User/stable-diffusion-webui/models/GFPGAN/detection_Resnet50_Final.pth

Error completing request
Arguments: ('task(v4jv06x7mkj3drg)', 'woman, solo, dj, blonde hair, white eyes, detailed face, Egyptian jewelry,\n([Margot Robbie|Scarlett Johansson|Amber Heard]:0.8), (arosen style :0.9),\nmasterpiece, professional, high quality, beautiful, amazing, vintage, Behance, black lingerie,\nphotoshoot, 4k, realistic, detailed background, astonishing, real life, by Howard Pyle, by Joaqun Sorolla,', 'naked, nipples, tattoo, bad anatomy, bad hands, text, error, missing fingers, extra digit, extra ears, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, out of focus, ugly, old, deformed, amateur drawing, odd, fat, morphing, black and white, monocolored, lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, extra ears, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, out of focus, censorship, ugly, old, deformed, amateur drawing', [], 40, 0, True, False, 1, 1, 6, -1.0, -1.0, 0, 0, 0, False, 952, 720, False, 0.7, 2, 'Latent', 0, 0, 0, ['ENSD: 31337'], 0, False, False, 'positive', 'comma', 0, False, False, '', 1, '', [], 0, '', [], 0, '', [], True, False, False, False, 0) {}
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1348, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1282, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1328, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1277, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1037, in _send_output
    self.send(msg)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 975, in send
    self.connect()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1454, in connect
    self.sock = self._context.wrap_socket(self.sock,
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 513, in wrap_socket
    return self.sslsocket_class._create(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1071, in _create
    self.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1342, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/User/stable-diffusion-webui/modules/call_queue.py", line 57, in f
    res = list(func(*args, **kwargs))
  File "/Users/User/stable-diffusion-webui/modules/call_queue.py", line 37, in f
    res = func(*args, **kwargs)
  File "/Users/User/stable-diffusion-webui/modules/txt2img.py", line 56, in txt2img
    processed = process_images(p)
  File "/Users/User/stable-diffusion-webui/modules/processing.py", line 526, in process_images
    res = process_images_inner(p)
  File "/Users/User/stable-diffusion-webui/modules/processing.py", line 711, in process_images_inner
    x_sample = modules.face_restoration.restore_faces(x_sample)
  File "/Users/User/stable-diffusion-webui/modules/face_restoration.py", line 19, in restore_faces
    return face_restorer.restore(np_image)
  File "/Users/User/stable-diffusion-webui/modules/gfpgan_model.py", line 111, in restore
    return gfpgan_fix_faces(np_image)
  File "/Users/User/stable-diffusion-webui/modules/gfpgan_model.py", line 53, in gfpgan_fix_faces
    model = gfpgann()
  File "/Users/User/stable-diffusion-webui/modules/gfpgan_model.py", line 40, in gfpgann
    model = gfpgan_constructor(model_path=model_file, upscale=1, arch='clean', channel_multiplier=2, bg_upsampler=None, device=devices.device_gfpgan)
  File "/Users/User/stable-diffusion-webui/venv/lib/python3.10/site-packages/gfpgan/utils.py", line 79, in __init__
    self.face_helper = FaceRestoreHelper(
  File "/Users/User/stable-diffusion-webui/venv/lib/python3.10/site-packages/facexlib/utils/face_restoration_helper.py", line 99, in __init__
    self.face_det = init_detection_model(det_model, half=False, device=self.device, model_rootpath=model_rootpath)
  File "/Users/User/stable-diffusion-webui/venv/lib/python3.10/site-packages/facexlib/detection/__init__.py", line 18, in init_detection_model
    model_path = load_file_from_url(
  File "/Users/User/stable-diffusion-webui/modules/gfpgan_model.py", line 94, in facex_load_file_from_url
    return facex_load_file_from_url_orig(**dict(kwargs, save_dir=model_path, model_dir=None))
  File "/Users/User/stable-diffusion-webui/venv/lib/python3.10/site-packages/facexlib/utils/misc.py", line 77, in load_file_from_url
    download_url_to_file(url, cached_file, hash_prefix=None, progress=progress)
  File "/Users/User/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/hub.py", line 593, in download_url_to_file
    u = urlopen(req)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 519, in open
    response = self._open(req, data)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 536, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 496, in _call_chain
    result = func(*args)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1391, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1351, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)>

Additional information

I have replaced my user name with User for anonymity reasons.

Lalimec commented 1 year ago

I have the same error, it is so annoying. A couple days before it started to become unresponsive after a couple generations but now it is limited to 1 image only lol. And terminal also doesnt throw any errors like above. If I refresh the page i get another generation. Inresting thing is if I continue using the the same method (txt2img, img2img) it can generate a couple more, however when I switct to another mode it refuses to work.

(base) ubuntu@ip-172-31-37-133:~/stable-diffusion-webui$ bash webui.sh

################################################################
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye)
################################################################

################################################################
Running on ubuntu user
################################################################

################################################################
Repo already cloned, using it as install directory
################################################################

################################################################
Create and activate python venv
################################################################

################################################################
Launching launch.py...
################################################################
Cannot locate TCMalloc (improves CPU memory usage)
Python 3.10.11 | packaged by conda-forge | (main, May 10 2023, 18:58:44) [GCC 11.3.0]
Version: v1.2.1
Commit hash: 89f9faa63388756314e8a1d96cf86bf5e0663045
Installing requirements

No module 'xformers'. Proceeding without it.
If submitting an issue on github, please provide the full startup log for debugging purposes.

Initializing Dreambooth
Dreambooth revision: 926ae204ef5de17efca2059c334b6098492a0641
Successfully installed fastapi-0.94.1 gitpython-3.1.31 google-auth-oauthlib-0.4.6 requests-2.30.0 transformers-4.26.1

Does your project take forever to startup?
Repetitive dependency installation may be the reason.
Automatic1111's base project sets strict requirements on outdated dependencies.
If an extension is using a newer version, the dependency is uninstalled and reinstalled twice every startup.

[!] xformers NOT installed.
[+] torch version 2.0.1+cu118 installed.
[+] torchvision version 0.15.2+cu118 installed.
[+] accelerate version 0.18.0 installed.
[+] diffusers version 0.14.0 installed.
[+] transformers version 4.26.1 installed.
[+] bitsandbytes version 0.35.4 installed.

Installing sd-dynamic-prompts requirements.txt

Installing imageio-ffmpeg requirement for depthmap script

Installing SD-CN-Animation requirement: scikit-image==0.19.2

Launching Web UI with arguments: --disable-nan-check --no-half-vae --listen --max-batch-count 16 --theme dark --enable-insecure-extension-access --disable-safe-unpickle --api --enable-console-prompts --cors-allow-origins=http://localhost:9999 --cors-allow-origins=https://www.painthua.com
2023-05-17 16:13:49.504547: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-05-17 16:13:50.162278: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
No module 'xformers'. Proceeding without it.
Civitai Helper: Get Custom Model Folder
Civitai Helper: Load setting from: /home/ubuntu/stable-diffusion-webui/extensions/Stable-Diffusion-Webui-Civitai-Helper/setting.json
Civitai Helper: No setting file, use default
[AddNet] Updating model hashes...
0it [00:00, ?it/s]
[AddNet] Updating model hashes...
0it [00:00, ?it/s]
ControlNet v1.1.173
ControlNet v1.1.173
Loading weights [da5224a242] from /home/ubuntu/stable-diffusion-webui/models/Stable-diffusion/aZovyaRPGArtistTools_v2.safetensors
Creating model from config: /home/ubuntu/stable-diffusion-webui/configs/v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Couldn't find VAE named vae-ft-mse-840000-ema-pruned.vae.pt; using None instead
Applying cross attention optimization (Doggettx).
Error loading embedding AS-Youngest.pt:
Traceback (most recent call last):
  File "/home/ubuntu/stable-diffusion-webui/modules/textual_inversion/textual_inversion.py", line 210, in load_from_dir
    self.load_from_file(fullfn, fn)
  File "/home/ubuntu/stable-diffusion-webui/modules/textual_inversion/textual_inversion.py", line 161, in load_from_file
    data = torch.load(path, map_location="cpu")
  File "/home/ubuntu/stable-diffusion-webui/modules/safe.py", line 107, in load
    return load_with_extra(filename, extra_handler=global_extra_handler, *args, **kwargs)
  File "/home/ubuntu/stable-diffusion-webui/modules/safe.py", line 152, in load_with_extra
    return unsafe_torch_load(filename, *args, **kwargs)
  File "/home/ubuntu/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/serialization.py", line 815, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
  File "/home/ubuntu/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/serialization.py", line 1033, in _legacy_load
    magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, '{'.

Textual inversion embeddings loaded(4): AS-Young, AS-Young-neg, AS-Younger, bad-hands-5
Model loaded in 3.1s (load weights from disk: 0.2s, create model: 0.4s, apply weights to model: 0.4s, apply half(): 0.2s, load VAE: 1.5s, move model to device: 0.3s).
Image Browser: ImageReward is not installed, cannot be used.
*Deforum ControlNet support: enabled*
Running on local URL:  http://0.0.0.0:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 12.5s (import torch: 2.5s, import gradio: 1.0s, import ldm: 0.5s, other imports: 0.5s, load scripts: 6.0s, create ui: 1.6s, gradio launch: 0.3s).

img2img: tttttt
100%|███████████████████████████████████████████| 20/20 [00:01<00:00, 11.24it/s]
Total progress: 100%|███████████████████████████| 20/20 [00:01<00:00, 11.43it/s]
Total progress: 100%|███████████████████████████| 20/20 [00:01<00:00, 12.17it/s]
img2img: tttttt
100%|███████████████████████████████████████████| 20/20 [00:01<00:00, 12.06it/s]
Total progress: 100%|███████████████████████████| 20/20 [00:01<00:00, 11.50it/s]
Total progress: 100%|███████████████████████████| 20/20 [00:01<00:00, 12.17it/s]
img2img: tttttt
100%|███████████████████████████████████████████| 20/20 [00:01<00:00, 12.04it/s]
Total progress: 100%|███████████████████████████| 20/20 [00:01<00:00, 11.46it/s]
Total progress: 100%|███████████████████████████| 20/20 [00:01<00:00, 12.16it/s]
img2img: ssss
100%|███████████████████████████████████████████| 20/20 [00:01<00:00, 12.04it/s]
Total progress: 100%|███████████████████████████| 20/20 [00:01<00:00, 11.49it/s]
Total progress: 100%|███████████████████████████| 20/20 [00:01<00:00, 12.15it/s]
BuBaLoM-JMP commented 1 year ago

torch version 2.0.1+cu118 installed no support nvidia low 3000 an 4000 version, uninstall torch version 2.0.1 , install torch: 1.13.1+cu117

Lalimec commented 1 year ago

torch version 2.0.1+cu118 installed no support nvidia low 3000 an 4000 version, uninstall torch version 2.0.1 , install torch: 1.13.1+cu117

im using an ec2 instance, which is a g5 with 24gb vram. I m not sure if thats the problem.