brkirch / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
197 stars 10 forks source link

[Bug]: TypeError: Cannot convert a MPS Tensor to float64 dtype as the MPS framework doesn't support float64. Please use float32 instead. #36

Closed kyumin133 closed 1 year ago

kyumin133 commented 1 year ago

Is there an existing issue for this?

What happened?

I tried installing the 20230822 release. It installed successfully, but when I copied in a model into /models/Stable-diffusion, it fails. The UI does launch, but the model does not load and it does not run properly. This model runs fine on the regular stable-diffusion-webui. I did notice that a .ckpt model worked fine, but .safetensors does not seem to work.

This is on a MacBookAir M1 2020, on Ventura 13.5.1.

Steps to reproduce the problem

  1. Run installer
  2. Copy in a .safetensors model
  3. Launch web UI
  4. Model doesn't load

What should have happened?

Model should load

Commit where the problem happens

ac11482a0369668b2f926236f1b6fa54b8e5b9c2

What platforms do you use to access the UI ?

MacOS

What browsers do you use to access the UI ?

Apple Safari

Command Line Arguments

No. I tried modifying to match my custom arguments on regular stable-diffusion-webui (`export COMMANDLINE_ARGS="--skip-torch-cuda-test --no-half --upcast-sampling --opt-sub-quad-attention --use-cpu interrogate"`), but it still crashed.

List of extensions

No

Console logs

Last login: Thu Aug 24 02:32:57 on ttys002
cd '/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac';./webui.sh --electron;exit
xxxxxxxxx@xxxxxx ~ % cd '/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac';./webui.sh --electron;exit

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

################################################################
Running on xxxxxxxxx user
################################################################

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

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

