Repository: stable-diffusion-webui
Issue: [Bug]: return F.linear(input, self.weight, self.bias) RuntimeError: CUDA error: CUBLAS_STATUS_ALLOC_FAILED when calling `cublasCreate(handle)`
Labels: asking-for-help-with-local-system-issues

### Is there an existing issue for this?

- [x] I have searched the existing issues and checked the recent builds/commits

### What happened?

I installed the Pinokio application on my computer. I chose 'Stable Diffusion Web UI' from the 'Discover' option, and the download completed successfully. Then
[logs.zip](https://github.com/AUTOMATIC1111/stable-diffusion-webui/files/13514784/logs.zip)
, when I selected 'launch', I encountered this error during step 5 out of 7 in 'shell.enter'.

### Steps to reproduce the problem

Didn't do anything specific.

### What should have happened?

After completing 'shell.enter', I expected the web UI to open.

### Sysinfo

CPU: i5 12500H
GPU: Nvidia geforce RTX 3050 Ti
RAM: 32 GB
HDD: 500 GB SSD
Monster Abra A7 14.2

### What browsers do you use to access the UI ?

Google Chrome

### Console logs

```Shell
Microsoft Windows [Version 10.0.22621.2715]
(c) Microsoft Corporation. Tüm hakları saklıdır.

D:\pinokio\api\sd-webui.pinokio.git\automatic1111>
D:\pinokio\api\sd-webui.pinokio.git\automatic1111>venv\Scripts\activate venv

(venv) D:\pinokio\api\sd-webui.pinokio.git\automatic1111>pip install tqdm moviepy --upgrade
Requirement already satisfied: tqdm in d:\pinokio\api\sd-webui.pinokio.git\automatic1111\venv\lib\site-packages (4.66.1)
Requirement already satisfied: moviepy in d:\pinokio\api\sd-webui.pinokio.git\automatic1111\venv\lib\site-packages (1.0.3)
Requirement already satisfied: colorama in d:\pinokio\api\sd-webui.pinokio.git\automatic1111\venv\lib\site-packages (from tqdm) (0.4.6)
Requirement already satisfied: decorator<5.0,>=4.0.2 in d:\pinokio\api\sd-webui.pinokio.git\automatic1111\venv\lib\site-packages (from moviepy) (4.4.2)
Requirement already satisfied: requests<3.0,>=2.8.1 in d:\pinokio\api\sd-webui.pinokio.git\automatic1111\venv\lib\site-packages (from moviepy) (2.31.0)
Requirement already satisfied: proglog<=1.0.0 in d:\pinokio\api\sd-webui.pinokio.git\automatic1111\venv\lib\site-packages (from moviepy) (0.1.10)
Requirement already satisfied: numpy>=1.17.3 in d:\pinokio\api\sd-webui.pinokio.git\automatic1111\venv\lib\site-packages (from moviepy) (1.23.5)
Requirement already satisfied: imageio<3.0,>=2.5 in d:\pinokio\api\sd-webui.pinokio.git\automatic1111\venv\lib\site-packages (from moviepy) (2.33.0)
Requirement already satisfied: imageio_ffmpeg>=0.2.0 in d:\pinokio\api\sd-webui.pinokio.git\automatic1111\venv\lib\site-packages (from moviepy) (0.4.9)
Requirement already satisfied: pillow>=8.3.2 in d:\pinokio\api\sd-webui.pinokio.git\automatic1111\venv\lib\site-packages (from imageio<3.0,>=2.5->moviepy) (9.5.0)
Requirement already satisfied: setuptools in d:\pinokio\api\sd-webui.pinokio.git\automatic1111\venv\lib\site-packages (from imageio_ffmpeg>=0.2.0->moviepy) (65.5.0)
Requirement already satisfied: idna<4,>=2.5 in d:\pinokio\api\sd-webui.pinokio.git\automatic1111\venv\lib\site-packages (from requests<3.0,>=2.8.1->moviepy) (3.6)
Requirement already satisfied: certifi>=2017.4.17 in d:\pinokio\api\sd-webui.pinokio.git\automatic1111\venv\lib\site-packages (from requests<3.0,>=2.8.1->moviepy) (2023.11.17)
Requirement already satisfied: urllib3<3,>=1.21.1 in d:\pinokio\api\sd-webui.pinokio.git\automatic1111\venv\lib\site-packages (from requests<3.0,>=2.8.1->moviepy) (2.1.0)
Requirement already satisfied: charset-normalizer<4,>=2 in d:\pinokio\api\sd-webui.pinokio.git\automatic1111\venv\lib\site-packages (from requests<3.0,>=2.8.1->moviepy) (3.3.2)

[notice] A new release of pip is available: 23.0.1 -> 23.3.1
[notice] To update, run: python.exe -m pip install --upgrade pip

(venv) D:\pinokio\api\sd-webui.pinokio.git\automatic1111>venv\Scripts\deactivate
D:\pinokio\api\sd-webui.pinokio.git\automatic1111>webui-user.bat
venv "D:\pinokio\api\sd-webui.pinokio.git\automatic1111\venv\Scripts\Python.exe"
Python 3.10.13 | packaged by Anaconda, Inc. | (main, Sep 11 2023, 13:24:38) [MSC v.1916 64 bit (AMD64)]
Version: v1.6.0-2-g4afaaf8a
Commit hash: 4afaaf8a020c1df457bcf7250cb1c7f609699fa7
Launching Web UI with arguments: 
No module 'xformers'. Proceeding without it.
Loading weights [31e35c80fc] from D:\pinokio\api\sd-webui.pinokio.git\automatic1111\models\Stable-diffusion\sd_xl_base_1.0.safetensors
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 12.4s (prepare environment: 2.0s, import torch: 3.4s, import gradio: 1.3s, setup paths: 0.9s, initialize shared: 0.2s, other imports: 1.0s, setup codeformer: 0.2s, load scripts: 1.6s, initialize extra networks: 0.1s, create ui: 1.1s, gradio launch: 0.5s).
Creating model from config: D:\pinokio\api\sd-webui.pinokio.git\automatic1111\repositories\generative-models\configs\inference\sd_xl_base.yaml
loading stable diffusion model: OutOfMemoryError
Traceback (most recent call last):
  File "D:\pinokio\bin\miniconda\lib\threading.py", line 973, in _bootstrap
    self._bootstrap_inner()
  File "D:\pinokio\bin\miniconda\lib\threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "D:\pinokio\bin\miniconda\lib\threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "D:\pinokio\api\sd-webui.pinokio.git\automatic1111\modules\initialize.py", line 147, in load_model
    shared.sd_model  # noqa: B018
  File "D:\pinokio\api\sd-webui.pinokio.git\automatic1111\modules\shared_items.py", line 110, in sd_model
    return modules.sd_models.model_data.get_sd_model()
  File "D:\pinokio\api\sd-webui.pinokio.git\automatic1111\modules\sd_models.py", line 499, in get_sd_model
    load_model()
  File "D:\pinokio\api\sd-webui.pinokio.git\automatic1111\modules\sd_models.py", line 626, in load_model
    load_model_weights(sd_model, checkpoint_info, state_dict, timer)
  File "D:\pinokio\api\sd-webui.pinokio.git\automatic1111\modules\sd_models.py", line 353, in load_model_weights
    model.load_state_dict(state_dict, strict=False)
  File "D:\pinokio\api\sd-webui.pinokio.git\automatic1111\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 "D:\pinokio\api\sd-webui.pinokio.git\automatic1111\modules\sd_disable_initialization.py", line 221, in load_state_dict
    original(module, state_dict, strict=strict)
  File "D:\pinokio\api\sd-webui.pinokio.git\automatic1111\venv\lib\site-packages\torch\nn\modules\module.py", line 2027, in load_state_dict
    load(self, state_dict)
  File "D:\pinokio\api\sd-webui.pinokio.git\automatic1111\venv\lib\site-packages\torch\nn\modules\module.py", line 2015, in load
    load(child, child_state_dict, child_prefix)
  File "D:\pinokio\api\sd-webui.pinokio.git\automatic1111\venv\lib\site-packages\torch\nn\modules\module.py", line 2015, in load
    load(child, child_state_dict, child_prefix)
  File "D:\pinokio\api\sd-webui.pinokio.git\automatic1111\venv\lib\site-packages\torch\nn\modules\module.py", line 2015, in load
    load(child, child_state_dict, child_prefix)
  [Previous line repeated 6 more times]
  File "D:\pinokio\api\sd-webui.pinokio.git\automatic1111\venv\lib\site-packages\torch\nn\modules\module.py", line 2009, in load
    module._load_from_state_dict(
  File "D:\pinokio\api\sd-webui.pinokio.git\automatic1111\modules\sd_disable_initialization.py", line 225, in <lambda>
    linear_load_from_state_dict = self.replace(torch.nn.Linear, '_load_from_state_dict', lambda *args, **kwargs: load_from_state_dict(linear_load_from_state_dict, *args, **kwargs))
  File "D:\pinokio\api\sd-webui.pinokio.git\automatic1111\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 "D:\pinokio\api\sd-webui.pinokio.git\automatic1111\venv\lib\site-packages\torch\_meta_registrations.py", line 1780, in zeros_like
    return aten.empty_like.default(
  File "D:\pinokio\api\sd-webui.pinokio.git\automatic1111\venv\lib\site-packages\torch\_ops.py", line 287, in __call__
    return self._op(*args, **kwargs or {})
  File "D:\pinokio\api\sd-webui.pinokio.git\automatic1111\venv\lib\site-packages\torch\_refs\__init__.py", line 4254, in empty_like
    return torch.empty_strided(
torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 4.00 GiB total capacity; 3.34 GiB already allocated; 0 bytes free; 3.49 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation.  See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF


Stable diffusion model failed to load
Applying attention optimization: Doggettx... done.
Exception in thread Thread-18 (load_model):
Traceback (most recent call last):
  File "D:\pinokio\bin\miniconda\lib\threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "D:\pinokio\bin\miniconda\lib\threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "D:\pinokio\api\sd-webui.pinokio.git\automatic1111\modules\initialize.py", line 153, in load_model
    devices.first_time_calculation()
  File "D:\pinokio\api\sd-webui.pinokio.git\automatic1111\modules\devices.py", line 148, in first_time_calculation
    linear(x)
  File "D:\pinokio\api\sd-webui.pinokio.git\automatic1111\venv\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "D:\pinokio\api\sd-webui.pinokio.git\automatic1111\extensions-builtin\Lora\networks.py", line 429, in network_Linear_forward
    return originals.Linear_forward(self, input)
  File "D:\pinokio\api\sd-webui.pinokio.git\automatic1111\venv\lib\site-packages\torch\nn\modules\linear.py", line 114, in forward
    return F.linear(input, self.weight, self.bias)
RuntimeError: CUDA error: CUBLAS_STATUS_ALLOC_FAILED when calling `cublasCreate(handle)`
```


### Additional information

I initially tried to install Pinokio on local disk C, but due to insufficient memory, I completely removed the program. Later, I installed it on local disk D and encountered the error here. So far, I've downloaded 23 GB to local disk D, and there is still 152 GB of free space available.