Ubuntu 安装 stable-diffusion-webui-docker 常见问题处置惩罚方法 ...

打印 上一主题 下一主题

主题 880|帖子 880|积分 2640

安装 Stable Diffusion WebUI Docker

工程地址

https://github.com/AbdBarho/stable-diffusion-webui-docker
第一步是 git clone 下来
Setup

阅读 README 中的 setup,进入页面 https://github.com/AbdBarho/stable-diffusion-webui-docker/wiki/Setup
  1. docker compose --profile download up --build
  2. # wait until its done, then:
  3. docker compose --profile [ui] up --build
  4. # where [ui] is one of: auto | auto-cpu | comfy | comfy-cpu
复制代码
以是,先确保安装了 docker compose,注意,不是 docker-compose
docker compose 安装方法


  • 进入 docker compose release
  • 找到对应的版本v2.33.1
  • 运行安装下令
  1. curl -L https://github.com/docker/compose/releases/download/v2.33.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/lib/docker/cli-plugins/docker-compose
  2. chmod +x /usr/local/lib/docker/cli-plugins/docker-compose
复制代码

  • docker compose --version 验证
docker compose --profile download up --build

异常日记如下:
  1. 02/26 02:37:49 [NOTICE] Download complete: /data/models/Stable-diffusion/v1-5-pruned-emaonly.ckpt
  2. download-1  |
  3. download-1  | Download Results:
  4. download-1  | gid   |stat|avg speed  |path/URI
  5. download-1  | ======+====+===========+=======================================================
  6. download-1  | 142eb3|OK  |   283KiB/s|/data/models/RealESRGAN/RealESRGAN_x4plus.pth
  7. download-1  | 3c541d|OK  |   1.0MiB/s|/data/models/VAE/vae-ft-mse-840000-ema-pruned.ckpt
  8. download-1  | 866f5f|OK  |   233KiB/s|/data/models/RealESRGAN/RealESRGAN_x4plus_anime_6B.pth
  9. download-1  | 6a2f36|ERR |   739KiB/s|/data/models/GFPGAN/GFPGANv1.4.pth
  10. download-1  | 70690b|ERR |       0B/s|/data/models/LDSR/project.yaml
  11. download-1  | 4d1403|ERR |       0B/s|/data/models/LDSR/model.ckpt
  12. download-1  | 466742|OK  |   3.3MiB/s|/data/models/Stable-diffusion/sd-v1-5-inpainting.ckpt
  13. download-1  | 849731|OK  |   2.7MiB/s|/data/models/Stable-diffusion/v1-5-pruned-emaonly.ckpt
  14. download-1  |
  15. download-1  | Status Legend:
  16. download-1  | (OK):download completed.(ERR):error occurred.
  17. download-1  |
  18. download-1  | aria2 will resume download if the transfer is restarted.
  19. download-1  | If there are any errors, then see the log file. See '-l' option in help/man page for details.
  20. download-1 exited with code 2
