AUTOMATIC1111 / stable-diffusion-webui

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

[Bug]: Issues downloading LDSR Upscaling Model #8467

Open mmajdanski opened 1 year ago

mmajdanski commented 1 year ago

Is there an existing issue for this?

What happened?

[Bug]: Issues downloading LDSR Upscaling Model

There is an issue with Python trying to verify the certificate of the website. The issue seems to be that the SSL certificate on "https://heibox.uni-heidelberg.de/f/578df07c8fc04ffbadf3/?dl=1" is self signed. A good temporary fix we could put in place is download the LDSR upscaling model via http not https so that python does not give us the issue. Otherwise, have a flag for the download that allows for Self-Signed Certs.

Steps to reproduce the problem

  1. Go to Extras Tab
  2. Upscale any image with LDSR on a fresh install of Automatic111 Web UI
  3. Check console for Python SSL error

What should have happened?

Model should have downloaded properly and not thrown an error

Commit where the problem happens

0cc0ee1b

What platforms do you use to access the UI ?

Windows

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

--low-vram

List of extensions

No

Console logs

Downloading: "https://heibox.uni-heidelberg.de/f/578df07c8fc04ffbadf3/?dl=1" to D:\stable-diffusion-webui\models\LDSR\model.ckpt

Error completing request
Arguments: (0, <PIL.Image.Image image mode=RGB size=512x512 at 0x2A8A9685300>, None, '', '', True, 0, 4, 512, 512, True, 'LDSR', 'None', 0, 0, 0, 0) {}
Traceback (most recent call last):
  File "...\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 1348, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "...\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1282, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "...\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1328, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "...\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1277, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "...\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1037, in _send_output
    self.send(msg)
  File "...\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 975, in send
    self.connect()
  File "...\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1454, in connect
    self.sock = self._context.wrap_socket(self.sock,
  File "...\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 513, in wrap_socket
    return self.sslsocket_class._create(
  File "...\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 1071, in _create
    self.do_handshake()
  File "...\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 1342, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\stable-diffusion-webui\modules\call_queue.py", line 56, in f
    res = list(func(*args, **kwargs))
  File "D:\stable-diffusion-webui\modules\call_queue.py", line 37, in f
    res = func(*args, **kwargs)
  File "D:\stable-diffusion-webui\modules\postprocessing.py", line 56, in run_postprocessing
    scripts.scripts_postproc.run(pp, args)
  File "D:\stable-diffusion-webui\modules\scripts_postprocessing.py", line 130, in run
    script.process(pp, **process_args)
  File "D:\stable-diffusion-webui\scripts\postprocessing_upscale.py", line 94, in process
    upscaled_image = self.upscale(pp.image, pp.info, upscaler1, upscale_mode, upscale_by, upscale_to_width, upscale_to_height, upscale_crop)
  File "D:\stable-diffusion-webui\scripts\postprocessing_upscale.py", line 64, in upscale
    image = upscaler.scaler.upscale(image, upscale_by, upscaler.data_path)
  File "D:\stable-diffusion-webui\modules\upscaler.py", line 63, in upscale
    img = self.do_upscale(img, selected_model)
  File "D:\stable-diffusion-webui\extensions-builtin\LDSR\scripts\ldsr_model.py", line 54, in do_upscale
    ldsr = self.load_model(path)
  File "D:\stable-diffusion-webui\extensions-builtin\LDSR\scripts\ldsr_model.py", line 40, in load_model
    model = load_file_from_url(url=self.model_url, model_dir=self.model_path,
  File "D:\stable-diffusion-webui\venv\lib\site-packages\basicsr\utils\download_util.py", line 98, in load_file_from_url
    download_url_to_file(url, cached_file, hash_prefix=None, progress=progress)
  File "D:\stable-diffusion-webui\venv\lib\site-packages\torch\hub.py", line 597, in download_url_to_file
    u = urlopen(req)
  File "...\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
  File "...\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 519, in open
    response = self._open(req, data)
  File "...\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 536, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "...\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 496, in _call_chain
    result = func(*args)
  File "...\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 1391, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "...\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 1351, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)>

Additional information

No response

edwios commented 1 year ago

We should not encourage this kind of unsafe practice, and it is hard to imagine any web site still doesn't have a properly signed cert given there is LetsEncrypt and others free signing services available. Nevertheless, this is not a bug in A1111's but on the host's side.

Woisek commented 1 year ago

We should not encourage this kind of unsafe practice,

Why should it be a "unsafe practice" if a fallback/option is implemented for such cases?

and it is hard to imagine any web site still doesn't have a properly signed cert given there is LetsEncrypt and others free signing services available.

It's hard to imagine, why (some) websites should have a certificate, if there is nothing that uses personal data. The brainwash propaganda did it's work, obviously. If there is no (personal) data transfered, then why and what should be encrypted? There are more data stolen from hacks as from "man-in-the-middle" attacks. Just to get this straight.

Nevertheless, this is not a bug in A1111's but on the host's side.

Right, it's not a bug, but it would be a necessary feature to have, as no one from us can change the fact, if the host doesn't react to a request to correct this. But the developer could give us the option to "overwrite" this if needed. Just think about it, what will be faster and have more success: Asking the hoster to change his certificate or implement a switch to temporary use http?

I wouldn't bet much on asking the hoster ...

t3t3 commented 1 year ago

... just stumbled over this too; having no problem accessing the site from i.e. chrome or vivaldi (via https and on the same system of course); both think the certificate is valid.

it's a dropbox-like site of the university of heidelberg (germany), so i guess they don't need to issue self-signed certs. guess the error message is just some generic type caused by the ssl (or whatever) python module which failed to verify the CA (for whatever reason).