当前位置:   article > 正文

centos 安装 stable-diffusion 详细流程_centos安装stable diffusion

centos安装stable diffusion

 一、准备环境

安装git 新版

 先安装git 工具来更新git源码 , 载下源码后卸载git 版本(centos 默认1.8版本,说是安装会引起失败)

安装git 命令,可使用 git --version查看版本

sudo yum install git -y

卸载git命令

sudo yum remove git

 正式源码安装git 过程 

  1. cd /usr/src/
  2. git clone https://github.com/git/git.git
  3. cd git/
  4. sudo make prefix=/usr install
  5. sudo echo "export PATH=/usr/bin:$PATH" >> ~/.bashrc
  6. source ~/.bashrc
  7. git --version

最后显示 git version 2.44 就成功了(要git 2.3以上)

安装python 3.10.6 (较新版本的Python不支持torch)-官方要求的 (注:不可卸载自带python-中间心酸自己知道)

  1. cd /usr/local
  2. wget https://www.python.org/ftp/python/3.10.6/Python-3.10.6.tgz --no-check-certificate
  3. tar -zxvf Python-3.10.6.tgz
  4. wget https://www.openssl.org/source/openssl-1.1.1n.tar.gz --no-check-certificate
  5. tar -zxvf openssl-1.1.1n.tar.gz
  6. cd openssl-1.1.1n
  7. ./config --prefix=/usr/local/openssl
  8. make -j && make install
  9. openssl version
  10. mv /usr/bin/openssl /usr/bin/openssl.bak
  11. ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
  12. yum install zlib zlib-devel
  13. yum install -y libffi-devel
  14. cd /usr/local/Python-3.10.6/
  15. ./configure --prefix=/usr/local/python3 --with-openssl=/usr/local/openssl --with-openssl-rpath=auto
  16. make -j
  17. make install
  18. python3 -V
  19. ln -s /usr/local/python3/bin/pydoc3.10 /usr/bin/pydoc3
  20. ln -s /usr/local/python3/bin/python3.10-config /usr/bin/python3-config
  21. ln -s /usr/local/python3/bin/python3.10 /usr/bin/python3
  22. ln -s /usr/local/python3/bin/pip3.10 /usr/bin/pip
  23. pip install --upgrade pip
  24. pip -V
  25. pip install requests

 说明:

安装完python3.10.6  ,

        pip 安装默认为 22.2.1 要升级到最新

stable-diffusion-ui要支持root用户

在webui.sh中把 can_run_as_root=0 改成 can_run_as_root=1   就可以root 直接执行对应脚本 

 安装脚本(到对应该webui目录中再下载,执行 webui.sh后,

 说明:(pip在虚拟机中可能不是最新的,所以创建要创建的虚拟机中,升级pip)

第一步安装git和Python3在前置部分已经安装好了。
开始第二步,下载webui.sh,下面这个命令即使从官方github地址下载webui.sh这个文件。注意:我们只需要下载这一个文件即可,其他文件在之后执行这个文件的时候会下载。
wget -q https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui/master/webui.sh
第三步执行webui.sh,在你保存webui.sh的目录中执行。执行完成后,会在同级目录下生成名为stable-diffusion-webui的文件夹,这就是从官方地址完整下载的。
./webui.sh
第四部进入stable-diffusion-webui里面,里面也有这个文件,再次执行这个./webui.sh文件,然后就可以使用啦

  1. wget -q https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui/master/webui.sh
  2. sh webui.sh
  3. cd stable-diffusion-webui
  4. python3 -m venv venv
  5. source venv/bin/activate
  6. pip -V
  7. pip install --upgrade pip
  8. pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
  9. pip install -r requirements_versions.txt # 执行此条命令前,请检查你的剩余磁盘空间

 二、安装必要的库  在stable-diffusion-webui目录

 安装 PyTorch  查看对应和安装命令 Start Locally | PyTorch

pip3 install torch torchvision torchaudio

  安装xformers  先查看是否有装并查看支持的对应版本

  1. python -m xformers.info
  2. pip install xformers

 安装 openai/clip-vit-large-patch14 

  1. mkdir openai
  2. cd openai
  3. git clone https://www.modelscope.cn/AI-ModelScope/clip-vit-large-patch14.git

如果xformes安装有问题,可以下源码后再安装,在stable-diffusion-webui目录(备用)

  1. git clone https://github.com/facebookresearch/xformers.git
  2. cd xformers
  3. git submodule update --init --recursive
  4. 如果不行,也可以用下源码,下下来放对应目录
  5. git clone https://github.com/NVIDIA/cutlass.git third_party/cutlass
  6. git clone https://github.com/Dao-AILab/flash-attention.git third_party/flash-attention
  7. git clone https://github.com/ROCm/composable_kernel.git third_party/composable_kernel_tiled

  1. cd ./repositories
  2. git clone https://github.com/salesforce/BLIP.git
  3. git clone https://github.com/sczhou/CodeFormer.git
  4. git clone https://github.com/crowsonkb/k-diffusion.git
  5. git clone https://github.com/Stability-AI/generative-models.git
  6. git clone https://github.com/Stability-AI/stablediffusion.git stable-diffusion-stability-ai
  7. git clone https://github.com/CompVis/stable-diffusion.git
  8. cd stable-diffusion

参考:

1)、Centos7 部署 Stable Diffusion_skip-torch-cuda-test-CSDN博客

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小惠珠哦/article/detail/905581
推荐阅读
相关标签
  

闽ICP备14008679号