当前位置:AIGC资讯 > AIGC > 正文

Ubuntu 22.04.2 LTS LTS x86_64 安装 stable-diffusion-webui 【2】基本版本完结。

前篇

Ubuntu 20.04 LTS x86_64 安装 stable-diffusion-webui_hkNaruto的博客-CSDN博客

内容太多,分第二篇继续

中途重装了机器,20.04 ,apt upgrade后自动升级到22.04.2

现状:起来了,又没完全起来

启动日志

(stable-diffusion-webui) yeqiang@yeqiang-MS-7B23:~/Downloads/ai/stable-diffusion-webui$ ./webui.sh 

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

################################################################
Running on yeqiang user
################################################################

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

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

################################################################
Launching launch.py...
################################################################
Using TCMalloc: libtcmalloc_minimal.so.4
Python 3.10.6 | packaged by conda-forge | (main, Aug 22 2022, 20:36:39) [GCC 10.4.0]
Version: v1.4.0
Commit hash: 394ffa7b0a7fff3ec484bcd084e673a8b301ccc8
Installing requirements
Launching Web UI with arguments: 
No module 'xformers'. Proceeding without it.
Downloading: "https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors" to /home/yeqiang/Downloads/ai/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors

loading stable diffusion model: FileNotFoundError
Traceback (most recent call last):
  File "/home/yeqiang/miniconda3/envs/stable-diffusion-webui/lib/python3.10/threading.py", line 973, in _bootstrap
    self._bootstrap_inner()
  File "/home/yeqiang/miniconda3/envs/stable-diffusion-webui/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/home/yeqiang/miniconda3/envs/stable-diffusion-webui/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/home/yeqiang/Downloads/ai/stable-diffusion-webui/webui.py", line 306, in load_model
    shared.sd_model  # noqa: B018
  File "/home/yeqiang/Downloads/ai/stable-diffusion-webui/modules/shared.py", line 726, in sd_model
    return modules.sd_models.model_data.get_sd_model()
  File "/home/yeqiang/Downloads/ai/stable-diffusion-webui/modules/sd_models.py", line 422, in get_sd_model
    load_model()
  File "/home/yeqiang/Downloads/ai/stable-diffusion-webui/modules/sd_models.py", line 440, in load_model
    checkpoint_info = checkpoint_info or select_checkpoint()
  File "/home/yeqiang/Downloads/ai/stable-diffusion-webui/modules/sd_models.py", line 181, in select_checkpoint
    raise FileNotFoundError(error_message)
FileNotFoundError: No checkpoints found. When searching for checkpoints, looked at:
 - file /home/yeqiang/Downloads/ai/stable-diffusion-webui/model.ckpt
 - directory /home/yeqiang/Downloads/ai/stable-diffusion-webui/models/Stable-diffusionCan't run without a checkpoint. Find and place a .ckpt or .safetensors file into any of those locations.


Stable diffusion model failed to load
Applying attention optimization: Doggettx... done.
preload_extensions_git_metadata for 7 extensions took 0.00s
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 14.0s (import torch: 3.7s, import gradio: 1.4s, import ldm: 3.7s, other imports: 3.6s, setup codeformer: 0.3s, list SD models: 0.2s, load scripts: 0.6s, create ui: 0.4s).


界面

获得阶段性成果了。

参考故障处理1. 下载资源,再次启动

(stable-diffusion-webui) yeqiang@yeqiang-MS-7B23:~/Downloads/ai/stable-diffusion-webui$ ./webui.sh 

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

################################################################
Running on yeqiang user
################################################################

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

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

