d8ahazard / sd_dreambooth_extension

Other
1.85k stars 281 forks source link

[Bug]: Cannot create models when offline #1412

Closed Karlotos closed 6 months ago

Karlotos commented 7 months ago

Is there an existing issue for this?

What happened?

My understanding is that Dreambooth is supposed to work offline once all required dependencies/files etc... are downloaded.

I have gone online and made a fresh install of Auto1111 and Dreambooth. I downloaded all dependencies, created a test model, trained it, saved model and exported working checkpoint.

I have then gone offline and tried to replicate the exact same process with the exact same settings and am getting errors because it is trying to connect to the internet.

Steps to reproduce the problem

  1. Install dreambooth, downloading dependencies and files.
  2. Create model and run local training on local checkpoint to check it works and get any more required downloads
  3. Go offline
  4. Try to create model again

Commit and libraries

Initializing Dreambooth Dreambooth revision: c548ede6a3acb85d78650ff50ae583786b305f0e Checking xformers... Checking bitsandbytes... Checking bitsandbytes (Windows) Virtual environment path: C:\Users\User1\Desktop\Stable-Diffusion\stable-diffusion-webui\venv Checking for C:\Users\User1\Desktop\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\bitsandbytes\libbitsandbytes_cuda118.dll Checking Dreambooth requirements... [Dreambooth] accelerate v0.21.0 is already installed. [Dreambooth] dadaptation v3.1 is already installed. [Dreambooth] diffusers v0.23.1 is already installed. [Dreambooth] discord-webhook v1.3.0 is already installed. [Dreambooth] fastapi is already installed. [Dreambooth] gitpython v3.1.40 is not installed. Successfully installed gitpython-3.1.40

[Dreambooth] pytorch_optimizer v2.12.0 is already installed. [Dreambooth] Pillow is already installed. [Dreambooth] tqdm is already installed. [Dreambooth] tomesd v0.1.2 is already installed. [Dreambooth] transformers v4.30.2 is already installed. [Dreambooth] tensorboard v2.13.0 is already installed. [!] xformers version 0.0.20 installed. [+] torch version 2.0.1+cu118 installed. [+] torchvision version 0.15.2+cu118 installed. [+] accelerate version 0.21.0 installed. [+] diffusers version 0.23.1 installed. [+] transformers version 4.30.2 installed. [+] bitsandbytes version 0.41.1 installed.

Command Line Arguments

Tried both with and without
set DREAMBOOTH_SKIP_INSTALL=True 
set TRANSFORMERS_OFFLINE=1

set COMMANDLINE_ARGS= --xformers

Console logs


Extracting config from C:\Users\User1\Desktop\Stable-Diffusion\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\..\configs\v1-training-unfrozen.yaml
Extracting checkpoint from C:\Users\User1\Desktop\Stable-Diffusion\stable-diffusion-webui\models\Stable-diffusion\Example.safetensors
Something went wrong, removing model directory
Traceback (most recent call last):
  File "C:\Users\User1\Desktop\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\urllib3\connection.py", line 203, in _new_conn
    sock = connection.create_connection(
  File "C:\Users\User1\Desktop\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\urllib3\util\connection.py", line 60, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "C:\Users\User1\AppData\Local\Programs\Python\Python310\lib\socket.py", line 955, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\User1\Desktop\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\urllib3\connectionpool.py", line 790, in urlopen
    response = self._make_request(
  File "C:\Users\User1\Desktop\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\urllib3\connectionpool.py", line 491, in _make_request
    raise new_e
  File "C:\Users\User1\Desktop\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\urllib3\connectionpool.py", line 467, in _make_request
    self._validate_conn(conn)
  File "C:\Users\User1\Desktop\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\urllib3\connectionpool.py", line 1096, in _validate_conn
    conn.connect()
  File "C:\Users\User1\Desktop\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\urllib3\connection.py", line 611, in connect
    self.sock = sock = self._new_conn()
  File "C:\Users\User1\Desktop\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\urllib3\connection.py", line 210, in _new_conn
    raise NameResolutionError(self.host, self, e) from e
urllib3.exceptions.NameResolutionError: <urllib3.connection.HTTPSConnection object at 0x00000194DF849DE0>: Failed to resolve 'raw.githubusercontent.com' ([Errno 11001] getaddrinfo failed)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\User1\Desktop\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\requests\adapters.py", line 486, in send
    resp = conn.urlopen(
  File "C:\Users\User1\Desktop\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\urllib3\connectionpool.py", line 844, in urlopen
    retries = retries.increment(
  File "C:\Users\User1\Desktop\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\urllib3\util\retry.py", line 515, in increment
    raise MaxRetryError(_pool, url, reason) from reason  # type: ignore[arg-type]
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /CompVis/stable-diffusion/main/configs/stable-diffusion/v1-inference.yaml (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x00000194DF849DE0>: Failed to resolve 'raw.githubusercontent.com' ([Errno 11001] getaddrinfo failed)"))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\User1\Desktop\Stable-Diffusion\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\sd_to_diff.py", line 170, in extract_checkpoint
    pipe = StableDiffusionPipeline.from_single_file(
  File "C:\Users\User1\Desktop\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\diffusers\loaders.py", line 2822, in from_single_file
    pipe = download_from_original_stable_diffusion_ckpt(
  File "C:\Users\User1\Desktop\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\diffusers\pipelines\stable_diffusion\convert_from_ckpt.py", line 1316, in download_from_original_stable_diffusion_ckpt
    original_config_file = BytesIO(requests.get(config_url).content)
  File "C:\Users\User1\Desktop\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\requests\api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
  File "C:\Users\User1\Desktop\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\requests\api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Users\User1\Desktop\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\requests\sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\User1\Desktop\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\requests\sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\User1\Desktop\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\requests\adapters.py", line 519, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /CompVis/stable-diffusion/main/configs/stable-diffusion/v1-inference.yaml (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x00000194DF849DE0>: Failed to resolve 'raw.githubusercontent.com' ([Errno 11001] getaddrinfo failed)"))
Couldn't find C:\Users\User1\Desktop\Stable-Diffusion\stable-diffusion-webui\models\dreambooth\DB-Example-test-offline\working\unet
Unable to extract checkpoint!
Duration: 00:00:02
Can't load config!
Traceback (most recent call last):
  File "C:\Users\User1\Desktop\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 488, in run_predict
    output = await app.get_blocks().process_api(
  File "C:\Users\User1\Desktop\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1434, in process_api
    data = self.postprocess_data(fn_index, result["prediction"], state)
  File "C:\Users\User1\Desktop\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1297, in postprocess_data
    self.validate_outputs(fn_index, predictions)  # type: ignore
  File "C:\Users\User1\Desktop\Stable-Diffusion\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1272, in validate_outputs
    raise ValueError(
ValueError: An event handler (load_model_params) didn't receive enough output values (needed: 11, received: 8).
Wanted outputs:
    [<gradio.layouts.Row object at 0x000001949CD26350>, html, html, html, html, html, html, html, dropdown, dropdown, html]
Received outputs:
    [{'visible': False, '__type__': 'generic_update'}, "", "", "", "", "", {'visible': True, 'choices': [], 'value': '', '__type__': 'generic_update'}, "Error loading model params: ''."]

Additional information

I'm on Windows 10. Browser doesn't make any difference.

I'm aware the issue might be that I'm stupid, but I don't think so.

The most recent updates have not helped.

github-actions[bot] commented 6 months ago

This issue is stale because it has been open 5 days with no activity. Remove stale label or comment or this will be closed in 5 days