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

Added support for Docker Build/Compose and K8S #16737

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

panpan0000
Copy link

Description

Merging the PR from #16688

  • Add dockerfile for docker build

  • Added support for containerization with Docker. To run webui you need to have Docker installed, clone the repository and execute docker compose up in the root directory of the repository. The first startup installs all the dependencies and subsequent startups are much quicker. The webui is exposed at localhost:7860

  • Add support for k8s yaml

  • will add CI for automatic docker image build and pushing to dockerhub later

Screenshots/videos:

.....
################################################################
Launching launch.py...
################################################################
glibc version is 2.36
Check TCMalloc: libtcmalloc_minimal.so.4
./webui.sh: line 258: bc: command not found
./webui.sh: line 258: [: -eq: unary operator expected
libtcmalloc_minimal.so.4 is linked with libc.so,execute LD_PRELOAD=/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4
Launching Web UI with arguments: --skip-prepare-environment

/webui/venv/lib/python3.10/site-packages/timm/models/layers/__init__.py:48: FutureWarning: Importing from timm.models.layers is deprecated, please import via timm.layers
  warnings.warn(f"Importing from {__name__} is deprecated, please import via timm.layers", FutureWarning)
no module 'xformers'. Processing without...
no module 'xformers'. Processing without...
No module 'xformers'. Proceeding without it.
Warning: caught exception 'Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx', memory monitor disabled
Downloading: "https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors" to /webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors

  4%|█████▉                                                                                                                                     | 174M/3.97G [02:54<59:12, 1.15MB/
.....

Loading weights [cc6cb27103] from /webui/models/Stable-diffusion/v1-5-pruned-emaonly.ckpt
Running on local URL:  http://0.0.0.0:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 9.9s (import torch: 4.7s, import gradio: 1.2s, setup paths: 0.9s, initialize shared: 0.1s, other imports: 0.6s, load scripts: 0.9s, create ui: 0.9s, gradio launch: 0.5s).
Creating model from config: /webui/configs/v1-inference.yaml

Checklist:

@panpan0000
Copy link
Author

@ShadowCrafter011 already updated his PR #16688
So I will refactor this one when #16688 merged

@panpan0000 panpan0000 force-pushed the docker-compose branch 2 times, most recently from 8618359 to fae2f2f Compare December 23, 2024 07:22
.dockerignore Outdated
.che__/
*.log
*.git
*.gitignoreivenv
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is going on with these ignore entries? "che", "gitignoreivenv", ... what?

Also shouldn't eg embeddings, extensions, etc. be ignored here? (ie anything that has a separate bind to forward it in)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.che__ is Eclipse env.
gitignoreivenv is a typo ... should be gitignore and .venv...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

README.md Outdated
cd stable-diffusion-webui
export TAG=v1.10.0
docker build -t stable-diffusion-webui:${TAG} -f docker/Dockerfile .
docker run --gpus all -d -p 7860:7860 stable-diffusion-webui:${TAG}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(A) Minor, but formatting is a little weird here, double-spacing left in.
(B) Minor, but also the tag usage seems a bit unusual.
(C) the -v for models isn't really optional, it should be included not a "if you happen to already have models". This line should have all the same contents as the compose does by default.

Copy link
Author

@panpan0000 panpan0000 Dec 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you. fixed

hmm, about (c) , after careful thought, you are right .even without pre-download model files in volume or in container, the webui.sh will still download image when containers up

@silveroxides
Copy link
Contributor

There is already a docker image that have been maintained for over 1½ years.
If there is anything in the main repo that causes these not to work then I understand if you request some changes to make it compatible again.
But as far as I can see there is no issue with the current state of it. In fact it was updated less than 24 hours ago.
universonic/stable-diffusion-webui at the docker hub

You can absolutely make a repo dedicated to build/compose of the webui and have it linked by the main repo so people can find it. But introducing Dockerfiles in to the main repo doesn't make much sense.

@panpan0000
Copy link
Author

There is already a docker image that have been maintained for over 1½ years. If there is anything in the main repo that causes these not to work then I understand if you request some changes to make it compatible again. But as far as I can see there is no issue with the current state of it. In fact it was updated less than 24 hours ago. universonic/stable-diffusion-webui at the docker hub

You can absolutely make a repo dedicated to build/compose of the webui and have it linked by the main repo so people can find it. But introducing Dockerfiles in to the main repo doesn't make much sense.

we can discuss this topic in thread : #16688

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants