AUTOMATIC1111 / stable-diffusion-webui

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

Offline working #1523

Closed maikelsz closed 1 year ago

maikelsz commented 1 year ago

at each start SDWebUI tries to install something from the web: "Installing requirements for Web UI". and if there is no connection, everything fails. if there is a connection at least during startup, then it can continue to work without the need for connectivity.

Is there any chance that what it wants to install will be cached? Or that what is already installed is used, and updates are only made when there is a connection?

in summary: -after install, no need of internet connection. -offline works -if there is connectivity, then update the modules

it is to be able to use SDWebUI on other PCs, and offline.for example, on laptops during travel or places without any connectivity (yes, I can do it with a hotspot on the mobile phone, but still)

-be able to copy the install folder to different PCs, so there is no need to download and install everything again on each one. maybe in some file it is necessary to change a path. so I can update in one PC and then just copy to the rest.

before SDWebUI I manage to run the SDUI project. this one need something form the huginface web. or wont work, BUT, sometimes works without it, and then starts and work offline. still trying to find what is is

d8ahazard commented 1 year ago

at each start SDWebUI tries to install something from the web: "Installing requirements for Web UI". and if there is no connection, everything fails. if there is a connection at least during startup, then it can continue to work without the need for connectivity.

Is there any chance that what it wants to install will be cached? Or that what is already installed is used, and updates are only made when there is a connection?

in summary: -after install, no need of internet connection. -offline works -if there is connectivity, then update the modules

it is to be able to use SDWebUI on other PCs, and offline.for example, on laptops during travel or places without any connectivity (yes, I can do it with a hotspot on the mobile phone, but still)

-be able to copy the install folder to different PCs, so there is no need to download and install everything again on each one. maybe in some file it is necessary to change a path. so I can update in one PC and then just copy to the rest.

before SDWebUI I manage to run the SDUI project. this one need something form the huginface web. or dont work, BUT, sometimes works without it´, y can start and work offline. still trying to find what is is

It would be helpful to know where it's actually erroring out. I'd imagine it's choking on the git clone bits.

But, as far as I can tell, if you were to run this on a machine with an internet connection, then copy the whole directory to another computer that also has the same python installations...it should work? The venv is set up within the project directory, the models are downloaded within the project directory...and the repos are cloned to the project directory.

Post a log from the console of the error you're getting, I can take a look and provide more insight.

maikelsz commented 1 year ago

full console log:


venv "f:\stable-diffusion-webui\stable-diffusion-webui\venv\Scripts\Python.exe" Python 3.8.4rc1 (tags/v3.8.4rc1:6c38841, Jun 30 2020, 15:17:30) [MSC v.1924 64 bit (AMD64)] Commit hash: 2b03f0bbda1229dff6e7ab6f656b28587eba8308 Installing requirements for Web UI Traceback (most recent call last): File "launch.py", line 125, in run_pip(f"install -r {requirements_file}", "requirements for Web UI") File "launch.py", line 63, in run_pip return run(f'"{python}" -m pip {args} --prefer-binary', desc=f"Installing {desc}", errdesc=f"Couldn't install {desc}") File "launch.py", line 53, in run raise RuntimeError(message) RuntimeError: Couldn't install requirements for Web UI. Command: "f:\stable-diffusion-webui\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install -r requirements_versions.txt --prefer-binary Error code: 1 stdout: Collecting git+https://github.com/openai/CLIP@d50d76daa670286dd6cacf3bcd80b5e4823fc8e1 (from -r requirements_versions.txt (line 21)) Cloning https://github.com/openai/CLIP (to revision d50d76daa670286dd6cacf3bcd80b5e4823fc8e1) to c:\users\user\appdata\local\temp\pip-req-build-2aqgsveq

stderr: Running command git clone -q https://github.com/openai/CLIP 'C:\Users\User\AppData\Local\Temp\pip-req-build-2aqgsveq' fatal: unable to access 'https://github.com/openai/CLIP/': Could not resolve host: github.com ERROR: Command errored out with exit status 128: git clone -q https://github.com/openai/CLIP 'C:\Users\User\AppData\Local\Temp\pip-req-build-2aqgsveq' Check the logs for full command output. WARNING: You are using pip version 20.1.1; however, version 22.2.2 is available. You should consider upgrading via the 'f:\stable-diffusion-webui\stable-diffusion-webui\venv\Scripts\python.exe -m pip install --upgrade pip' command.

Press any key to continue . . .


the same happens if you are behind a proxy

d8ahazard commented 1 year ago

So it's choking on trying to git clone CLIP, which was actually just removed in a commit today.

You will still need to have an internet connection to install the requirements on first run and download models if needed, but once they are in place, I'd expect this to work fine without internet.

maikelsz commented 1 year ago

I've tried it, over and over again. always does the same "Installing requirements for Web UI"

in "venv/Lib/site-pakages" is the CLIP package. then, why try to download it again?

and if it is with GIT, in the "repositories" folder (where I think it should be downloaded), there is no CLIP. What if I clone it once manually?

if in theory when executed (with connection) it installs those requirements, in the next execution (without connection) it should not need it. No? but it keeps trying to install them, and failing to boot if there is no internet connection. but if you say it was removed in a commit, is there a way to remove it from what is already installed, say by changing some code by hand, without needing to reinstall everything. (edit: this one works by pulling form the repository) or is it run as an update?

also, behind a proxy it also fails (different one, I´ll post latter)

In another project I'm testing (stable-diffusion-ui), on every boot it downloads the latest updates it finds.

one question. SDWebUI autoupdates? or do I need to manually update and then run webui to update the rest?

kiancn commented 1 year ago

Hi! This is a hacky solution; but I believe you can just edit the launch.py file slightly to achieve your goal:

Lines 120-124 look something like this: git_clone("https://github.com/CompVis/stable-diffusion.git", repo_dir('stable-diffusion'), "Stable Diffusion", stable_diffusion_commit_hash) Commenting these lines out (if you don't have Python-fu; the outcomment is a #)

There is no reason to pull the repos every single time you run the program and it runs fine without these lines IF an initial full run have been made (things need to be there...).

You can also outcomment line (currently) line 129: run_pip(f"install -r {requirements_file}", "requirements for Web UI") Same thing; we don't need to install requirements for the webui every run (... and we don't, usually; when versions are found up to date the process just continues)

Now... I just tested this and it works fine here, no problems arise with those lines gone. If this doesn't work for you. .. Maybe the problem is outside of SD? Do you have some file cleanup system set up that maybe empties your caches or... well, anything that might move, delete, make invalid the installs between runs (perhaps you are running SD through a VM?)

maikelsz commented 1 year ago

Hi! This is a hacky solution; but I believe you can just edit the launch.py file slightly to achieve your goal:

Lines 120-124 look something like this: git_clone("https://github.com/CompVis/stable-diffusion.git", repo_dir('stable-diffusion'), "Stable Diffusion", stable_diffusion_commit_hash) Commenting these lines out (if you don't have Python-fu; the outcomment is a #)

There is no reason to pull the repos every single time you run the program and it runs fine without these lines IF an initial full run have been made (things need to be there...).

You can also outcomment line (currently) line 129: run_pip(f"install -r {requirements_file}", "requirements for Web UI") Same thing; we don't need to install requirements for the webui every run (... and we don't, usually; when versions are found up to date the process just continues)

Now... I just tested this and it works fine here, no problems arise with those lines gone. If this doesn't work for you. .. Maybe the problem is outside of SD? Do you have some file cleanup system set up that maybe empties your caches or... well, anything that might move, delete, make invalid the installs between runs (perhaps you are running SD through a VM?)

not working.

well, kind of.

now it wants tokenization from hugginface, fails to connect/get it, of course, is working offline. a different project I've testing does the same, but sometime works without it, as if the token was cached or something, then it can start off line

the console:


Traceback (most recent call last): File "f:\stable-diffusion-webui\stable-diffusion-webui\venv\lib\site-packages\urllib3\connection.py", line 174, in _new_conn conn = connection.create_connection( File "f:\stable-diffusion-webui\stable-diffusion-webui\venv\lib\site-packages\urllib3\util\connection.py", line 95, in create_connection raise err File "f:\stable-diffusion-webui\stable-diffusion-webui\venv\lib\site-packages\urllib3\util\connection.py", line 85, in create_connection sock.connect(sa) ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "f:\stable-diffusion-webui\stable-diffusion-webui\venv\lib\site-packages\urllib3\connectionpool.py", line 700, in urlopen self._prepare_proxy(conn) File "f:\stable-diffusion-webui\stable-diffusion-webui\venv\lib\site-packages\urllib3\connectionpool.py", line 996, in _prepare_proxy conn.connect() File "f:\stable-diffusion-webui\stable-diffusion-webui\venv\lib\site-packages\urllib3\connection.py", line 358, in connect self.sock = conn = self._new_conn() File "f:\stable-diffusion-webui\stable-diffusion-webui\venv\lib\site-packages\urllib3\connection.py", line 186, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x0000021489CCCB80>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "f:\stable-diffusion-webui\stable-diffusion-webui\venv\lib\site-packages\requests\adapters.py", line 489, in send resp = conn.urlopen( File "f:\stable-diffusion-webui\stable-diffusion-webui\venv\lib\site-packages\urllib3\connectionpool.py", line 787, in urlopen retries = retries.increment( File "f:\stable-diffusion-webui\stable-diffusion-webui\venv\lib\site-packages\urllib3\util\retry.py", line 592, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /openai/clip-vit-large-patch14/resolve/main/vocab.json (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0000021489CCCB80>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "launch.py", line 143, in start_webui() File "launch.py", line 139, in start_webui import webui File "f:\stable-diffusion-webui\stable-diffusion-webui\webui.py", line 78, in shared.sd_model = modules.sd_models.load_model() File "F:\stable-diffusion-webui\stable-diffusion-webui\modules\sd_models.py", line 146, in load_model sd_model = instantiate_from_config(sd_config.model) File "F:\stable-diffusion-webui\stable-diffusion-webui\repositories\stable-diffusion\ldm\util.py", line 85, in instantiate_from_config return get_obj_from_str(config["target"])(config.get("params", dict())) File "F:\stable-diffusion-webui\stable-diffusion-webui\repositories\stable-diffusion\ldm\models\diffusion\ddpm.py", line 461, in init self.instantiate_cond_stage(cond_stage_config) File "F:\stable-diffusion-webui\stable-diffusion-webui\repositories\stable-diffusion\ldm\models\diffusion\ddpm.py", line 519, in instantiate_cond_stage model = instantiate_from_config(config) File "F:\stable-diffusion-webui\stable-diffusion-webui\repositories\stable-diffusion\ldm\util.py", line 85, in instantiate_from_config return get_obj_from_str(config["target"])(config.get("params", dict())) File "F:\stable-diffusion-webui\stable-diffusion-webui\repositories\stable-diffusion\ldm\modules\encoders\modules.py", line 141, in init self.tokenizer = CLIPTokenizer.from_pretrained(version) File "f:\stable-diffusion-webui\stable-diffusion-webui\venv\lib\site-packages\transformers\tokenization_utils_base.py", line 1723, in from_pretrained resolved_vocab_files[file_id] = cached_path( File "f:\stable-diffusion-webui\stable-diffusion-webui\venv\lib\site-packages\transformers\utils\hub.py", line 282, in cached_path output_path = get_from_cache( File "f:\stable-diffusion-webui\stable-diffusion-webui\venv\lib\site-packages\transformers\utils\hub.py", line 485, in get_from_cache r = requests.head(url, headers=headers, allow_redirects=False, proxies=proxies, timeout=etag_timeout) File "f:\stable-diffusion-webui\stable-diffusion-webui\venv\lib\site-packages\requests\api.py", line 100, in head return request("head", url, kwargs) File "f:\stable-diffusion-webui\stable-diffusion-webui\venv\lib\site-packages\requests\api.py", line 59, in request return session.request(method=method, url=url, kwargs) File "f:\stable-diffusion-webui\stable-diffusion-webui\venv\lib\site-packages\requests\sessions.py", line 587, in request resp = self.send(prep, send_kwargs) File "f:\stable-diffusion-webui\stable-diffusion-webui\venv\lib\site-packages\requests\sessions.py", line 701, in send r = adapter.send(request, kwargs) File "f:\stable-diffusion-webui\stable-diffusion-webui\venv\lib\site-packages\requests\adapters.py", line 559, in send raise ProxyError(e, request=request) requests.exceptions.ProxyError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /openai/clip-vit-large-patch14/resolve/main/vocab.json (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0000021489CCCB80>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))) Press any key to continue . . .


it seems there is some "cache" somewhere, but the token is not there anyway. a propose all that to be cached on-project, and never ask again :-) . also, an option for that token, the users could insert theirs.

ghost commented 1 year ago

I also had the same token error, but I copied .cache folder from "C:\Users\YourUserName.cache" and paste into offline PC. Then webUI started to work nicely.

maikelsz commented 1 year ago

mmm...

in https://huggingface.co/docs/transformers/installation they talk about the offline use of Transformers from cached or previously downloade files. -By setting the environment variables (Linux and Windows)... -While running... -Also by getting the files beforehand, putting them to any desired folder and configuring Transformers to use them.

I think someone here should take a look to this, to bring any of that solutions to sdwebui. That should help with offline/proxies/firewall usages contexts.

wptoux commented 1 year ago

I took the following procedures to make the webui work offline.

  1. download and put taming-transformers, stable-diffusion, k-diffusion, GFPGAN, CodeFormer, CLIP, BLIP github repos to ./repositories.
  2. download openai/clip-vit-large-patch14 from huggingface and put to ./openai/clip-vit-large-patch14
  3. download CompVis/stable-diffusion-safety-checker from huggingface and put to ./CompVis/stable-diffusion-safety-checker
  4. install requirements manually:
    pip install -U torch torchvision torchtext gdown
    pip install -r requirements.txt
    pip install repositories/CFPGAN/ repositories/CLIP/
  5. run python webui.py to start the webui.
maikelsz commented 1 year ago

I´ll try this, only need some things, most are already there. BUT, somehow today it run and boot in a offline PC (didn´t notice it was offline, only after webui fully started, that I saw in the console that git was not able to pull). Don´t know how or why it worked, before never did. I´ll need to check this out

ClashSAN commented 1 year ago

The project should always be able to run offline, in the rare case it doesn't, it means certain modules were not installed the first time. There are also times that a new version of huggingface transformers or something webui depends on gets updated during the webui.bat startup.. and it breaks your install. To be careful, you should be starting it up offline to 100% avoid fetching new updates for those packages. If it worked before, you can be 100% confident it will work the next time you start it up (without wifi connection) I hope you understand what I'm saying, cheers

maikelsz commented 1 year ago

sorry but 99% of the times SD-WebUI has not started offline or behind a proxy (I suppose there is a way to bypass the proxy, or make python/conda use the one in use) (same with another project I've been testing)

andykaufseo commented 1 year ago

i can confirm i have the same issue when not online, it tries to grab something from the web at "Installing requirements for Web UI" and then it fails...

Kuduzulush commented 1 year ago

Confirming the same issue. It looks like it is somehow linked to corporate firewall settings because it works nicely outside of the corporate network. It means for me that SD tries to connect to update itself but depending on network availability it either updates and starts or fails.

Traceback (most recent call last): File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen httplib_response = self._make_request( File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\urllib3\connectionpool.py", line 386, in _make_request self._validate_conn(conn) File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\urllib3\connectionpool.py", line 1042, in _validate_conn conn.connect() File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\urllib3\connection.py", line 414, in connect self.sock = ssl_wrapsocket( File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\urllib3\util\ssl.py", line 449, in ssl_wrap_socket ssl_sock = _ssl_wrap_socketimpl( File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\urllib3\util\ssl.py", line 493, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) File "C:\Users\aperetya\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 513, in wrap_socket return self.sslsocket_class._create( File "C:\Users\aperetya\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 1071, in _create self.do_handshake() File "C:\Users\aperetya\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 "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\requests\adapters.py", line 439, in send resp = conn.urlopen( File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\urllib3\connectionpool.py", line 787, in urlopen retries = retries.increment( File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\urllib3\util\retry.py", line 592, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /openai/clip-vit-large-patch14/resolve/main/vocab.json (Caused by SSLError(SSLCertVerificationError(1, '[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 "C:\Tools\stable-diffusion-webui\launch.py", line 295, in start() File "C:\Tools\stable-diffusion-webui\launch.py", line 290, in start webui.webui() File "C:\Tools\stable-diffusion-webui\webui.py", line 132, in webui initialize() File "C:\Tools\stable-diffusion-webui\webui.py", line 62, in initialize modules.sd_models.load_model() File "C:\Tools\stable-diffusion-webui\modules\sd_models.py", line 260, in load_model sd_model = instantiate_from_config(sd_config.model) File "C:\Tools\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\util.py", line 79, in instantiate_from_config return get_obj_from_str(config["target"])(config.get("params", dict())) File "C:\Tools\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\models\diffusion\ddpm.py", line 563, in init self.instantiate_cond_stage(cond_stage_config) File "C:\Tools\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\models\diffusion\ddpm.py", line 630, in instantiate_cond_stage model = instantiate_from_config(config) File "C:\Tools\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\util.py", line 79, in instantiate_from_config return get_obj_from_str(config["target"])(config.get("params", dict())) File "C:\Tools\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\modules\encoders\modules.py", line 99, in init self.tokenizer = CLIPTokenizer.from_pretrained(version) File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\transformers\tokenization_utils_base.py", line 1723, in from_pretrained resolved_vocab_files[file_id] = cached_path( File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\transformers\utils\hub.py", line 282, in cached_path output_path = get_from_cache( File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\transformers\utils\hub.py", line 485, in get_from_cache r = requests.head(url, headers=headers, allow_redirects=False, proxies=proxies, timeout=etag_timeout) File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\requests\api.py", line 104, in head return request('head', url, kwargs) File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\requests\api.py", line 61, in request return session.request(method=method, url=url, kwargs) File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\requests\sessions.py", line 542, in request resp = self.send(prep, send_kwargs) File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\requests\sessions.py", line 655, in send r = adapter.send(request, kwargs) File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\requests\adapters.py", line 514, in send raise SSLError(e, request=request) requests.exceptions.SSLError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /openai/clip-vit-large-patch14/resolve/main/vocab.json (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)'))) Press any key to continue . . .

stdkoehler commented 1 year ago

I have the same issue. Yesterday my ISP was down and I couldn't start the WebUI. It always hung on "Installing requirements for Web UI". It hangs on: run_pip(f"install -r {requirements_file}", "requirements for Web UI") in launch.py It seems pip needs internet connection even if nothing is to be installed?

Mapleshade20 commented 1 year ago

Confirming the same issue. It looks like it is somehow linked to corporate firewall settings because it works nicely outside of the corporate network. It means for me that SD tries to connect to update itself but depending on network availability it either updates and starts or fails.

Traceback (most recent call last): File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen httplib_response = self._make_request( File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\urllib3\connectionpool.py", line 386, in _make_request self._validate_conn(conn) File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\urllib3\connectionpool.py", line 1042, in _validate_conn conn.connect() File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\urllib3\connection.py", line 414, in connect self.sock = ssl_wrapsocket( File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\urllib3\util\ssl.py", line 449, in ssl_wrap_socket ssl_sock = _ssl_wrap_socketimpl( File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\urllib3\util\ssl.py", line 493, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) File "C:\Users\aperetya\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 513, in wrap_socket return self.sslsocket_class._create( File "C:\Users\aperetya\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 1071, in _create self.do_handshake() File "C:\Users\aperetya\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 "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\requests\adapters.py", line 439, in send resp = conn.urlopen( File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\urllib3\connectionpool.py", line 787, in urlopen retries = retries.increment( File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\urllib3\util\retry.py", line 592, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /openai/clip-vit-large-patch14/resolve/main/vocab.json (Caused by SSLError(SSLCertVerificationError(1, '[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 "C:\Tools\stable-diffusion-webui\launch.py", line 295, in start() File "C:\Tools\stable-diffusion-webui\launch.py", line 290, in start webui.webui() File "C:\Tools\stable-diffusion-webui\webui.py", line 132, in webui initialize() File "C:\Tools\stable-diffusion-webui\webui.py", line 62, in initialize modules.sd_models.load_model() File "C:\Tools\stable-diffusion-webui\modules\sd_models.py", line 260, in load_model sd_model = instantiate_from_config(sd_config.model) File "C:\Tools\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\util.py", line 79, in instantiate_from_config return get_obj_from_str(config["target"])(config.get("params", dict())) File "C:\Tools\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\models\diffusion\ddpm.py", line 563, in init self.instantiate_cond_stage(cond_stage_config) File "C:\Tools\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\models\diffusion\ddpm.py", line 630, in instantiate_cond_stage model = instantiate_from_config(config) File "C:\Tools\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\util.py", line 79, in instantiate_from_config return get_obj_from_str(config["target"])(config.get("params", dict())) File "C:\Tools\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\modules\encoders\modules.py", line 99, in init self.tokenizer = CLIPTokenizer.from_pretrained(version) File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\transformers\tokenization_utils_base.py", line 1723, in from_pretrained resolved_vocab_files[file_id] = cached_path( File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\transformers\utils\hub.py", line 282, in cached_path output_path = get_from_cache( File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\transformers\utils\hub.py", line 485, in get_from_cache r = requests.head(url, headers=headers, allow_redirects=False, proxies=proxies, timeout=etag_timeout) File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\requests\api.py", line 104, in head return request('head', url, kwargs) File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\requests\api.py", line 61, in request return session.request(method=method, url=url, kwargs) File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\requests\sessions.py", line 542, in request resp = self.send(prep, send_kwargs) File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\requests\sessions.py", line 655, in send r = adapter.send(request, kwargs) File "C:\Tools\stable-diffusion-webui\venv\lib\site-packages\requests\adapters.py", line 514, in send raise SSLError(e, request=request) requests.exceptions.SSLError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /openai/clip-vit-large-patch14/resolve/main/vocab.json (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)'))) Press any key to continue . . .

exactly the same issue for me. requests.exceptions.ProxyError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /openai/clip-vit-large-patch14/resolve/main/vocab.json (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0000019BBD6E5160>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')))

Kuduzulush commented 1 year ago

Update.

Now it works if there is no connection. I assume the issue was fixed after pulling the update.

But it is still not working if there is a connection with some restrictions.

Hope this can help.

WASasquatch commented 1 year ago

I have intermittent internet over 4G/5G, and when the internet drops, the WebUI says "Connection lost" error, puts a error over model list (not sure why that would need internet) and text2img results don't show, all off local install and using local address (127.0.0.1), is this normal behavior?

NoteToSelfFindGoodNickname commented 1 year ago

I got a DOS bomb attack warning in Web UI, and I wanted to work offline, and finding out that this does not work is intimidating.

WASasquatch commented 1 year ago

I'm more concerned why on earth it would require internet to begin, and be monitoring internet on a localhost session, to then kill my session cause it can't access the outside web. Seems shady without a legitimate reason.

It makes sense during installation, but if it's installed, and there is no net, it should skip all this and just launch. But to then disable the actual WebUI once launched, cause internet dies, is fishy.

HotChocut commented 1 year ago

I made this repository real quick based off the hacky solution by @kiancn, it's pretty much the same thing except it updates itself every time so that it shouldn't break (hopefully). It's not even close to neat but it gets the job done. (at least for me)

kiancn commented 1 year ago

@HotChocut I'll take that as some sort of compliment :) And have a look at the repo

HotChocut commented 1 year ago

@kiancn it is indeed a complement! Thanks to your solution I was able to get a lot of training done while traveling so I am very grateful! As for the repo all it does is copy the text from launch.py to launch-offline.py, then hash out the line such as in your solution, then copies webui.bat to webui-offline.bat and changes it to use launch-offline.py instead of launch.py so that both launch-offline.py and webui-offline.bat are up-to-date every time you run webui-user-offline.bat to launch stable diffusion without internet.

I could definitely improve webui-offline-setup.bat as right now it's just a slightly changed webui.bat but I'm not particularly familiar with python so I just left it as is since it worked well enough, if there's something I could do to improve it or if there are any issues please let me know as I am by no means an expert so I'm sure I've overlooked planty of things

dadadies commented 1 year ago

Thank you HotChocut. I went through the trouble of registering just to thank you for sharing the solution which I could find no where else. But also thank you too kiancn for the initial solution. I read it and was sure it was the solution but HotChocut made it easier. And also thank you to maikelsz for bringing up this issue. Im going to assume my problem was that I am using Psiphon for internet connection so its some sort of proxy or maybe bad internet connection through Psiphon (my internet speed is a quarter of 1MB and always disconnecting every few mins) - I assume this because I initially got SD working fine using a solid public wifi connection. I come home and poo. Nothing works. So with this offline solution I can finally sit for 10 to 20 minutes to see what kind of images an AI can generate these days, I apologize for the long post.

missionfloyd commented 1 year ago

10324

rook2pawn commented 1 year ago

@kiancn this worked for me, ty