################################################################
Launching launch.py...
################################################################
Using TCMalloc: libtcmalloc_minimal.so.4
Python 3.10.6 | packaged by conda-forge | (main, Aug 22 2022, 20:36:39) [GCC 10.4.0]
Version: v1.4.0
Commit hash: 394ffa7b0a7fff3ec484bcd084e673a8b301ccc8
Installing requirements
Launching Web UI with arguments: 
No module 'xformers'. Proceeding without it.
Calculating sha256 for /home/yeqiang/Downloads/ai/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors: preload_extensions_git_metadata for 7 extensions took 0.00s
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 4.3s (import torch: 1.0s, import gradio: 1.1s, import ldm: 0.3s, other imports: 0.6s, load scripts: 0.5s, create ui: 0.5s, gradio launch: 0.2s).
6ce0161689b3853acaa03779ec93eafe75a02f4ced659bee03f50797806fa2fa
Loading weights [6ce0161689] from /home/yeqiang/Downloads/ai/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors
Creating model from config: /home/yeqiang/Downloads/ai/stable-diffusion-webui/configs/v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Downloading (…)cial_tokens_map.json: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 389/389 [00:00<00:00, 3.95MB/s]
Downloading (…)okenizer_config.json: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 905/905 [00:00<00:00, 10.3MB/s]
Failed to create model quickly; will retry using slow method.
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Downloading (…)olve/main/vocab.json: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 961k/961k [00:00<00:00, 1.42MB/s]
Downloading (…)olve/main/merges.txt: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 525k/525k [00:00<00:00, 1.16MB/s]
Downloading (…)lve/main/config.json: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 4.52k/4.52k [00:00<00:00, 41.7MB/s]
Downloading pytorch_model.bin: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.71G/1.71G [04:47<00:00, 5.96MB/s]
Applying attention optimization: Doggettx... done.
Textual inversion embeddings loaded(0): 
Model loaded in 370.7s (calculate hash: 8.8s, load weights from disk: 0.2s, create model: 303.4s, apply weights to model: 49.0s, apply half(): 8.5s, move model to device: 0.3s, calculate empty prompt: 0.3s).

成果启动,测试1girl看看

 已经能出图了。

日志

100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:05<00:00,  3.88it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 20/20 [00:05<00:00,  3.93it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 20/20 [00:05<00:00,  5.18it/s]

成功!接下来,就是各种插件了。 

故障处理

1. loading stable diffusion model: FileNotFoundError

Downloading: "https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors" to /home/yeqiang/Downloads/ai/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors

切换网络,手动下载,记录下自动跳转的地址

https://cdn-lfs.huggingface.co/repos/6b/20/6b201da5f0f5c60524535ebb7deac2eef68605655d3bbacfee9cce0087f3b3f5/6ce0161689b3853acaa03779ec93eafe75a02f4ced659bee03f50797806fa2fa?response-content-disposition=attachment%3B+filename*%3DUTF-8%27%27v1-5-pruned-emaonly.safetensors%3B+filename%3D%22v1-5-pruned-emaonly.safetensors%22%3B&Expires=1688787296&Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9jZG4tbGZzLmh1Z2dpbmdmYWNlLmNvL3JlcG9zLzZiLzIwLzZiMjAxZGE1ZjBmNWM2MDUyNDUzNWViYjdkZWFjMmVlZjY4NjA1NjU1ZDNiYmFjZmVlOWNjZTAwODdmM2IzZjUvNmNlMDE2MTY4OWIzODUzYWNhYTAzNzc5ZWM5M2VhZmU3NWEwMmY0Y2VkNjU5YmVlMDNmNTA3OTc4MDZmYTJmYT9yZXNwb25zZS1jb250ZW50LWRpc3Bvc2l0aW9uPSoiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE2ODg3ODcyOTZ9fX1dfQ__&Signature=e%7E-AzlznAdm6eL9O8praWV45-Q%7E3nHs9tk45pNF1Y15QFwr6dhBwXjMgEIPHYXAKXh8WKfcjyp8zRAHtix1rGA61w5yh%7EurUQ7SC1VAcJMplTAgq1qbC7xY97HdZjzPfXd8h9slBdrzGZe8ZqMlDsdF8N3Qk0xsbeCaYWwVjCziS59EfJOf8t%7Exju79bkVUNhNviXo%7EnEfL2072jQnQngkvMDXeGPtu4jQRrhdOH53dWnU5alt4BM5tcqV-TCAJQl8qtiRHXSPX4CXJN-yT2laAqheShvkgKiPESrMTt4nQeay-GqyXRzyyL7QiRgPPFHxF1ghvbtNyicgqJgUQAiQ__&Key-Pair-Id=KVTP0A1DKRTAX

cp ~/Downloads/v1-5-pruned-emaonly.safetensors /home/yeqiang/Downloads/ai/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors

总结

过程中遇到的阻碍

1.网络!该问题最为严重,pip采用清华、阿里源会导致依赖安装版本不匹配报错!外网的资料又下载不过来

2. cuda驱动安装,经历系统升级,黑屏

更新时间 2023-11-20