复制代码
重复运行该下令,直至成功,成功日记如下:
  1. 02/26 02:50:02 [NOTICE] Download complete: /data/models/LDSR/model.ckpt
  2. download-1  |
  3. download-1  | Download Results:
  4. download-1  | gid   |stat|avg speed  |path/URI
  5. download-1  | ======+====+===========+=======================================================
  6. download-1  | d12a9e|OK  |       0B/s|/data/models/VAE/vae-ft-mse-840000-ema-pruned.ckpt
  7. download-1  | 5e7060|OK  |       0B/s|/data/models/Stable-diffusion/v1-5-pruned-emaonly.ckpt
  8. download-1  | 00f3d6|OK  |       0B/s|/data/models/Stable-diffusion/sd-v1-5-inpainting.ckpt
  9. download-1  | 274faa|OK  |       0B/s|/data/models/RealESRGAN/RealESRGAN_x4plus.pth
  10. download-1  | 5a2243|OK  |       0B/s|/data/models/RealESRGAN/RealESRGAN_x4plus_anime_6B.pth
  11. download-1  | b8ba07|OK  |   1.8MiB/s|/data/models/LDSR/project.yaml
  12. download-1  | bcb67a|OK  |   880KiB/s|/data/models/GFPGAN/GFPGANv1.4.pth
  13. download-1  | d31924|OK  |   4.3MiB/s|/data/models/LDSR/model.ckpt
  14. download-1  |
  15. download-1  | Status Legend:
  16. download-1  | (OK):download completed.
  17. download-1  | Checking SHAs...
  18. download-1  | /data/models/LDSR/project.yaml: OK
  19. download-1  | /data/models/RealESRGAN/RealESRGAN_x4plus_anime_6B.pth: OK
  20. download-1  | /data/models/RealESRGAN/RealESRGAN_x4plus.pth: OK
  21. download-1  | /data/models/VAE/vae-ft-mse-840000-ema-pruned.ckpt: OK
  22. download-1  | /data/models/GFPGAN/GFPGANv1.4.pth: OK
  23. download-1  | /data/models/LDSR/model.ckpt: OK
  24. download-1  | /data/models/Stable-diffusion/v1-5-pruned-emaonly.ckpt: OK
  25. download-1  | /data/models/Stable-diffusion/sd-v1-5-inpainting.ckpt: OK
  26. download-1  | By using this software, you agree to the following licenses:
  27. download-1  | https://github.com/AbdBarho/stable-diffusion-webui-docker/blob/master/LICENSE
  28. download-1  | https://github.com/CompVis/stable-diffusion/blob/main/LICENSE
  29. download-1  | https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/master/LICENSE.txt
  30. download-1  | https://github.com/invoke-ai/InvokeAI/blob/main/LICENSE
  31. download-1  | And licenses of all UIs, third party libraries, and extensions.
  32. download-1 exited with code 0
复制代码
docker compose --profile [ui] up --build

运行下令如下
  1. docker compose --profile auto up --build
