Stable Diffusion

来自WHY42
Riguz留言 | 贡献2024年5月8日 (三) 10:38的版本 →‎ComfyUI
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

Dockerfile

FROM nvidia/cuda:12.4.1-cudnn-devel-ubuntu22.04

RUN sed -i 's|http://ports.ubuntu.com/|https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/|g' /etc/apt/sources.list /etc/apt/sources.list && \
    apt update && \
    apt install -y build-essential cmake wget git python3 python3-pip sudo
RUN pip3 install jupyterlab
RUN apt-get install -y openssh-client openssh-server && \
    mkdir -p /var/run/sshd && \
    sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config && \
    cat /etc/ssh/ssh_config | grep -v StrictHostKeyChecking > /etc/ssh/ssh_config.new && \
    echo "    StrictHostKeyChecking no" >> /etc/ssh/ssh_config.new && \
    mv /etc/ssh/ssh_config.new /etc/ssh/ssh_config

CMD ["sleep", "infinity"]

Check GPU:

nvidia-smi
Tue May  7 11:47:20 2024
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.54.03              Driver Version: 535.54.03    CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA GeForce RTX 2080 Ti     On  | 00000000:85:00.0 Off |                  N/A |
| 36%   28C    P8              20W / 250W |   2847MiB / 11264MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+

+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
+---------------------------------------------------------------------------------------+

Stable Diffusion

Webui

sudo apt install wget git python3 python3-venv libgl1 libglib2.0-0
# https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/10117#issuecomment-1536437860
sudo apt install --no-install-recommends google-perftools
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
cd stable-diffusion-webui
bash webui.sh

To change configuration, edit webui-user.sh:

export COMMANDLINE_ARGS="--listen --port 5050 --subpath=/kas/py36lph9lctmsk11hp7gngmbt37n"

To use new models, download *.safetensors and put into /models/xx folder.

ComfyUI

ls ComfyUI/models/checkpoints
-rw-rw-r-- 1 kas kas 6.5G May  7 13:55 sd_xl_base_1.0.safetensors
-rw-rw-r-- 1 kas kas 6.5G May  7 13:57 sd_xl_base_1.0_0.9vae.safetensors
-rw-rw-r-- 1 kas kas 5.7G Jul 26  2023 sd_xl_refiner_1.0.safetensors
-rw-rw-r-- 1 kas kas 5.7G Jul 29  2023 sd_xl_refiner_1.0_0.9vae.safetensors
-rw-rw-r-- 1 kas kas 4.0G May  7 13:58 v1-5-pruned-emaonly.safetensors
-rw-rw-r-- 1 kas kas 4.9G May  7 13:59 v2-1_768-ema-pruned.safetensors

python3 main.py --port 5050 --listen
cd custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Manager.git

[1]

Use *vae.safetensors[2].

[3]