################################################################
Launching launch.py...
################################################################
Python 3.10.12 (main, Aug 21 2023, 06:11:14) [Clang 14.0.3 (clang-1403.0.22.14.1)]
Version: 20230822_experimental
Commit hash: ac11482a0369668b2f926236f1b6fa54b8e5b9c2
Launching Web UI with arguments: --electron --skip-torch-cuda-test --skip-install --no-download-sd-model --no-half-vae --upcast-sampling --use-cpu interrogate
no module 'xformers'. Processing without...
no module 'xformers'. Processing without...
No module 'xformers'. Proceeding without it.
Warning: caught exception 'Torch not compiled with CUDA enabled', memory monitor disabled
Loading weights [70525c199b] from /Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/models/Stable-diffusion/xxxxxxxxxxxxxxx.safetensors
Creating model from config: /Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/configs/v1-inference.yaml
Found Electron in b'/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/bin-deps/node/lib/node_modules/electron/dist/Electron.app/Contents/MacOS/Electron\n'
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 3.7s (import torch: 1.4s, import gradio: 0.5s, setup paths: 0.4s, other imports: 0.4s, load scripts: 0.3s, create ui: 0.3s).
loading stable diffusion model: TypeError
Traceback (most recent call last):
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/bin-deps/python/3.10.12/lib/python3.10/threading.py", line 973, in _bootstrap
    self._bootstrap_inner()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/bin-deps/python/3.10.12/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/bin-deps/python/3.10.12/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/initialize.py", line 147, in load_model
    shared.sd_model  # noqa: B018
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/shared_items.py", line 110, in sd_model
    return modules.sd_models.model_data.get_sd_model()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_models.py", line 478, in get_sd_model
    load_model()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_models.py", line 605, in load_model
    load_model_weights(sd_model, checkpoint_info, state_dict, timer)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_models.py", line 333, in load_model_weights
    model.load_state_dict(state_dict, strict=False)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_disable_initialization.py", line 223, in <lambda>
    module_load_state_dict = self.replace(torch.nn.Module, 'load_state_dict', lambda *args, **kwargs: load_state_dict(module_load_state_dict, *args, **kwargs))
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_disable_initialization.py", line 221, in load_state_dict
    original(module, state_dict, strict=strict)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2138, in load_state_dict
    load(self, state_dict)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2126, in load
    load(child, child_state_dict, child_prefix)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2126, in load
    load(child, child_state_dict, child_prefix)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2126, in load
    load(child, child_state_dict, child_prefix)
  [Previous line repeated 3 more times]
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2120, in load
    module._load_from_state_dict(
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_disable_initialization.py", line 226, in <lambda>
    conv2d_load_from_state_dict = self.replace(torch.nn.Conv2d, '_load_from_state_dict', lambda *args, **kwargs: load_from_state_dict(conv2d_load_from_state_dict, *args, **kwargs))
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_disable_initialization.py", line 191, in load_from_state_dict
    module._parameters[name] = torch.nn.parameter.Parameter(torch.zeros_like(param, device=device, dtype=dtype), requires_grad=param.requires_grad)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/_meta_registrations.py", line 4425, in zeros_like
    res = aten.empty_like.default(
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/_ops.py", line 435, in __call__
    return self._op(*args, **kwargs or {})
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/_refs/__init__.py", line 4658, in empty_like
    return torch.empty_permuted(
TypeError: Cannot convert a MPS Tensor to float64 dtype as the MPS framework doesn't support float64. Please use float32 instead.

Stable diffusion model failed to load
Applying attention optimization: sub-quadratic... done.
Loading weights [70525c199b] from /Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/models/Stable-diffusion/xxxxxxxxxxxxxxx.safetensors
Creating model from config: /Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/configs/v1-inference.yaml
loading stable diffusion model: TypeError
Traceback (most recent call last):
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/bin-deps/python/3.10.12/lib/python3.10/threading.py", line 973, in _bootstrap
    self._bootstrap_inner()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/bin-deps/python/3.10.12/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/gradio/utils.py", line 703, in wrapper
    response = f(*args, **kwargs)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/ui_extra_networks.py", line 392, in pages_html
    return refresh()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/ui_extra_networks.py", line 398, in refresh
    pg.refresh()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/ui_extra_networks_textual_inversion.py", line 13, in refresh
    sd_hijack.model_hijack.embedding_db.load_textual_inversion_embeddings(force_reload=True)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/textual_inversion/textual_inversion.py", line 255, in load_textual_inversion_embeddings
    self.expected_shape = self.get_expected_shape()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/textual_inversion/textual_inversion.py", line 154, in get_expected_shape
    vec = shared.sd_model.cond_stage_model.encode_embedding_init_text(",", 1)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/shared_items.py", line 110, in sd_model
    return modules.sd_models.model_data.get_sd_model()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_models.py", line 478, in get_sd_model
    load_model()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_models.py", line 605, in load_model
    load_model_weights(sd_model, checkpoint_info, state_dict, timer)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_models.py", line 333, in load_model_weights
    model.load_state_dict(state_dict, strict=False)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_disable_initialization.py", line 223, in <lambda>
    module_load_state_dict = self.replace(torch.nn.Module, 'load_state_dict', lambda *args, **kwargs: load_state_dict(module_load_state_dict, *args, **kwargs))
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_disable_initialization.py", line 221, in load_state_dict
    original(module, state_dict, strict=strict)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2138, in load_state_dict
    load(self, state_dict)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2126, in load
    load(child, child_state_dict, child_prefix)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2126, in load
    load(child, child_state_dict, child_prefix)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2126, in load
    load(child, child_state_dict, child_prefix)
  [Previous line repeated 3 more times]
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2120, in load
    module._load_from_state_dict(
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_disable_initialization.py", line 226, in <lambda>
    conv2d_load_from_state_dict = self.replace(torch.nn.Conv2d, '_load_from_state_dict', lambda *args, **kwargs: load_from_state_dict(conv2d_load_from_state_dict, *args, **kwargs))
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_disable_initialization.py", line 191, in load_from_state_dict
    module._parameters[name] = torch.nn.parameter.Parameter(torch.zeros_like(param, device=device, dtype=dtype), requires_grad=param.requires_grad)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/_meta_registrations.py", line 4425, in zeros_like
    res = aten.empty_like.default(
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/_ops.py", line 435, in __call__
    return self._op(*args, **kwargs or {})
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/_refs/__init__.py", line 4658, in empty_like
    return torch.empty_permuted(
TypeError: Cannot convert a MPS Tensor to float64 dtype as the MPS framework doesn't support float64. Please use float32 instead.

Stable diffusion model failed to load
Loading weights [70525c199b] from /Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/models/Stable-diffusion/xxxxxxxxxxxxxxx.safetensors
Creating model from config: /Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/configs/v1-inference.yaml
Traceback (most recent call last):
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/gradio/routes.py", line 442, in run_predict
    output = await app.get_blocks().process_api(
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/gradio/blocks.py", line 1392, in process_api
    result = await self.call_function(
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/gradio/blocks.py", line 1097, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/gradio/utils.py", line 703, in wrapper
    response = f(*args, **kwargs)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/ui_extra_networks.py", line 392, in pages_html
    return refresh()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/ui_extra_networks.py", line 398, in refresh
    pg.refresh()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/ui_extra_networks_textual_inversion.py", line 13, in refresh
    sd_hijack.model_hijack.embedding_db.load_textual_inversion_embeddings(force_reload=True)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/textual_inversion/textual_inversion.py", line 255, in load_textual_inversion_embeddings
    self.expected_shape = self.get_expected_shape()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/textual_inversion/textual_inversion.py", line 154, in get_expected_shape
    vec = shared.sd_model.cond_stage_model.encode_embedding_init_text(",", 1)
AttributeError: 'NoneType' object has no attribute 'cond_stage_model'
loading stable diffusion model: TypeError
Traceback (most recent call last):
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/bin-deps/python/3.10.12/lib/python3.10/threading.py", line 973, in _bootstrap
    self._bootstrap_inner()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/bin-deps/python/3.10.12/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/gradio/utils.py", line 703, in wrapper
    response = f(*args, **kwargs)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/ui_extra_networks.py", line 392, in pages_html
    return refresh()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/ui_extra_networks.py", line 398, in refresh
    pg.refresh()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/ui_extra_networks_textual_inversion.py", line 13, in refresh
    sd_hijack.model_hijack.embedding_db.load_textual_inversion_embeddings(force_reload=True)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/textual_inversion/textual_inversion.py", line 255, in load_textual_inversion_embeddings
    self.expected_shape = self.get_expected_shape()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/textual_inversion/textual_inversion.py", line 154, in get_expected_shape
    vec = shared.sd_model.cond_stage_model.encode_embedding_init_text(",", 1)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/shared_items.py", line 110, in sd_model
    return modules.sd_models.model_data.get_sd_model()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_models.py", line 478, in get_sd_model
    load_model()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_models.py", line 605, in load_model
    load_model_weights(sd_model, checkpoint_info, state_dict, timer)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_models.py", line 333, in load_model_weights
    model.load_state_dict(state_dict, strict=False)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_disable_initialization.py", line 223, in <lambda>
    module_load_state_dict = self.replace(torch.nn.Module, 'load_state_dict', lambda *args, **kwargs: load_state_dict(module_load_state_dict, *args, **kwargs))
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_disable_initialization.py", line 221, in load_state_dict
    original(module, state_dict, strict=strict)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2138, in load_state_dict
    load(self, state_dict)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2126, in load
    load(child, child_state_dict, child_prefix)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2126, in load
    load(child, child_state_dict, child_prefix)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2126, in load
    load(child, child_state_dict, child_prefix)
  [Previous line repeated 3 more times]
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2120, in load
    module._load_from_state_dict(
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_disable_initialization.py", line 226, in <lambda>
    conv2d_load_from_state_dict = self.replace(torch.nn.Conv2d, '_load_from_state_dict', lambda *args, **kwargs: load_from_state_dict(conv2d_load_from_state_dict, *args, **kwargs))
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_disable_initialization.py", line 191, in load_from_state_dict
    module._parameters[name] = torch.nn.parameter.Parameter(torch.zeros_like(param, device=device, dtype=dtype), requires_grad=param.requires_grad)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/_meta_registrations.py", line 4425, in zeros_like
    res = aten.empty_like.default(
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/_ops.py", line 435, in __call__
    return self._op(*args, **kwargs or {})
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/_refs/__init__.py", line 4658, in empty_like
    return torch.empty_permuted(
TypeError: Cannot convert a MPS Tensor to float64 dtype as the MPS framework doesn't support float64. Please use float32 instead.

Stable diffusion model failed to load
Loading weights [70525c199b] from /Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/models/Stable-diffusion/xxxxxxxxxxxxxxx.safetensors
Traceback (most recent call last):
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/gradio/routes.py", line 442, in run_predict
    output = await app.get_blocks().process_api(
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/gradio/blocks.py", line 1392, in process_api
    result = await self.call_function(
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/gradio/blocks.py", line 1097, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/gradio/utils.py", line 703, in wrapper
    response = f(*args, **kwargs)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/ui_extra_networks.py", line 392, in pages_html
    return refresh()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/ui_extra_networks.py", line 398, in refresh
    pg.refresh()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/ui_extra_networks_textual_inversion.py", line 13, in refresh
    sd_hijack.model_hijack.embedding_db.load_textual_inversion_embeddings(force_reload=True)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/textual_inversion/textual_inversion.py", line 255, in load_textual_inversion_embeddings
    self.expected_shape = self.get_expected_shape()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/textual_inversion/textual_inversion.py", line 154, in get_expected_shape
    vec = shared.sd_model.cond_stage_model.encode_embedding_init_text(",", 1)
Creating model from config: /Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/configs/v1-inference.yaml
AttributeError: 'NoneType' object has no attribute 'cond_stage_model'
loading stable diffusion model: TypeError
Traceback (most recent call last):
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/bin-deps/python/3.10.12/lib/python3.10/threading.py", line 973, in _bootstrap
    self._bootstrap_inner()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/bin-deps/python/3.10.12/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/gradio/utils.py", line 703, in wrapper
    response = f(*args, **kwargs)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/ui.py", line 1301, in <lambda>
    update_image_cfg_scale_visibility = lambda: gr.update(visible=shared.sd_model and shared.sd_model.cond_stage_key == "edit")
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/shared_items.py", line 110, in sd_model
    return modules.sd_models.model_data.get_sd_model()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_models.py", line 478, in get_sd_model
    load_model()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_models.py", line 605, in load_model
    load_model_weights(sd_model, checkpoint_info, state_dict, timer)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_models.py", line 333, in load_model_weights
    model.load_state_dict(state_dict, strict=False)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_disable_initialization.py", line 223, in <lambda>
    module_load_state_dict = self.replace(torch.nn.Module, 'load_state_dict', lambda *args, **kwargs: load_state_dict(module_load_state_dict, *args, **kwargs))
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_disable_initialization.py", line 221, in load_state_dict
    original(module, state_dict, strict=strict)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2138, in load_state_dict
    load(self, state_dict)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2126, in load
    load(child, child_state_dict, child_prefix)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2126, in load
    load(child, child_state_dict, child_prefix)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2126, in load
    load(child, child_state_dict, child_prefix)
  [Previous line repeated 3 more times]
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2120, in load
    module._load_from_state_dict(
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_disable_initialization.py", line 226, in <lambda>
    conv2d_load_from_state_dict = self.replace(torch.nn.Conv2d, '_load_from_state_dict', lambda *args, **kwargs: load_from_state_dict(conv2d_load_from_state_dict, *args, **kwargs))
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_disable_initialization.py", line 191, in load_from_state_dict
    module._parameters[name] = torch.nn.parameter.Parameter(torch.zeros_like(param, device=device, dtype=dtype), requires_grad=param.requires_grad)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/_meta_registrations.py", line 4425, in zeros_like
    res = aten.empty_like.default(
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/_ops.py", line 435, in __call__
    return self._op(*args, **kwargs or {})
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/_refs/__init__.py", line 4658, in empty_like
    return torch.empty_permuted(
TypeError: Cannot convert a MPS Tensor to float64 dtype as the MPS framework doesn't support float64. Please use float32 instead.

Stable diffusion model failed to load
Loading weights [70525c199b] from /Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/models/Stable-diffusion/xxxxxxxxxxxxxxx.safetensors
Creating model from config: /Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/configs/v1-inference.yaml
loading stable diffusion model: TypeError
Traceback (most recent call last):
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/bin-deps/python/3.10.12/lib/python3.10/threading.py", line 973, in _bootstrap
    self._bootstrap_inner()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/bin-deps/python/3.10.12/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/gradio/utils.py", line 703, in wrapper
    response = f(*args, **kwargs)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/ui.py", line 1301, in <lambda>
    update_image_cfg_scale_visibility = lambda: gr.update(visible=shared.sd_model and shared.sd_model.cond_stage_key == "edit")
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/shared_items.py", line 110, in sd_model
    return modules.sd_models.model_data.get_sd_model()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_models.py", line 478, in get_sd_model
    load_model()
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_models.py", line 605, in load_model
    load_model_weights(sd_model, checkpoint_info, state_dict, timer)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_models.py", line 333, in load_model_weights
    model.load_state_dict(state_dict, strict=False)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_disable_initialization.py", line 223, in <lambda>
    module_load_state_dict = self.replace(torch.nn.Module, 'load_state_dict', lambda *args, **kwargs: load_state_dict(module_load_state_dict, *args, **kwargs))
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_disable_initialization.py", line 221, in load_state_dict
    original(module, state_dict, strict=strict)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2138, in load_state_dict
    load(self, state_dict)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2126, in load
    load(child, child_state_dict, child_prefix)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2126, in load
    load(child, child_state_dict, child_prefix)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2126, in load
    load(child, child_state_dict, child_prefix)
  [Previous line repeated 3 more times]
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2120, in load
    module._load_from_state_dict(
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_disable_initialization.py", line 226, in <lambda>
    conv2d_load_from_state_dict = self.replace(torch.nn.Conv2d, '_load_from_state_dict', lambda *args, **kwargs: load_from_state_dict(conv2d_load_from_state_dict, *args, **kwargs))
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/modules/sd_disable_initialization.py", line 191, in load_from_state_dict
    module._parameters[name] = torch.nn.parameter.Parameter(torch.zeros_like(param, device=device, dtype=dtype), requires_grad=param.requires_grad)
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/_meta_registrations.py", line 4425, in zeros_like
    res = aten.empty_like.default(
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/_ops.py", line 435, in __call__
    return self._op(*args, **kwargs or {})
  File "/Users/xxxxxxxxx/Documents/stable-diffusion-webui-mac/venv/lib/python3.10/site-packages/torch/_refs/__init__.py", line 4658, in empty_like
    return torch.empty_permuted(
TypeError: Cannot convert a MPS Tensor to float64 dtype as the MPS framework doesn't support float64. Please use float32 instead.

Stable diffusion model failed to load

Additional information

No response

brkirch commented 1 year ago

Try extracting sd_disable_initialization.py from this file and then move it into the modules folder, replacing the existing file. Let me know if that helps or if you get a different traceback.

kyumin133 commented 1 year ago

That worked great, thanks!

marconileal commented 1 year ago

That worked great, thanks!

My problem is like yours:

Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size 0%| | 0/39 [00:00<?, ?it/s]/Users/marconivasconcelos/miniforge3/envs/yolov8/lib/python3.10/site-packages/torch/amp/autocast_mode.py:250: UserWarning: User provided device_type of 'cuda', but CUDA is not available. Disabling warnings.warn( 0%| | 0/39 [00:08<?, ?it/s] Traceback (most recent call last): File "/Users/marconivasconcelos/miniforge3/envs/yolov8/bin/yolo", line 8, in sys.exit(entrypoint()) File "/Users/marconivasconcelos/miniforge3/envs/yolov8/lib/python3.10/site-packages/ultralytics/yolo/cfg/init.py", line 249, in entrypoint getattr(model, mode)(verbose=True, **overrides) File "/Users/marconivasconcelos/miniforge3/envs/yolov8/lib/python3.10/site-packages/ultralytics/yolo/engine/model.py", line 207, in train self.trainer.train() File "/Users/marconivasconcelos/miniforge3/envs/yolov8/lib/python3.10/site-packages/ultralytics/yolo/engine/trainer.py", line 183, in train self._do_train(int(os.getenv("RANK", -1)), world_size) File "/Users/marconivasconcelos/miniforge3/envs/yolov8/lib/python3.10/site-packages/ultralytics/yolo/engine/trainer.py", line 302, in _do_train self.loss, self.loss_items = self.criterion(preds, batch) File "/Users/marconivasconcelos/miniforge3/envs/yolov8/lib/python3.10/site-packages/ultralytics/yolo/v8/detect/train.py", line 76, in criterion return self.compute_loss(preds, batch) File "/Users/marconivasconcelos/miniforge3/envs/yolov8/lib/python3.10/site-packages/ultralytics/yolo/v8/detect/train.py", line 167, in call targets = self.preprocess(targets.to(self.device), batch_size, scale_tensor=imgsz[[1, 0, 1, 0]]) TypeError: Cannot convert a MPS Tensor to float64 dtype as the MPS framework doesn't support float64. Please use float32 instead.

How can I solve this? Thank you!

brkirch commented 1 year ago

This bug is fixed in both 20230831_experimental and v1.6.0-mac-builds so I'm closing this issue.

@marconileal Is this different software you need support with? I'd recommend creating an issue on the repository for that software if that is the case.