复制代码
报错如下
./clone.sh stable-diffusion-stability-ai

  1. => ERROR [auto download 4/9] RUN . /clone.sh stable-diffusion-stability-ai https://github.com/Stability-AI/stablediffusion.git cf1d67a6fd5ea1aa600c4df58e5b47da45f6bdbf   && rm -rf assets data/**/*.png data/**/*.jpg data/**/*.gif  75.8s
  2. ------
  3. > [auto download 4/9] RUN . /clone.sh stable-diffusion-stability-ai https://github.com/Stability-AI/stablediffusion.git cf1d67a6fd5ea1aa600c4df58e5b47da45f6bdbf   && rm -rf assets data/**/*.png data/**/*.jpg data/**/*.gif:
  4. 2.567 + mkdir -p /repositories/stable-diffusion-stability-ai
  5. 2.568 + cd /repositories/stable-diffusion-stability-ai
  6. 2.568 + git init
  7. 2.570 hint: Using 'master' as the name for the initial branch. This default branch name
  8. 2.570 hint: is subject to change. To configure the initial branch name to use in all
  9. 2.570 hint: of your new repositories, which will suppress this warning, call:
  10. 2.570 hint:
  11. 2.570 hint:     git config --global init.defaultBranch <name>
  12. 2.570 hint:
  13. 2.570 hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
  14. 2.570 hint: 'development'. The just-created branch can be renamed via this command:
  15. 2.570 hint:
  16. 2.570 hint:     git branch -m <name>
  17. 2.571 Initialized empty Git repository in /repositories/stable-diffusion-stability-ai/.git/
  18. 2.571 + git remote add origin https://github.com/Stability-AI/stablediffusion.git
  19. 2.573 + git fetch origin cf1d67a6fd5ea1aa600c4df58e5b47da45f6bdbf '--depth=1'
  20. 75.70 error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err 8)
  21. 75.70 error: 3601 bytes of body are still expected
  22. 75.71 fetch-pack: unexpected disconnect while reading sideband packet
  23. 75.71 fatal: early EOF
  24. 75.71 fatal: fetch-pack: invalid index-pack output
  25. ------
  26. failed to solve: executor failed running [/bin/sh -c . /clone.sh stable-diffusion-stability-ai https://github.com/Stability-AI/stablediffusion.git cf1d67a6fd5ea1aa600c4df58e5b47da45f6bdbf   && rm -rf assets data/**/*.png data/**/*.jpg data/**/*.gif]: exit code: 128
复制代码
详见 https://github.com/AbdBarho/stable-diffusion-webui-docker/issues/657 ,必要修改两点:

  • 编辑 /stable-diffusion-webui-docker/services/AUTOMATIC1111/Dockerfile,将 FROM alpine/git:2.36.2 修改为 FROM alpine/git:2.43.0
  • 编辑 /stable-diffusion-webui-docker/services/AUTOMATIC1111/clone.sh,在行末加上 sleep 200s,假如还是不行,适当扩大 200s,取决于现场网络条件。
ImportError: cannot import name ‘TypeIs’ from ‘typing_extensions’

  1. auto-1  |     from .plugin_registry import PluginRegistry
  2. auto-1  |   File "/opt/conda/lib/python3.10/site-packages/altair/utils/plugin_registry.py", line 13, in <module>
  3. auto-1  |     from typing_extensions import TypeIs
  4. auto-1  | ImportError: cannot import name 'TypeIs' from 'typing_extensions' (/opt/conda/lib/python3.10/site-packages/typing_extensions.py)
  5. auto-1 exited with code 1
复制代码
解决方案详见 https://github.com/AbdBarho/stable-diffusion-webui-docker/issues/729
修改 /stable-diffusion-webui-docker/services/AUTOMATIC1111/Dockerfile, 如下
  1. WORKDIR /
  2. RUN --mount=type=cache,target=/root/.cache/pip \
  3.   git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git && \
  4.   cd stable-diffusion-webui && \
  5.   git reset --hard v1.9.4 && \
  6.   pip install -r requirements_versions.txt && \
  7.   pip install --upgrade typing-extensions
复制代码
The NVIDIA driver on your system is too old (found version 11040)

  1. auto-1  | Installing extension dependencies (if any)
  2. auto-1  | /opt/conda/lib/python3.10/site-packages/timm/models/layers/__init__.py:48: FutureWarning: Importing from timm.models.layers is deprecated, please import via timm.layers
  3. auto-1  |   warnings.warn(f"Importing from {__name__} is deprecated, please import via timm.layers", FutureWarning)
  4. auto-1  | no module 'xformers'. Processing without...
  5. auto-1  | no module 'xformers'. Processing without...
  6. auto-1  | No module 'xformers'. Proceeding without it.
  7. auto-1  | The NVIDIA driver on your system is too old (found version 11040). Please update your GPU driver by downloading and installing a new version from the URL: http://www.nvidia.com/Download/index.aspx Alternatively, go to: https://pytorch.org to install a PyTorch version that has been compiled with your version of the CUDA driver.: str
  8. auto-1  | Traceback (most recent call last):
  9. auto-1  |   File "/stable-diffusion-webui/modules/errors.py", line 98, in run
  10. auto-1  |     code()
  11. auto-1  |   File "/stable-diffusion-webui/modules/devices.py", line 106, in enable_tf32
  12. auto-1  |     if cuda_no_autocast():
  13. auto-1  |   File "/stable-diffusion-webui/modules/devices.py", line 28, in cuda_no_autocast
  14. auto-1  |     device_id = get_cuda_device_id()
  15. auto-1  |   File "/stable-diffusion-webui/modules/devices.py", line 40, in get_cuda_device_id
  16. auto-1  |     ) or torch.cuda.current_device()
  17. auto-1  |   File "/opt/conda/lib/python3.10/site-packages/torch/cuda/__init__.py", line 778, in current_device
  18. auto-1  |     _lazy_init()
  19. auto-1  |   File "/opt/conda/lib/python3.10/site-packages/torch/cuda/__init__.py", line 293, in _lazy_init
  20. auto-1  |     torch._C._cuda_init()
  21. auto-1  | RuntimeError: The NVIDIA driver on your system is too old (found version 11040). Please update your GPU driver by downloading and installing a new version from the URL: http://www.nvidia.com/Download/index.aspx Alternatively, go to: https://pytorch.org to install a PyTorch version that has been compiled with your version of the CUDA driver.
  22. auto-1  |
  23. auto-1  | During handling of the above exception, another exception occurred:
  24. auto-1  |
  25. auto-1  | Traceback (most recent call last):
  26. auto-1  |   File "/stable-diffusion-webui/webui.py", line 13, in <module>
  27. auto-1  |     initialize.imports()
  28. auto-1  |   File "/stable-diffusion-webui/modules/initialize.py", line 36, in imports
  29. auto-1  |     shared_init.initialize()
  30. auto-1  |   File "/stable-diffusion-webui/modules/shared_init.py", line 17, in initialize
  31. auto-1  |     from modules import options, shared_options
  32. auto-1  |   File "/stable-diffusion-webui/modules/shared_options.py", line 4, in <module>
  33. auto-1  |     from modules import localization, ui_components, shared_items, shared, interrogate, shared_gradio_themes, util, sd_emphasis
  34. auto-1  |   File "/stable-diffusion-webui/modules/interrogate.py", line 13, in <module>
  35. auto-1  |     from modules import devices, paths, shared, lowvram, modelloader, errors, torch_utils
  36. auto-1  |   File "/stable-diffusion-webui/modules/devices.py", line 113, in <module>
  37. auto-1  |     errors.run(enable_tf32, "Enabling TF32")
  38. auto-1  |   File "/stable-diffusion-webui/modules/errors.py", line 100, in run
  39. auto-1  |     display(task, e)
  40. auto-1  |   File "/stable-diffusion-webui/modules/errors.py", line 68, in display
  41. auto-1  |     te = traceback.TracebackException.from_exception(e)
  42. auto-1  |   File "/opt/conda/lib/python3.10/traceback.py", line 572, in from_exception
  43. auto-1  |     return cls(type(exc), exc, exc.__traceback__, *args, **kwargs)
  44. auto-1  | AttributeError: 'str' object has no attribute '__traceback__'
  45. auto-1 exited with code 1
