Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker container support #7946

Closed
wants to merge 75 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
865b265
Initial docker support
emsi Feb 20, 2023
3978729
Improved run.sh script showing the UI URL
emsi Feb 20, 2023
91eee72
Improved for better run.sh. Fixed typos.
emsi Feb 20, 2023
d2a9477
Cache /root/.cache in volume.
emsi Feb 20, 2023
b41ff54
Ignore the docker-compose.override.yml used for local config overrides.
emsi Feb 20, 2023
f28cb2a
Quote paths to prevent word splitting.
emsi Feb 20, 2023
d4e0c47
Further info, typos and formatting.
emsi Feb 20, 2023
4426b71
Typos and python3 consistently as pointed out by @wbudd.
emsi Feb 24, 2023
dd2d85b
Use volumes for embeddings and extensions
emsi Apr 3, 2023
e1f4462
Merge branch 'AUTOMATIC1111:master' into master
emsi Apr 17, 2023
606fcd7
Added missing volumes for persistent data
emsi Apr 21, 2023
1cbcd8c
Merge branch 'AUTOMATIC1111:master' into master
emsi May 4, 2023
61f9a6c
Don't declare volume, compose is ensuring that
emsi May 6, 2023
4bc05f0
Merge branch 'AUTOMATIC1111:master' into master
emsi May 16, 2023
33b867d
Add GitHub action to build image and push to registry
emsi May 26, 2023
f9e2778
Use docker.io registry
emsi May 26, 2023
d01dc87
Mount whole source as volume.
emsi May 26, 2023
2691b43
Merge branch 'AUTOMATIC1111:master' into master
emsi May 30, 2023
fc614a8
run on master branch
emsi May 30, 2023
10d969a
Merge branch 'AUTOMATIC1111:master' into master
emsi Jun 8, 2023
d3567af
Merge branch 'AUTOMATIC1111:master' into master
emsi Jul 1, 2023
7a5a192
setup venv in /venv to avoid conflict with volume in /stable-diffusio…
emsi Jul 1, 2023
436e461
typo
emsi Jul 17, 2023
da6fe5d
Merge branch 'AUTOMATIC1111:master' into master
emsi Jul 18, 2023
29dad2d
Merge branch 'AUTOMATIC1111:master' into master
emsi Jul 27, 2023
1670b15
Fix automated builds
emsi Jul 27, 2023
c9c8485
Merge branch 'release_candidate'
AUTOMATIC1111 Aug 23, 2023
c8c73ea
fix incorrect save/display of new values in Defaults page in settings
AUTOMATIC1111 Aug 24, 2023
e004384
Merge branch 'dev' into release_candidate
AUTOMATIC1111 Aug 25, 2023
ac1abf3
fix defaults settings page breaking when any of main UI tabs are hidden
AUTOMATIC1111 Aug 26, 2023
3d83683
fix error that causes some extra networks to be disabled if both <lor…
AUTOMATIC1111 Aug 27, 2023
1b46863
update gradio to 3.41.2
AUTOMATIC1111 Aug 27, 2023
9dd0c4a
update changelog
AUTOMATIC1111 Aug 27, 2023
5e30f73
fix for Reload UI function: if you reload UI on one tab, other opened…
AUTOMATIC1111 Aug 27, 2023
783a575
Merge pull request #12795 from catboxanon/prevent-duplicate-resize-ha…
AUTOMATIC1111 Aug 27, 2023
7989765
Merge pull request #12797 from Madrawn/vae_resolve_bug
AUTOMATIC1111 Aug 27, 2023
5359dc0
Merge pull request #12792 from catboxanon/image-cropper-hide
AUTOMATIC1111 Aug 27, 2023
f331821
Merge pull request #12780 from catboxanon/xyz-hide-samplers
AUTOMATIC1111 Aug 27, 2023
6139b14
fix style editing dialog breaking if it's opened in both img2img and …
AUTOMATIC1111 Aug 27, 2023
cb81087
update changelog
AUTOMATIC1111 Aug 27, 2023
66d7630
lint
AUTOMATIC1111 Aug 27, 2023
d63117a
hide --gradio-auth and --api-auth values from /internal/sysinfo report
AUTOMATIC1111 Aug 27, 2023
d0d5075
update changelog
AUTOMATIC1111 Aug 27, 2023
bfc5c08
Merge pull request #12814 from AUTOMATIC1111/non-local-condition
AUTOMATIC1111 Aug 27, 2023
8670846
Merge pull request #12819 from catboxanon/fix/rng-infotext
AUTOMATIC1111 Aug 28, 2023
c0f9821
always show NV as RNG source in infotext
AUTOMATIC1111 Aug 28, 2023
8a7a427
Merge pull request #12842 from dhwz/dev
AUTOMATIC1111 Aug 29, 2023
6558716
Merge pull request #12837 from bluelovers/pr/file-metadata-break-001
AUTOMATIC1111 Aug 29, 2023
738e133
Merge pull request #12818 from catboxanon/sgm
AUTOMATIC1111 Aug 29, 2023
444f102
Merge pull request #12834 from catboxanon/fix/notification-tab-switch
AUTOMATIC1111 Aug 29, 2023
0c9282b
Merge pull request #12832 from catboxanon/fix/skip-install-extensions
AUTOMATIC1111 Aug 29, 2023
00e393c
Merge pull request #12833 from catboxanon/fix/dont-print-blank-stdout
AUTOMATIC1111 Aug 29, 2023
a0af285
revert SGM noise multiplier change for img2img because it breaks hire…
AUTOMATIC1111 Aug 29, 2023
642faa1
Merge pull request #12856 from catboxanon/extra-noise-noisy-latent
AUTOMATIC1111 Aug 30, 2023
323dcad
Merge pull request #12855 from dhwz/dev
AUTOMATIC1111 Aug 30, 2023
46f3ee9
Merge pull request #12854 from catboxanon/fix/quicksettings-dropdown-…
AUTOMATIC1111 Aug 30, 2023
965c728
Merge pull request #12839 from ibrainventures/patch-1
AUTOMATIC1111 Aug 30, 2023
afea99a
get progressbar to display correctly in extensions tab
AUTOMATIC1111 Aug 30, 2023
3989d7e
Merge pull request #12838 from bluelovers/pr/file-metadata-path-001
AUTOMATIC1111 Aug 30, 2023
338d0b6
go back to single path for filenames in extra networks metadata dialog
AUTOMATIC1111 Aug 30, 2023
06bc1f4
Merge pull request #12851 from bluelovers/pr/extension-time-001
AUTOMATIC1111 Aug 30, 2023
9e7de49
update changelog
AUTOMATIC1111 Aug 30, 2023
503bd3f
keep order in list of checkpoints when loading model that doesn't hav…
AUTOMATIC1111 Aug 30, 2023
87a083d
Merge pull request #12864 from AUTOMATIC1111/extension-time-format-ti…
AUTOMATIC1111 Aug 30, 2023
1ac11b3
Merge pull request #12865 from AUTOMATIC1111/another-convert-to-syste…
AUTOMATIC1111 Aug 30, 2023
87cca02
add an option to choose how to combine hires fix and refiner
AUTOMATIC1111 Aug 30, 2023
135b61b
fix inpainting models in txt2img creating black pictures
AUTOMATIC1111 Aug 30, 2023
8d54739
add information about Restore faces and Tiling into the changelog
AUTOMATIC1111 Aug 30, 2023
d0026da
add --dump-sysinfo, a cmd arg to dump limited sysinfo file at startup
AUTOMATIC1111 Aug 30, 2023
0cdbd90
update bug report template to include sysinfo and not include all oth…
AUTOMATIC1111 Aug 30, 2023
d43333f
fix an issue where VAE would remain in fp16 after an auto-switch to fp32
AUTOMATIC1111 Aug 30, 2023
ae7291f
fix an issue where using hires fix with refiner on first pass with me…
AUTOMATIC1111 Aug 30, 2023
e7965a5
Merge pull request #12876 from ljleb/fix-re
AUTOMATIC1111 Aug 31, 2023
5ef669d
Merge branch 'release_candidate'
AUTOMATIC1111 Aug 31, 2023
f0563a6
Merge branch 'AUTOMATIC1111:master' into master
emsi Sep 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 7 additions & 71 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ body:
id: steps
attributes:
label: Steps to reproduce the problem
description: Please provide us with precise step by step information on how to reproduce the bug
description: Please provide us with precise step by step instructions on how to reproduce the bug
value: |
1. Go to ....
2. Press ....
Expand All @@ -37,64 +37,14 @@ body:
id: what-should
attributes:
label: What should have happened?
description: Tell what you think the normal behavior should be
description: Tell us what you think the normal behavior should be
validations:
required: true
- type: input
id: commit
attributes:
label: Version or Commit where the problem happens
description: "Which webui version or commit are you running ? (Do not write *Latest Version/repo/commit*, as this means nothing and will have changed by the time we read your issue. Rather, copy the **Version: v1.2.3** link at the bottom of the UI, or from the cmd/terminal if you can't launch it.)"
validations:
required: true
- type: dropdown
id: py-version
attributes:
label: What Python version are you running on ?
multiple: false
options:
- Python 3.10.x
- Python 3.11.x (above, no supported yet)
- Python 3.9.x (below, no recommended)
- type: dropdown
id: platforms
attributes:
label: What platforms do you use to access the UI ?
multiple: true
options:
- Windows
- Linux
- MacOS
- iOS
- Android
- Other/Cloud
- type: dropdown
id: device
attributes:
label: What device are you running WebUI on?
multiple: true
options:
- Nvidia GPUs (RTX 20 above)
- Nvidia GPUs (GTX 16 below)
- AMD GPUs (RX 6000 above)
- AMD GPUs (RX 5000 below)
- CPU
- Other GPUs
- type: dropdown
id: cross_attention_opt
- type: textarea
id: sysinfo
attributes:
label: Cross attention optimization
description: What cross attention optimization are you using, Settings -> Optimizations -> Cross attention optimization
multiple: false
options:
- Automatic
- xformers
- sdp-no-mem
- sdp
- Doggettx
- V1
- InvokeAI
- "None "
label: Sysinfo
description: System info file, generated by WebUI. You can generate it in settings, on the Sysinfo page. Drag the file into the field to upload it. If you submit your report without including the sysinfo file, the report will be closed. If needed, review the report to make sure it includes no personal information you don't want to share. If you can't start WebUI, you can use --dump-sysinfo commandline argument to generate the file.
validations:
required: true
- type: dropdown
Expand All @@ -108,21 +58,7 @@ body:
- Brave
- Apple Safari
- Microsoft Edge
- type: textarea
id: cmdargs
attributes:
label: Command Line Arguments
description: Are you using any launching parameters/command line arguments (modified webui-user .bat/.sh) ? If yes, please write them below. Write "No" otherwise.
render: Shell
validations:
required: true
- type: textarea
id: extensions
attributes:
label: List of extensions
description: Are you using any extensions other than built-ins? If yes, provide a list, you can copy it at "Extensions" tab. Write "No" otherwise.
validations:
required: true
- Other
- type: textarea
id: logs
attributes:
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/docker-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build and Push Docker Image

