AUTOMATIC1111 / stable-diffusion-webui

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

[Bug]: when using ChilloutRealistic it show 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 #15970

Open yuliang615 opened 3 months ago

yuliang615 commented 3 months ago

Checklist

What happened?

    module._parameters[name] = torch.nn.parameter.Parameter(torch.zeros_like(param, device=device, dtype=dtype), requires_grad=param.requires_grad)
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/_meta_registrations.py", line 4507, in zeros_like
    res = aten.empty_like.default(
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/_ops.py", line 448, in __call__
    return self._op(*args, **kwargs or {})
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/_refs/__init__.py", line 4681, 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
^CInterrupted with signal 2 in <frame at 0x3281159c0, file '/opt/homebrew/Cellar/python@3.10/3.10.14/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py', line 324, code wait>
yuliang@HungYuLiangdeMacBook-Air stable-diffusion-webui % /Users/yuliang/stable-diffusion-webui/webui-macos-env.sh
zsh: permission denied: /Users/yuliang/stable-diffusion-webui/webui-macos-env.sh
yuliang@HungYuLiangdeMacBook-Air stable-diffusion-webui % clear

yuliang@HungYuLiangdeMacBook-Air stable-diffusion-webui % /Users/yuliang/stable-diffusion-webui/webui.sh --skip-torch-cuda-test --no-half

################################################################
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye), Fedora 34+ and openSUSE Leap 15.4 or newer.
################################################################

################################################################
Running on yuliang user
################################################################

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

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