复制代码
遇到这类报错的原因是,pytorch 与 服务器上的显卡驱动版本不划一,要么升级服务器显卡驱动,要么修改 /stable-diffusion-webui-docker/services/AUTOMATIC1111/Dockerfile 中的 pytorch 镜像
  1. FROM pytorch/pytorch:2.3.0-cuda11.8-cudnn8-runtime
复制代码
实际上,这一步应该放在第一步执行
WARNING[XFORMERS]: xFormers can’t load C++/CUDA extensions. xFormers was built for:

  1. auto-1  | Installing extension dependencies (if any)
  2. auto-1  | /opt/conda/lib/python3.10/site-packages/timm/models/layers/__init__.py:48: FutureWarning: Importing from timm.models.layers is deprecated, please import via timm.layers
  3. auto-1  |   warnings.warn(f"Importing from {__name__} is deprecated, please import via timm.layers", FutureWarning)
  4. auto-1  | WARNING[XFORMERS]: xFormers can't load C++/CUDA extensions. xFormers was built for:
  5. auto-1  |     PyTorch 2.3.0+cu121 with CUDA 1201 (you have 2.3.0)
  6. auto-1  |     Python  3.10.14 (you have 3.10.14)
  7. auto-1  |   Please reinstall xformers (see https://github.com/facebookresearch/xformers#installing-xformers)
  8. auto-1  |   Memory-efficient attention, SwiGLU, sparse and more won't be available.
  9. auto-1  |   Set XFORMERS_MORE_DETAILS=1 for more details
复制代码
出现这个异常报警一般是显卡和 xfomers 版本不划一导致,详见 https://github.com/facebookresearch/xformers#installing-xformers,找到正确的版本(好比 pip3 install -U xformers --index-url https://download.pytorch.org/whl/cu118),修改
  1. RUN --mount=type=cache,target=/root/.cache/pip \
  2.   pip install pyngrok xformers==0.0.26.post1 \
  3.   git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379 \
  4.   git+https://github.com/openai/CLIP.git@d50d76daa670286dd6cacf3bcd80b5e4823fc8e1 \
  5.   git+https://github.com/mlfoundations/open_clip.git@v2.20.0
复制代码

  1. RUN --mount=type=cache,target=/root/.cache/pip \
  2.   pip install pyngrok \
  3.   git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379 \
  4.   git+https://github.com/openai/CLIP.git@d50d76daa670286dd6cacf3bcd80b5e4823fc8e1 \
  5.   git+https://github.com/mlfoundations/open_clip.git@v2.20.0
  6. RUN --mount=type=cache,target=/root/.cache/pip pip install xformers==0.0.26.post1 --index-url https://download.pytorch.org/whl/cu118
复制代码
再次运行 docker compose --profile auto up --build
后,启动正常

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

怀念夏天

金牌会员
这个人很懒什么都没写!
快速回复 返回顶部 返回列表