Skip to content

Commit

Permalink
The Merge (#1444)
Browse files Browse the repository at this point in the history
The Merge
  • Loading branch information
hlky committed Oct 6, 2022
2 parents 14c5502 + ff78dad commit 72fb6ff
Show file tree
Hide file tree
Showing 39 changed files with 2,077 additions and 1,804 deletions.
3 changes: 1 addition & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
models/custom/
outputs/
src/
gfpgan/
configs/webui/userconfig_streamlit.yaml
66 changes: 15 additions & 51 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,61 +1,25 @@
# This file is part of stable-diffusion-webui (https://github.com/sd-webui/stable-diffusion-webui/).
ARG IMAGE=hlky/sd-webui:base

# Copyright 2022 sd-webui team.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
FROM ${IMAGE}

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.

# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Assumes host environment is AMD64 architecture
# ARG TARGETPLATFORM

# This is used to allow building against AMD GPUs
# Annoyingly, you can't IF branch off of, say, TARGETGPU and set
# the Dockerfile's FROM based on that, so we have to have the user
# pass in the entire image path for us.
ARG PYTORCH_IMAGE=pytorch/pytorch:1.12.1-cuda11.3-cudnn8-runtime
# To build against AMD, use
# --build-arg PYTORCH_IMAGE=rocm/pytorch:rocm5.2.3_ubuntu20.04_py3.7_pytorch_1.12.1

FROM ${PYTORCH_IMAGE}

WORKDIR /install
WORKDIR /workdir

SHELL ["/bin/bash", "-c"]

RUN apt-get update && \
apt-get install -y wget git build-essential && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

COPY ./requirements.txt /install/

RUN pip install -r /install/requirements.txt
# From base image. We need opencv-python-headless so we uninstall here
RUN pip uninstall -y opencv-python && pip install opencv-python-headless==4.6.0.66

# Install font for prompt matrix
COPY /data/DejaVuSans.ttf /usr/share/fonts/truetype/

ENV PYTHONPATH=/sd

COPY ./models /sd/models
COPY ./configs /sd/configs
COPY ./frontend /sd/frontend
COPY ./ldm /sd/ldm
# COPY ./gfpgan/ /sd/
COPY ./optimizedSD /sd/optimizedSD
COPY ./scripts /sd/scripts

EXPOSE 7860 8501

EXPOSE 8501
COPY ./data/DejaVuSans.ttf /usr/share/fonts/truetype/
COPY ./data/ /sd/data/
copy ./images/ /sd/images/
copy ./scripts/ /sd/scripts/
copy ./ldm/ /sd/ldm/
copy ./frontend/ /sd/frontend/
copy ./configs/ /sd/configs/
copy ./.streamlit/ /sd/.streamlit/
COPY ./entrypoint.sh /sd/
ENTRYPOINT /sd/entrypoint.sh

RUN mkdir -p ~/.streamlit/
RUN echo "[general]" > ~/.streamlit/credentials.toml
RUN echo "email = \"\"" >> ~/.streamlit/credentials.toml
17 changes: 17 additions & 0 deletions Dockerfile_base
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
ARG PYTORCH_IMAGE=hlky/pytorch:1.12.1-runtime

FROM ${PYTORCH_IMAGE}
SHELL ["/bin/bash", "-c"]

WORKDIR /install

RUN apt-get update && \
apt-get install -y wget curl git build-essential zip unzip nano openssh-server libgl1 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

COPY ./requirements.txt /install/

RUN /opt/conda/bin/python -m pip install -r /install/requirements.txt

RUN /opt/conda/bin/conda clean -ya
27 changes: 27 additions & 0 deletions Dockerfile_runpod
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
ARG IMAGE=hlky/sd-webui:base

FROM ${IMAGE}

WORKDIR /workdir

SHELL ["/bin/bash", "-c"]

ENV PYTHONPATH=/sd

EXPOSE 8501
COPY ./data/DejaVuSans.ttf /usr/share/fonts/truetype/
COPY ./configs/ /sd/configs/
COPY ./data/ /sd/data/
COPY ./frontend/ /sd/frontend/
COPY ./gfpgan/ /sd/gfpgan/
COPY ./images/ /sd/images/
COPY ./ldm/ /sd/ldm/
COPY ./models/ /sd/models/
COPY ./scripts/ /sd/scripts/
COPY ./.streamlit/ /sd/.streamlit/
COPY ./runpod_entrypoint.sh /sd/entrypoint.sh
ENTRYPOINT /sd/entrypoint.sh

RUN mkdir -p ~/.streamlit/
RUN echo "[general]" > ~/.streamlit/credentials.toml
RUN echo "email = \"\"" >> ~/.streamlit/credentials.toml
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Lets you improve faces in pictures using the GFPGAN model. There is a checkbox i

If you want to use GFPGAN to improve generated faces, you need to install it separately.
Download [GFPGANv1.3.pth](https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth) and put it
into the `/stable-diffusion-webui/src/gfpgan/experiments/pretrained_models` directory.
into the `/stable-diffusion-webui/models/gfpgan` directory.

### RealESRGAN

Expand All @@ -117,13 +117,13 @@ Lets you double the resolution of generated images. There is a checkbox in every
There is also a separate tab for using RealESRGAN on any picture.

Download [RealESRGAN_x4plus.pth](https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth) and [RealESRGAN_x4plus_anime_6B.pth](https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth).
Put them into the `stable-diffusion-webui/src/realesrgan/experiments/pretrained_models` directory.
Put them into the `stable-diffusion-webui/models/realesrgan` directory.

### GoBig, LSDR, and GoLatent *(Currently Gradio Only)*

More powerful upscalers that uses a seperate Latent Diffusion model to more cleanly upscale images.

Download **LDSR** [project.yaml](https://heibox.uni-heidelberg.de/f/31a76b13ea27482981b4/?dl=1) and [ model last.cpkt](https://heibox.uni-heidelberg.de/f/578df07c8fc04ffbadf3/?dl=1). Rename last.ckpt to model.ckpt and place both under stable-diffusion-webui/src/latent-diffusion/experiments/pretrained_models/
Download **LDSR** [project.yaml](https://heibox.uni-heidelberg.de/f/31a76b13ea27482981b4/?dl=1) and [ model last.cpkt](https://heibox.uni-heidelberg.de/f/578df07c8fc04ffbadf3/?dl=1). Rename last.ckpt to model.ckpt and place both under stable-diffusion-webui/models/ldsr/

Please see the [Image Enhancers Documentation](docs/5.image_enhancers.md) to learn more.

Expand Down
18 changes: 0 additions & 18 deletions build_docker.sh

This file was deleted.

0 comments on commit 72fb6ff

Please sign in to comment.