################################################################
Launching launch.py...
################################################################
Python 3.10.14 (main, Mar 19 2024, 21:46:16) [Clang 15.0.0 (clang-1500.3.9.4)]
Version: v1.9.4
Commit hash: feee37d75f1b168768014e4634dcb156ee649c05
Launching Web UI with arguments: --skip-torch-cuda-test --no-half --skip-torch-cuda-test --upcast-sampling --no-half-vae --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
==============================================================================
You are running torch 2.1.0.
The program is tested to work with torch 2.1.2.
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.
==============================================================================
Loading weights [c9657bf12d] from /Users/yuliang/stable-diffusion-webui/models/Stable-diffusion/chilloutrealistic_v10.safetensors
Creating model from config: /Users/yuliang/stable-diffusion-webui/configs/v1-inference.yaml
Running on local URL:  http://127.0.0.1:7860
/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/huggingface_hub/file_download.py:1132: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.
  warnings.warn(

To create a public link, set `share=True` in `launch()`.
/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/huggingface_hub/file_download.py:1132: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.
  warnings.warn(
Startup time: 4.0s (import torch: 1.6s, import gradio: 0.5s, setup paths: 0.5s, initialize shared: 0.1s, other imports: 0.4s, load scripts: 0.2s, create ui: 0.2s, gradio launch: 0.3s).
loading stable diffusion model: TypeError
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.10/3.10.14/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 973, in _bootstrap
    self._bootstrap_inner()
  File "/opt/homebrew/Cellar/python@3.10/3.10.14/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/opt/homebrew/Cellar/python@3.10/3.10.14/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/yuliang/stable-diffusion-webui/modules/initialize.py", line 149, in load_model
    shared.sd_model  # noqa: B018
  File "/Users/yuliang/stable-diffusion-webui/modules/shared_items.py", line 175, in sd_model
    return modules.sd_models.model_data.get_sd_model()
  File "/Users/yuliang/stable-diffusion-webui/modules/sd_models.py", line 620, in get_sd_model
    load_model()
  File "/Users/yuliang/stable-diffusion-webui/modules/sd_models.py", line 748, in load_model
    load_model_weights(sd_model, checkpoint_info, state_dict, timer)
  File "/Users/yuliang/stable-diffusion-webui/modules/sd_models.py", line 393, in load_model_weights
    model.load_state_dict(state_dict, strict=False)
  File "/Users/yuliang/stable-diffusion-webui/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/yuliang/stable-diffusion-webui/modules/sd_disable_initialization.py", line 221, in load_state_dict
    original(module, state_dict, strict=strict)
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2138, in load_state_dict
    load(self, state_dict)
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2126, in load
    load(child, child_state_dict, child_prefix)
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2126, in load
    load(child, child_state_dict, child_prefix)
  File "/Users/yuliang/stable-diffusion-webui/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/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2120, in load
    module._load_from_state_dict(
  File "/Users/yuliang/stable-diffusion-webui/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/yuliang/stable-diffusion-webui/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/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/_meta_registrations.py", line 4507, in zeros_like
    res = aten.empty_like.default(
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/_ops.py", line 448, in __call__
    return self._op(*args, **kwargs or {})
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/_refs/__init__.py", line 4681, 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 [c9657bf12d] from /Users/yuliang/stable-diffusion-webui/models/Stable-diffusion/chilloutrealistic_v10.safetensors
Creating model from config: /Users/yuliang/stable-diffusion-webui/configs/v1-inference.yaml
/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/huggingface_hub/file_download.py:1132: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.
  warnings.warn(
loading stable diffusion model: TypeError
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.10/3.10.14/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 973, in _bootstrap
    self._bootstrap_inner()
  File "/opt/homebrew/Cellar/python@3.10/3.10.14/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/utils.py", line 707, in wrapper
    response = f(*args, **kwargs)
  File "/Users/yuliang/stable-diffusion-webui/modules/ui.py", line 1154, in <lambda>
    update_image_cfg_scale_visibility = lambda: gr.update(visible=shared.sd_model and shared.sd_model.cond_stage_key == "edit")
  File "/Users/yuliang/stable-diffusion-webui/modules/shared_items.py", line 175, in sd_model
    return modules.sd_models.model_data.get_sd_model()
  File "/Users/yuliang/stable-diffusion-webui/modules/sd_models.py", line 620, in get_sd_model
    load_model()
  File "/Users/yuliang/stable-diffusion-webui/modules/sd_models.py", line 748, in load_model
    load_model_weights(sd_model, checkpoint_info, state_dict, timer)
  File "/Users/yuliang/stable-diffusion-webui/modules/sd_models.py", line 393, in load_model_weights
    model.load_state_dict(state_dict, strict=False)
  File "/Users/yuliang/stable-diffusion-webui/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/yuliang/stable-diffusion-webui/modules/sd_disable_initialization.py", line 221, in load_state_dict
    original(module, state_dict, strict=strict)
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2138, in load_state_dict
    load(self, state_dict)
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2126, in load
    load(child, child_state_dict, child_prefix)
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2126, in load
    load(child, child_state_dict, child_prefix)
  File "/Users/yuliang/stable-diffusion-webui/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/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2120, in load
    module._load_from_state_dict(
  File "/Users/yuliang/stable-diffusion-webui/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/yuliang/stable-diffusion-webui/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/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/_meta_registrations.py", line 4507, in zeros_like
    res = aten.empty_like.default(
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/_ops.py", line 448, in __call__
    return self._op(*args, **kwargs or {})
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/_refs/__init__.py", line 4681, 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 [c9657bf12d] from /Users/yuliang/stable-diffusion-webui/models/Stable-diffusion/chilloutrealistic_v10.safetensors
Creating model from config: /Users/yuliang/stable-diffusion-webui/configs/v1-inference.yaml
loading stable diffusion model: TypeError
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.10/3.10.14/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 973, in _bootstrap
    self._bootstrap_inner()
  File "/opt/homebrew/Cellar/python@3.10/3.10.14/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/utils.py", line 707, in wrapper
    response = f(*args, **kwargs)
  File "/Users/yuliang/stable-diffusion-webui/modules/ui.py", line 1154, in <lambda>
    update_image_cfg_scale_visibility = lambda: gr.update(visible=shared.sd_model and shared.sd_model.cond_stage_key == "edit")
  File "/Users/yuliang/stable-diffusion-webui/modules/shared_items.py", line 175, in sd_model
    return modules.sd_models.model_data.get_sd_model()
  File "/Users/yuliang/stable-diffusion-webui/modules/sd_models.py", line 620, in get_sd_model
    load_model()
  File "/Users/yuliang/stable-diffusion-webui/modules/sd_models.py", line 748, in load_model
    load_model_weights(sd_model, checkpoint_info, state_dict, timer)
  File "/Users/yuliang/stable-diffusion-webui/modules/sd_models.py", line 393, in load_model_weights
    model.load_state_dict(state_dict, strict=False)
  File "/Users/yuliang/stable-diffusion-webui/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/yuliang/stable-diffusion-webui/modules/sd_disable_initialization.py", line 221, in load_state_dict
    original(module, state_dict, strict=strict)
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2138, in load_state_dict
    load(self, state_dict)
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2126, in load
    load(child, child_state_dict, child_prefix)
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2126, in load
    load(child, child_state_dict, child_prefix)
  File "/Users/yuliang/stable-diffusion-webui/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/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2120, in load
    module._load_from_state_dict(
  File "/Users/yuliang/stable-diffusion-webui/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/yuliang/stable-diffusion-webui/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/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/_meta_registrations.py", line 4507, in zeros_like
    res = aten.empty_like.default(
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/_ops.py", line 448, in __call__
    return self._op(*args, **kwargs or {})
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/_refs/__init__.py", line 4681, 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

Steps to reproduce the problem

use Mac OS with M2

What should have happened?

normal

What browsers do you use to access the UI ?

Apple Safari

Sysinfo

sysinfo-2024-06-08-13-21.json

Console logs

module._parameters[name] = torch.nn.parameter.Parameter(torch.zeros_like(param, device=device, dtype=dtype), requires_grad=param.requires_grad)
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/_meta_registrations.py", line 4507, in zeros_like
    res = aten.empty_like.default(
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/_ops.py", line 448, in __call__
    return self._op(*args, **kwargs or {})
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/_refs/__init__.py", line 4681, 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
^CInterrupted with signal 2 in <frame at 0x3281159c0, file '/opt/homebrew/Cellar/python@3.10/3.10.14/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py', line 324, code wait>
yuliang@HungYuLiangdeMacBook-Air stable-diffusion-webui % /Users/yuliang/stable-diffusion-webui/webui-macos-env.sh
zsh: permission denied: /Users/yuliang/stable-diffusion-webui/webui-macos-env.sh
yuliang@HungYuLiangdeMacBook-Air stable-diffusion-webui % clear

yuliang@HungYuLiangdeMacBook-Air stable-diffusion-webui % /Users/yuliang/stable-diffusion-webui/webui.sh --skip-torch-cuda-test --no-half

################################################################
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye), Fedora 34+ and openSUSE Leap 15.4 or newer.
################################################################

################################################################
Running on yuliang user
################################################################

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

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

################################################################
Launching launch.py...
################################################################
Python 3.10.14 (main, Mar 19 2024, 21:46:16) [Clang 15.0.0 (clang-1500.3.9.4)]
Version: v1.9.4
Commit hash: feee37d75f1b168768014e4634dcb156ee649c05
Launching Web UI with arguments: --skip-torch-cuda-test --no-half --skip-torch-cuda-test --upcast-sampling --no-half-vae --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
==============================================================================
You are running torch 2.1.0.
The program is tested to work with torch 2.1.2.
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.
==============================================================================
Loading weights [c9657bf12d] from /Users/yuliang/stable-diffusion-webui/models/Stable-diffusion/chilloutrealistic_v10.safetensors
Creating model from config: /Users/yuliang/stable-diffusion-webui/configs/v1-inference.yaml
Running on local URL:  http://127.0.0.1:7860
/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/huggingface_hub/file_download.py:1132: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.
  warnings.warn(

To create a public link, set `share=True` in `launch()`.
/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/huggingface_hub/file_download.py:1132: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.
  warnings.warn(
Startup time: 4.0s (import torch: 1.6s, import gradio: 0.5s, setup paths: 0.5s, initialize shared: 0.1s, other imports: 0.4s, load scripts: 0.2s, create ui: 0.2s, gradio launch: 0.3s).
loading stable diffusion model: TypeError
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.10/3.10.14/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 973, in _bootstrap
    self._bootstrap_inner()
  File "/opt/homebrew/Cellar/python@3.10/3.10.14/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/opt/homebrew/Cellar/python@3.10/3.10.14/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/yuliang/stable-diffusion-webui/modules/initialize.py", line 149, in load_model
    shared.sd_model  # noqa: B018
  File "/Users/yuliang/stable-diffusion-webui/modules/shared_items.py", line 175, in sd_model
    return modules.sd_models.model_data.get_sd_model()
  File "/Users/yuliang/stable-diffusion-webui/modules/sd_models.py", line 620, in get_sd_model
    load_model()
  File "/Users/yuliang/stable-diffusion-webui/modules/sd_models.py", line 748, in load_model
    load_model_weights(sd_model, checkpoint_info, state_dict, timer)
  File "/Users/yuliang/stable-diffusion-webui/modules/sd_models.py", line 393, in load_model_weights
    model.load_state_dict(state_dict, strict=False)
  File "/Users/yuliang/stable-diffusion-webui/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/yuliang/stable-diffusion-webui/modules/sd_disable_initialization.py", line 221, in load_state_dict
    original(module, state_dict, strict=strict)
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2138, in load_state_dict
    load(self, state_dict)
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2126, in load
    load(child, child_state_dict, child_prefix)
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2126, in load
    load(child, child_state_dict, child_prefix)
  File "/Users/yuliang/stable-diffusion-webui/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/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2120, in load
    module._load_from_state_dict(
  File "/Users/yuliang/stable-diffusion-webui/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/yuliang/stable-diffusion-webui/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/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/_meta_registrations.py", line 4507, in zeros_like
    res = aten.empty_like.default(
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/_ops.py", line 448, in __call__
    return self._op(*args, **kwargs or {})
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/_refs/__init__.py", line 4681, 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 [c9657bf12d] from /Users/yuliang/stable-diffusion-webui/models/Stable-diffusion/chilloutrealistic_v10.safetensors
Creating model from config: /Users/yuliang/stable-diffusion-webui/configs/v1-inference.yaml
/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/huggingface_hub/file_download.py:1132: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.
  warnings.warn(
loading stable diffusion model: TypeError
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.10/3.10.14/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 973, in _bootstrap
    self._bootstrap_inner()
  File "/opt/homebrew/Cellar/python@3.10/3.10.14/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/utils.py", line 707, in wrapper
    response = f(*args, **kwargs)
  File "/Users/yuliang/stable-diffusion-webui/modules/ui.py", line 1154, in <lambda>
    update_image_cfg_scale_visibility = lambda: gr.update(visible=shared.sd_model and shared.sd_model.cond_stage_key == "edit")
  File "/Users/yuliang/stable-diffusion-webui/modules/shared_items.py", line 175, in sd_model
    return modules.sd_models.model_data.get_sd_model()
  File "/Users/yuliang/stable-diffusion-webui/modules/sd_models.py", line 620, in get_sd_model
    load_model()
  File "/Users/yuliang/stable-diffusion-webui/modules/sd_models.py", line 748, in load_model
    load_model_weights(sd_model, checkpoint_info, state_dict, timer)
  File "/Users/yuliang/stable-diffusion-webui/modules/sd_models.py", line 393, in load_model_weights
    model.load_state_dict(state_dict, strict=False)
  File "/Users/yuliang/stable-diffusion-webui/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/yuliang/stable-diffusion-webui/modules/sd_disable_initialization.py", line 221, in load_state_dict
    original(module, state_dict, strict=strict)
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2138, in load_state_dict
    load(self, state_dict)
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2126, in load
    load(child, child_state_dict, child_prefix)
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2126, in load
    load(child, child_state_dict, child_prefix)
  File "/Users/yuliang/stable-diffusion-webui/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/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2120, in load
    module._load_from_state_dict(
  File "/Users/yuliang/stable-diffusion-webui/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/yuliang/stable-diffusion-webui/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/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/_meta_registrations.py", line 4507, in zeros_like
    res = aten.empty_like.default(
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/_ops.py", line 448, in __call__
    return self._op(*args, **kwargs or {})
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/_refs/__init__.py", line 4681, 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 [c9657bf12d] from /Users/yuliang/stable-diffusion-webui/models/Stable-diffusion/chilloutrealistic_v10.safetensors
Creating model from config: /Users/yuliang/stable-diffusion-webui/configs/v1-inference.yaml
loading stable diffusion model: TypeError
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.10/3.10.14/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 973, in _bootstrap
    self._bootstrap_inner()
  File "/opt/homebrew/Cellar/python@3.10/3.10.14/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/utils.py", line 707, in wrapper
    response = f(*args, **kwargs)
  File "/Users/yuliang/stable-diffusion-webui/modules/ui.py", line 1154, in <lambda>
    update_image_cfg_scale_visibility = lambda: gr.update(visible=shared.sd_model and shared.sd_model.cond_stage_key == "edit")
  File "/Users/yuliang/stable-diffusion-webui/modules/shared_items.py", line 175, in sd_model
    return modules.sd_models.model_data.get_sd_model()
  File "/Users/yuliang/stable-diffusion-webui/modules/sd_models.py", line 620, in get_sd_model
    load_model()
  File "/Users/yuliang/stable-diffusion-webui/modules/sd_models.py", line 748, in load_model
    load_model_weights(sd_model, checkpoint_info, state_dict, timer)
  File "/Users/yuliang/stable-diffusion-webui/modules/sd_models.py", line 393, in load_model_weights
    model.load_state_dict(state_dict, strict=False)
  File "/Users/yuliang/stable-diffusion-webui/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/yuliang/stable-diffusion-webui/modules/sd_disable_initialization.py", line 221, in load_state_dict
    original(module, state_dict, strict=strict)
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2138, in load_state_dict
    load(self, state_dict)
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2126, in load
    load(child, child_state_dict, child_prefix)
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2126, in load
    load(child, child_state_dict, child_prefix)
  File "/Users/yuliang/stable-diffusion-webui/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/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2120, in load
    module._load_from_state_dict(
  File "/Users/yuliang/stable-diffusion-webui/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/yuliang/stable-diffusion-webui/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/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/_meta_registrations.py", line 4507, in zeros_like
    res = aten.empty_like.default(
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/_ops.py", line 448, in __call__
    return self._op(*args, **kwargs or {})
  File "/Users/yuliang/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/_refs/__init__.py", line 4681, 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

viking1304 commented 3 months ago

Can you please confirm that your model file is properly downloaded?

echo "c9657bf12dada39c6d078841d92869f5a06dd27e823ea403ef3658ab0ef42e8e *chilloutrealistic_v10.safetensors" | shasum -a 256 -c

I had this error with some model before and I know how to fix this error, but I cannot remember which model it was.

I need a proper test case, so I can create a PR for this error.

viking1304 commented 3 months ago

I just tested this model on my M3 Pro and I indeed got mentioned error. As expected https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/13099 fixed the issue.

I am just not sure if that PR should be reopened or there is some better way that will also fix xpu, since I suspect that they would have the same issue with this model.