summarylogtreecommitdiffstats
path: root/stable-diffusion-webui.service
blob: 8ea801f814b44a4cca4eab00ce349b516bf12a4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
[Unit]
Description=Stable Diffusion Web UI
After=network.target

[Service]
Type=simple
User=sdwebui
Group=sdwebui
WorkingDirectory=/opt/stable-diffusion-webui
Environment=PYTHONUNBUFFERED=1
EnvironmentFile=/etc/stable-diffusion-webui/webui.conf
ExecStart=/bin/bash -c '\
    srcdir=/usr/share/stable-diffusion-webui/models/Stable-diffusion; \
    destdir="${DATA_DIR:+$DATA_DIR}/models/Stable-diffusion"; \
    modelfile=v1-5-pruned-emaonly.safetensors; \
    mkdir -p $destdir && \
    [ ! -f "$destdir/$modelfile" ] && cp "$srcdir/$modelfile" "$destdir/$modelfile"; \
    /opt/stable-diffusion-webui/venv/bin/accelerate \
    launch ${ACCELERATE_FLAGS} launch.py \
    --data-dir ${DATA_DIR:+$DATA_DIR}\
    ${WEBUI_FLAGS:+$WEBUI_FLAGS}'
Restart=always
StartLimitInterval=120
StartLimitBurst=15
UMask=007

[Install]
WantedBy=multi-user.target