diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index e9dbf8c..0000000 --- a/Dockerfile +++ /dev/null @@ -1,22 +0,0 @@ -FROM chilloutai/stable-diffusion:1.0.0 - -SHELL ["/bin/bash", "-c"] - -ENV PATH="${PATH}:/workspace/stable-diffusion-webui/venv/bin" - -WORKDIR / - -ADD model.safetensors / - -RUN pip install -U xformers -RUN pip install runpod - -ADD koreanDollLikeness_v15.safetensors /workspace/stable-diffusion-webui/models/Lora/koreanDollLikeness_v15.safetensors -ADD japaneseDollLikeness_v10.safetensors /workspace/stable-diffusion-webui/models/Lora/japaneseDollLikeness_v10.safetensors -ADD taiwanDollLikeness_v10.safetensors /workspace/stable-diffusion-webui/models/Lora/taiwanDollLikeness_v10.safetensors - -ADD handler.py . -ADD start.sh /start.sh -RUN chmod +x /start.sh - -CMD [ "/start.sh" ] diff --git a/build.sh b/build.sh deleted file mode 100755 index b70adcb..0000000 --- a/build.sh +++ /dev/null @@ -1 +0,0 @@ -DOCKER_BUILDKIT=1 docker build -t chilloutai/auto-api:1.0.0 . \ No newline at end of file diff --git a/guofeng-api-template/Dockerfile b/guofeng-api-template/Dockerfile new file mode 100644 index 0000000..4dcf4c8 --- /dev/null +++ b/guofeng-api-template/Dockerfile @@ -0,0 +1,17 @@ +FROM chilloutai/guofeng-template:1.0.0 + +SHELL ["/bin/bash", "-c"] + +ENV PATH="${PATH}:/workspace/stable-diffusion-webui/venv/bin" + +WORKDIR / + +RUN pip install -U xformers +RUN pip install runpod + +ADD webui.py /workspace/stable-diffusion-webui/webui.py +ADD handler.py . +ADD start.sh /start.sh +RUN chmod +x /start.sh + +CMD [ "/start.sh" ] diff --git a/guofeng-api-template/build.sh b/guofeng-api-template/build.sh new file mode 100755 index 0000000..9c4bdd2 --- /dev/null +++ b/guofeng-api-template/build.sh @@ -0,0 +1 @@ +DOCKER_BUILDKIT=1 docker build -t chilloutai/guofeng-api:1.0.0 . \ No newline at end of file diff --git a/handler.py b/guofeng-api-template/handler.py similarity index 100% rename from handler.py rename to guofeng-api-template/handler.py diff --git a/start.sh b/guofeng-api-template/start.sh similarity index 77% rename from start.sh rename to guofeng-api-template/start.sh index 8092eec..f49d308 100644 --- a/start.sh +++ b/guofeng-api-template/start.sh @@ -4,7 +4,7 @@ export PYTHONUNBUFFERED=1 source /workspace/stable-diffusion-webui/venv/bin/activate cd /workspace/stable-diffusion-webui echo "starting api" -python webui.py --port 3000 --nowebui --api --xformers --enable-insecure-extension-access --ckpt /model.safetensors & +python webui.py --port 3000 --nowebui --api --xformers --enable-insecure-extension-access --ckpt ./models/Stable-diffusion/basemodel.safetensors & cd / echo "starting worker" diff --git a/webui.py b/guofeng-api-template/webui.py similarity index 100% rename from webui.py rename to guofeng-api-template/webui.py diff --git a/guofeng-template/Dockerfile b/guofeng-template/Dockerfile new file mode 100644 index 0000000..dbf2453 --- /dev/null +++ b/guofeng-template/Dockerfile @@ -0,0 +1,21 @@ +FROM runpod/stable-diffusion:web-automatic-1.5.16 + +SHELL ["/bin/bash", "-c"] + +ENV PATH="${PATH}:/workspace/stable-diffusion-webui/venv/bin" + +WORKDIR / + +RUN rm /workspace/v1-5-pruned-emaonly.ckpt + +ADD ./models/basemodel.safetensors /workspace/stable-diffusion-webui/models/Stable-diffusion/basemodel.safetensors +ADD ./models/Lora/ /workspace/stable-diffusion-webui/models/Lora/ + + +ADD relauncher.py . +ADD webui-user.sh . +ADD start.sh /start.sh +RUN chmod a+x /start.sh + +SHELL ["/bin/bash", "--login", "-c"] +CMD [ "/start.sh" ] \ No newline at end of file diff --git a/guofeng-template/build.sh b/guofeng-template/build.sh new file mode 100755 index 0000000..ced667a --- /dev/null +++ b/guofeng-template/build.sh @@ -0,0 +1 @@ +DOCKER_BUILDKIT=1 docker build -t chilloutai/guofeng-template:1.0.0 . \ No newline at end of file diff --git a/guofeng-template/models/download.sh b/guofeng-template/models/download.sh new file mode 100755 index 0000000..c21e61d --- /dev/null +++ b/guofeng-template/models/download.sh @@ -0,0 +1,3 @@ +wget -O ./Lora/Moxin_1010.safetensors https://civitai.com/api/download/models/14856 +wget -O ./basemodel.safetensors https://civitai.com/api/download/models/12378 +wget -O ./Lora/Moxin_Shukezouma.safetensors https://civitai.com/api/download/models/16075 \ No newline at end of file diff --git a/guofeng-template/relauncher.py b/guofeng-template/relauncher.py new file mode 100644 index 0000000..f4e9bb6 --- /dev/null +++ b/guofeng-template/relauncher.py @@ -0,0 +1,12 @@ +import os, time + +n = 0 +while True: + print('Relauncher: Launching...') + if n > 0: + print(f'\tRelaunch count: {n}') + launch_string = "/workspace/stable-diffusion-webui/webui.sh -f" + os.system(launch_string) + print('Relauncher: Process is ending. Relaunching in 2s...') + n += 1 + time.sleep(2) \ No newline at end of file diff --git a/guofeng-template/start.sh b/guofeng-template/start.sh new file mode 100644 index 0000000..3f918d5 --- /dev/null +++ b/guofeng-template/start.sh @@ -0,0 +1,32 @@ +#!/bin/bash +echo "Container Started" +export PYTHONUNBUFFERED=1 +source /workspace/stable-diffusion-webui/venv/bin/activate +cd /workspace/stable-diffusion-webui +python relauncher.py & + +if [[ $PUBLIC_KEY ]] +then + mkdir -p ~/.ssh + chmod 700 ~/.ssh + cd ~/.ssh + echo $PUBLIC_KEY >> authorized_keys + chmod 700 -R ~/.ssh + cd / + service ssh start + echo "SSH Service Started" +fi + +if [[ $JUPYTER_PASSWORD ]] +then + ln -sf /examples /workspace + ln -sf /root/welcome.ipynb /workspace + + cd / + jupyter lab --allow-root --no-browser --port=8888 --ip=* \ + --ServerApp.terminado_settings='{"shell_command":["/bin/bash"]}' \ + --ServerApp.token=$JUPYTER_PASSWORD --ServerApp.allow_origin=* --ServerApp.preferred_dir=/workspace + echo "Jupyter Lab Started" +fi + +sleep infinity \ No newline at end of file diff --git a/guofeng-template/webui-user.sh b/guofeng-template/webui-user.sh new file mode 100644 index 0000000..132d8ae --- /dev/null +++ b/guofeng-template/webui-user.sh @@ -0,0 +1,47 @@ + +# #!/bin/bash +######################################################### +# Uncomment and change the variables below to your need:# +######################################################### + +# Install directory without trailing slash +install_dir="/workspace" + +# Name of the subdirectory +#clone_dir="stable-diffusion-webui" + +# Commandline arguments for webui.py, for example: export COMMANDLINE_ARGS="--medvram --opt-split-attention" +export COMMANDLINE_ARGS="--port 3000 --xformers --ckpt /workspace/basemodel.safetensors --listen --enable-insecure-extension-access" + +# python3 executable +#python_cmd="python3" + +# git executable +#export GIT="git" + +# python3 venv without trailing slash (defaults to ${install_dir}/${clone_dir}/venv) +# venv_dir="/workspace/venv" + +# script to launch to start the app +# export LAUNCH_SCRIPT="dummy.py" + +# install command for torch +#export TORCH_COMMAND="pip install torch==1.12.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113" + +# Requirements file to use for stable-diffusion-webui +#export REQS_FILE="requirements_versions.txt" + +# Fixed git repos +#export K_DIFFUSION_PACKAGE="" +#export GFPGAN_PACKAGE="" + +# Fixed git commits +#export STABLE_DIFFUSION_COMMIT_HASH="" +#export TAMING_TRANSFORMERS_COMMIT_HASH="" +#export CODEFORMER_COMMIT_HASH="" +#export BLIP_COMMIT_HASH="" + +# Uncomment to enable accelerated launch +#export ACCELERATE="True" + +########################################### \ No newline at end of file