stable_diffusion_webui docker environment configuration

1. Create a new docker environment

docker  run -tid --name  e_commerce_sd --net host --runtime=nvidia  nvidia/cuda:11.1-cudnn8-devel-cent                                                                      os7-ssh /bin/bash

docker exec -ti e_commerce_sd /bin/bash
echo 'export PS1="DOCKER[\u@\h \w]\$"' > ~/.bashrc
exit
docker exec -ti e_commerce_sd /bin/bash
exit
docker cp e_commerce_sd.zip e_commerce_sd:/root
docker exec -ti e_commerce_sd /bin/bash

docker commit e_commerce_sd e_commerce_sd_sam:v1.0

docker run -tid --name img2img_revanimated_v121inp_run --restart=always --cpus=10 --net host --runtime=nvidia img2img_revanimated_v121inp:v1.0.0 /bin/bash

docker save -o e_commerce_sd_all_v101.tar e_commerce_sd_all:v1.0.1
scp -r [email protected]:/root/e_commerce_sd_all_v101.tar [email protected]:/home
docker load < e_commerce_sd_all_v101.tar


删除镜像
docker images
docker rmi IMAGE ID
删除容器
docker rm -f CONTAINER ID

2. Install miniconda

yum install wget
wget -c https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
sh Miniconda3-latest-Linux-x86_64.sh
source ~/.bashrc

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
python -m pip config set global.index-url https://mirrors.aliyun.com/pypi/simple
python -m pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

conda create -n py38 python==3.8
conda activate py38

3. Configure stable_diffusion_webui

There may be some problems when using launch.py ​​directly under stable_difffusion_webui, it is recommended

pip install open_clip-bb6e834e9c70d9c27d0dc3ecedeebeaeb1ffad6b.zip
pip install CLIP-d50d76daa670286dd6cacf3bcd80b5e4823fc8e1.zip
pip install GFPGAN-8d2447a2d918f8eba5a4a01463fd48e45126a379.zip
pip install -r requirements_versions.txt
pip install opencv-python-headless
pip install gdown

4. Install tensorrt

tar -xzvf TensorRT-8.6.1.6.Linux.x86_64-gnu.cuda-11.8.tar.gz

1. Use vim to enter the ~/.bashrc document, press and hold ctrl+g, jump directly to the last line, press the i key, enter the insert mode, and now you can edit the document. 2. Jump to the last character, press to change the line, you can enter the command in the next line. 3. Generally speaking, in the Ubuntu terminal, ctrl+shift+c is to copy, and Ctrl+shift+v is to paste, you can write it first and paste it directly; 4. We enter the first environment variable configuration:

export LD_LIBRARY_PATH=/home/TensorRT-8.6.1.6/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export PATH=/home/TensorRT-8.6.1.6/bin${PATH:+:${PATH}}

5. The path is added, it’s time to close ~/.bashrc, press the esc key to exit the insert mode; 6. Enter a colon: wq, close bashrc; 7. It’s not effective yet! Need to source it

source ~/.bashrc
cd python
pip install tensorrt-8.6.1-cp38-none-linux_x86_64.whl

Install pycuda

pip install pycuda==2019.1
export CUDA_VISIBLE_DEVICES=3

onnxruntime can only call cpu

conda install cudnn

pip install onnxruntime==1.15.1, just reinstall it

Guess you like

Origin blog.csdn.net/u012193416/article/details/132355781