on:
push:
branches:
- master
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Check Out Repo
uses: actions/checkout@v2

- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Build and push Docker image
run: |
cd docker
./build.sh
19 changes: 18 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,12 @@
* make progress bar work independently from live preview display which results in it being updated a lot more often
* forbid Full live preview method for medvram and add a setting to undo the forbidding
* make it possible to localize tooltips and placeholders
* add option to align with sgm repo's sampling implementation ([#12818](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/12818))
* Restore faces and Tiling generation parameters have been moved to settings out of main UI
* if you want to put them back into main UI, use `Options in main UI` setting on the UI page.

### Extensions and API:
* gradio 3.41.0
* gradio 3.41.2
* also bump versions for packages: transformers, GitPython, accelerate, scikit-image, timm, tomesd
* support tooltip kwarg for gradio elements: gr.Textbox(label='hello', tooltip='world')
* properly clear the total console progressbar when using txt2img and img2img from API
Expand Down Expand Up @@ -127,6 +130,20 @@
* set devices.dtype_unet correctly
* run RealESRGAN on GPU for non-CUDA devices ([#12737](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/12737))
* prevent extra network buttons being obscured by description for very small card sizes ([#12745](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/12745))
* fix error that causes some extra networks to be disabled if both <lora:> and <lyco:> are present in the prompt
* fix defaults settings page breaking when any of main UI tabs are hidden
* fix incorrect save/display of new values in Defaults page in settings
* fix for Reload UI function: if you reload UI on one tab, other opened tabs will no longer stop working
* fix an error that prevents VAE being reloaded after an option change if a VAE near the checkpoint exists ([#12797](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/12737))
* hide broken image crop tool ([#12792](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/12737))
* don't show hidden samplers in dropdown for XYZ script ([#12780](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/12737))
* fix style editing dialog breaking if it's opened in both img2img and txt2img tabs
* fix a bug allowing users to bypass gradio and API authentication (reported by vysecurity)
* fix notification not playing when built-in webui tab is inactive ([#12834](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/12834))
* honor `--skip-install` for extension installers ([#12832](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/12832))
* don't print blank stdout in extension installers ([#12833](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/12832), [#12855](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/12855))
* do not change quicksettings dropdown option when value returned is `None` ([#12854](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/12854))
* get progressbar to display correctly in extensions tab


## 1.5.2
Expand Down
1 change: 1 addition & 0 deletions docker/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker-compose.override.yml
32 changes: 32 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM nvidia/cuda:11.7.1-cudnn8-runtime-ubuntu20.04

ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1 libglib2.0-0 \
python3 python3-venv \
git \
wget \
vim \
inetutils-ping \
sudo \
net-tools \
iproute2 \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

COPY webui.sh webui.sh

# setup venv in /venv to avoid conflict with volume in /stable-diffusion-webui
RUN echo 'venv_dir=/venv' > webui-user.sh

ENV install_dir=/
RUN ./webui.sh -f can_run_as_root --exit --skip-torch-cuda-test

ENV VIRTUAL_ENV=/venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

WORKDIR "/stable-diffusion-webui/"
VOLUME /root/.cache

CMD ["python3", "launch.py", "--listen"]
53 changes: 53 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Docker and compose support for Stable Diffusion web UI

This folder contains files necessary to build and run Stable Diffusion web UI as a docker container.
<br/>
As for now, only the Nvidia acceleration on Linux is supported.<br/>
This docker image is intended mainly for people already familiar with docker and looking for
additional security provided by container isolation, for example when running untrusted scripts or
models. Additional functionality as integration with
[docker-gen](https://github.com/nginx-proxy/docker-gen) and
[acme-companion](https://github.com/nginx-proxy/acme-companion) for automatic access via SSL might
come in handy too.


## Requirements
* A [docker](https://docs.docker.com/engine/install/) of course.
* [Nvidia docker runtime](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#docker).


# HOWTO

1. Make sure you have [Nvidia docker runtime](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#docker)
installed and configured properly, i.e.
`docker run --rm --runtime=nvidia --gpus all nvidia/cuda:11.6.2-base-ubuntu20.04 nvidia-smi`
outputs the information about your GPU.
1. Enter this very directory `stable-diffusion-webui/docker`.
1. Build the container using `./build.sh` or `docker compose build`.
1. Run the container with `./run.sh`
1. Wait for the UI to start then open the URL displayed on the screen:
```
./run.sh
[+] Running 1/1
⠿ Container docker-stable-diffusion-webui-1 Started 11.2s

Wait for the UI to start then point your browser to: http://localhost:xxxxx <-----

To stop showing the logs precc CTRL-C
...
```


# Further info

1. This image uses two volumes. One is used to store `~/.cache`, the other for
`stable-diffusion-webui/modules`. The latter is mounted in the `docker-compose.yml` to a
corresponding location inside the local path on your host. This is intended to make it easier
for the user to manipulate model files.
1. Beware though that inside container the UI is run as root. This has the implication that files
written to volumes mounted to local path are owned by root! When needed you may change the
ownership of existing files with `sudo chown -R $UID:$GID modules`.
1. To change the command line arguments or other configuration copy the `docker-compose.yml` file
as `docker-compose.override.yml` and make necessary changes there. It's the `compose` mechanism and
this way it won't conflict with the git. The part you are looking for is at the very end of the
YAML file: `command: python3 launch.py --listen`
12 changes: 12 additions & 0 deletions docker/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -Eeuo pipefail

if [ "$(which docker-compose)" ]; then
compose='docker-compose'
else
compose='docker compose'
fi

cp ../webui.sh .

$compose build
18 changes: 18 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
services:
stable-diffusion-webui:
runtime: nvidia
image: emsi/stable-diffusion-webui
build:
context: .
dockerfile: Dockerfile
ports:
- "7860"
environment:
- NVIDIA_VISIBLE_DEVICES=all
volumes:
- ..:/stable-diffusion-webui
- home:/root
command: python3 launch.py --listen

volumes:
home:
14 changes: 14 additions & 0 deletions docker/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -Eeuo pipefail

if [ "$(which docker-compose)" ]; then
compose='docker-compose'
else
compose='docker compose'
fi

$compose up -d

echo -e "\nWait for the UI to start then point your browser to: http://localhost:$(docker compose ps --status running --format json | sed -e 's/.*"PublishedPort":\([0-9]\+\),.*/\1/g') \n\n"
echo "To stop showing the logs press CTRL-C"
$compose logs -f
1 change: 1 addition & 0 deletions extensions-builtin/Lora/ui_edit_user_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def get_metadata_table(self, name):
metadata = item.get("metadata") or {}

keys = {
'ss_output_name': "Output name:",
'ss_sd_model_name': "Model:",
'ss_clip_skip': "Clip skip:",
'ss_network_module': "Kohya module:",
Expand Down
2 changes: 1 addition & 1 deletion javascript/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function extensions_check() {


var id = randomId();
requestProgress(id, gradioApp().getElementById('extensions_installed_top'), null, function() {
requestProgress(id, gradioApp().getElementById('extensions_installed_html'), null, function() {

});

Expand Down
9 changes: 9 additions & 0 deletions javascript/extraNetworks.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,15 @@ function popup(contents) {
globalPopup.style.display = "flex";
}

var storedPopupIds = {};
function popupId(id) {
if (!storedPopupIds[id]) {
storedPopupIds[id] = gradioApp().getElementById(id);
}

popup(storedPopupIds[id]);
}

function extraNetworksShowMetadata(text) {
var elem = document.createElement('pre');
elem.classList.add('popup-metadata');
Expand Down
2 changes: 1 addition & 1 deletion javascript/notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ onAfterUiUpdate(function() {
}
}

const galleryPreviews = gradioApp().querySelectorAll('div[id^="tab_"][style*="display: block"] div[id$="_results"] .thumbnail-item > img');
const galleryPreviews = gradioApp().querySelectorAll('div[id^="tab_"] div[id$="_results"] .thumbnail-item > img');

if (galleryPreviews == null) return;

Expand Down
4 changes: 3 additions & 1 deletion javascript/resizeHandle.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@

onUiLoaded(function() {
for (var elem of gradioApp().querySelectorAll('.resize-handle-row')) {
setupResizeHandle(elem);
if (!elem.querySelector('.resize-handle')) {
setupResizeHandle(elem);
}
}
});
7 changes: 7 additions & 0 deletions launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@


def main():
if args.dump_sysinfo:
filename = launch_utils.dump_sysinfo()

print(f"Sysinfo saved as {filename}. Exiting...")

exit(0)

launch_utils.startup_timer.record("initial startup")

with launch_utils.startup_timer.subcategory("prepare environment"):
Expand Down
1 change: 1 addition & 0 deletions modules/cmd_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
parser.add_argument("--log-startup", action='store_true', help="launch.py argument: print a detailed log of what's happening at startup")
parser.add_argument("--skip-prepare-environment", action='store_true', help="launch.py argument: skip all environment preparation")
parser.add_argument("--skip-install", action='store_true', help="launch.py argument: skip installation of packages")
parser.add_argument("--dump-sysinfo", action='store_true', help="launch.py argument: dump limited sysinfo file (without information about extensions, options) to disk and quit")
parser.add_argument("--loglevel", type=str, help="log level; one of: CRITICAL, ERROR, WARNING, INFO, DEBUG", default=None)
parser.add_argument("--do-not-download-clip", action='store_true', help="do not download CLIP model even if it's not included in the checkpoint")
parser.add_argument("--data-dir", type=str, default=os.path.dirname(os.path.dirname(os.path.realpath(__file__))), help="base path where all user data is stored")
Expand Down
2 changes: 1 addition & 1 deletion modules/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def check_versions():

expected_torch_version = "2.0.0"
expected_xformers_version = "0.0.20"
expected_gradio_version = "3.41.0"
expected_gradio_version = "3.41.2"

if version.parse(torch.__version__) < version.parse(expected_torch_version):
print_error_explanation(f"""
Expand Down
Loading
Loading