安装指南

本文面向昇腾开发者,帮助开发者完成stable-diffusion-webui在昇腾上的安装

备注

请确保环境安装了对应的固件和驱动,详情请参考 快速安装昇腾环境

安装miniconda

1mkdir -p ~/miniconda3
2wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh -O ~/miniconda3/miniconda.sh
3bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
4rm -rf ~/miniconda3/miniconda.sh
5~/miniconda3/bin/conda init bash
6~/miniconda3/bin/conda init zsh

使用conda创建环境

1conda create -n python310 python=3.10.6
2conda activate python310

安装stable-diffusion-webui

  • 自动安装命令如下:

1git clone --branch dev https://github.com/AUTOMATIC1111/stable-diffusion-webui.gitcd stable-diffusion-webui
2
3#此命令将在首次安装时自动在 Ascend 设备上安装 torch 和 torch_npu。
4./webui.sh --listen --skip-torch-cuda-test --no-half
  • 手动安装:

 1# install stable-diffusion-webui
 2git clone --branch dev https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
 3cd stable-diffusion-webui
 4python -m venv venv
 5source ./venv/bin/activate
 6pip install torch==2.1.0 torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
 7pip install torch_npu==2.1.0
 8pip install https://github.com/openai/CLIP/archive/d50d76daa670286dd6cacf3bcd80b5e4823fc8e1.zip --prefer-binary
 9pip install https://github.com/mlfoundations/open_clip/archive/bb6e834e9c70d9c27d0dc3ecedeebeaeb1ffad6b.zip
10pip install -U -I --no-deps xformers==0.0.23.post1
11pip install install ngrok
12mkdir repositories
13git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui-assets.git stable-diffusion-webui-assets
14git -C stable-diffusion-webui-assets checkout 6f7db241d2f8ba7457bac5ca9753331f0c266917
15git clone https://github.com/Stability-AI/stablediffusion.git stable-diffusion-stability-ai
16git -C stable-diffusion-stability-ai checkout cf1d67a6fd5ea1aa600c4df58e5b47da45f6bdbf
17git clone https://github.com/Stability-AI/generative-models.git generative-models
18git -C generative-models checkout 45c443b316737a4ab6e40413d7794a7f5657c19f
19git clone https://github.com/crowsonkb/k-diffusion.git k-diffusion
20git -C k-diffusion checkout ab527a9a6d347f364e3d185ba6d714e22d80cb3c
21git clone https://github.com/salesforce/BLIP.git BLIP
22git -C BLIP checkout 48211a1594f1321b00f14c9f7a5b4813144b2fb9
23pip install -r requirements.txt
24pip install -r requirements_npu.txt