mirror of https://github.com/vladmandic/automatic
add docker support
Signed-off-by: Vladimir Mandic <mandic00@live.com>pull/3577/head^2
parent
880f6f6c4b
commit
8d50661291
|
|
@ -0,0 +1,26 @@
|
||||||
|
# defaults
|
||||||
|
.history
|
||||||
|
.vscode/
|
||||||
|
/__pycache__
|
||||||
|
/.ruff_cache
|
||||||
|
/cache
|
||||||
|
/cache.json
|
||||||
|
/config.json
|
||||||
|
/extensions/*
|
||||||
|
/html/extensions.json
|
||||||
|
/html/themes.json
|
||||||
|
/metadata.json
|
||||||
|
/node_modules
|
||||||
|
/outputs/*
|
||||||
|
/package-lock.json
|
||||||
|
/params.txt
|
||||||
|
/pnpm-lock.yaml
|
||||||
|
/styles.csv
|
||||||
|
/tmp
|
||||||
|
/ui-config.json
|
||||||
|
/user.css
|
||||||
|
/venv
|
||||||
|
/webui-user.bat
|
||||||
|
/webui-user.sh
|
||||||
|
/*.log.*
|
||||||
|
/*.log
|
||||||
|
|
@ -74,4 +74,3 @@ dist/
|
||||||
!/models/VAE-approx/model.pt
|
!/models/VAE-approx/model.pt
|
||||||
!/models/Reference
|
!/models/Reference
|
||||||
!/models/Reference/**/*
|
!/models/Reference/**/*
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ First, a massive update to docs including new UI top-level **info** tab with acc
|
||||||
- [MiaoshouAI PromptGen v2.0](https://huggingface.co/MiaoshouAI/Florence-2-base-PromptGen-v2.0) VQA captioning
|
- [MiaoshouAI PromptGen v2.0](https://huggingface.co/MiaoshouAI/Florence-2-base-PromptGen-v2.0) VQA captioning
|
||||||
|
|
||||||
**Workflow Improvements**:
|
**Workflow Improvements**:
|
||||||
|
- Native Docker support
|
||||||
- SD3x: ControlNets and all-in-one-safetensors
|
- SD3x: ControlNets and all-in-one-safetensors
|
||||||
- XYZ grid: benchmarking, video creation, etc.
|
- XYZ grid: benchmarking, video creation, etc.
|
||||||
- Enhanced prompt parsing
|
- Enhanced prompt parsing
|
||||||
|
|
@ -74,6 +75,7 @@ And quite a few more improvements and fixes since the last update - for full det
|
||||||
- *note*: enable *bnb* on-the-fly quantization for even bigger gains
|
- *note*: enable *bnb* on-the-fly quantization for even bigger gains
|
||||||
|
|
||||||
- Workflow improvements:
|
- Workflow improvements:
|
||||||
|
- Native Docker support with pre-defined [Dockerfile](https://github.com/vladmandic/automatic/blob/dev/Dockerfile)
|
||||||
- XYZ grid:
|
- XYZ grid:
|
||||||
- optional time benchmark info to individual images
|
- optional time benchmark info to individual images
|
||||||
- optional add params to individual images
|
- optional add params to individual images
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
# SD.Next Dockerfile
|
||||||
|
FROM pytorch/pytorch:2.5.1-cuda12.4-cudnn9-runtime
|
||||||
|
# TBD add org info
|
||||||
|
LABEL org.opencontainers.image.authors="vladmandic"
|
||||||
|
WORKDIR /
|
||||||
|
COPY . .
|
||||||
|
# stop pip and uv from caching
|
||||||
|
ENV PIP_NO_CACHE_DIR=true
|
||||||
|
ENV UV_NO_CACHE=true
|
||||||
|
# disable model hashing for faster startup
|
||||||
|
ENV SD_NOHASHING=true
|
||||||
|
# set data directories
|
||||||
|
ENV SD_DATADIR="/mnt/data"
|
||||||
|
ENV SD_MODELSDIR="/mnt/models"
|
||||||
|
# install dependencies
|
||||||
|
RUN ["apt-get", "-y", "update"]
|
||||||
|
RUN ["apt-get", "-y", "install", "git"]
|
||||||
|
# sdnext will run all necessary pip install ops and then exit
|
||||||
|
RUN ["python", "launch.py", "--debug", "--uv", "--use-cuda", "--log", "sdnext.log", "--test"]
|
||||||
|
# preinstall additional packages to avoid installation during runtime
|
||||||
|
RUN ["uv", "pip", "install", "-r", "requirements-extra.txt"]
|
||||||
|
# actually run sdnext
|
||||||
|
CMD ["python", "launch.py", "--debug", "--skip-all", "--listen", "--quick", "--api-log", "--log", "sdnext.log"]
|
||||||
|
# expose port
|
||||||
|
EXPOSE 7860
|
||||||
|
# TBD add healthcheck function
|
||||||
|
HEALTHCHECK NONE
|
||||||
|
STOPSIGNAL SIGINT
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
const fs = require('fs'); // eslint-disable-line no-undef
|
const fs = require('fs'); // eslint-disable-line no-undef
|
||||||
const process = require('process'); // eslint-disable-line no-undef
|
const process = require('process'); // eslint-disable-line no-undef
|
||||||
|
|
||||||
const sd_url = process.env.SDAPI_URL || 'http://127.0.0.1:7860';
|
const sd_url = process.env.SDAPI_URL || 'http://127.0.0.1:32769';
|
||||||
const sd_username = process.env.SDAPI_USR;
|
const sd_username = process.env.SDAPI_USR;
|
||||||
const sd_password = process.env.SDAPI_PWD;
|
const sd_password = process.env.SDAPI_PWD;
|
||||||
const sd_options = {
|
const sd_options = {
|
||||||
|
|
|
||||||
10
installer.py
10
installer.py
|
|
@ -459,6 +459,8 @@ def check_python(supported_minors=[9, 10, 11, 12], reason=None):
|
||||||
|
|
||||||
# check diffusers version
|
# check diffusers version
|
||||||
def check_diffusers():
|
def check_diffusers():
|
||||||
|
if args.skip_all or args.skip_requirements:
|
||||||
|
return
|
||||||
sha = 'dac623b59f52c58383a39207d5147aa34e0047cd'
|
sha = 'dac623b59f52c58383a39207d5147aa34e0047cd'
|
||||||
pkg = pkg_resources.working_set.by_key.get('diffusers', None)
|
pkg = pkg_resources.working_set.by_key.get('diffusers', None)
|
||||||
minor = int(pkg.version.split('.')[1] if pkg is not None else 0)
|
minor = int(pkg.version.split('.')[1] if pkg is not None else 0)
|
||||||
|
|
@ -474,6 +476,8 @@ def check_diffusers():
|
||||||
|
|
||||||
# check onnx version
|
# check onnx version
|
||||||
def check_onnx():
|
def check_onnx():
|
||||||
|
if args.skip_all or args.skip_requirements:
|
||||||
|
return
|
||||||
if not installed('onnx', quiet=True):
|
if not installed('onnx', quiet=True):
|
||||||
install('onnx', 'onnx', ignore=True)
|
install('onnx', 'onnx', ignore=True)
|
||||||
if not installed('onnxruntime', quiet=True) and not (installed('onnxruntime-gpu', quiet=True) or installed('onnxruntime-openvino', quiet=True) or installed('onnxruntime-training', quiet=True)): # allow either
|
if not installed('onnxruntime', quiet=True) and not (installed('onnxruntime-gpu', quiet=True) or installed('onnxruntime-openvino', quiet=True) or installed('onnxruntime-training', quiet=True)): # allow either
|
||||||
|
|
@ -481,6 +485,8 @@ def check_onnx():
|
||||||
|
|
||||||
|
|
||||||
def check_torchao():
|
def check_torchao():
|
||||||
|
if args.skip_all or args.skip_requirements:
|
||||||
|
return
|
||||||
if installed('torchao', quiet=True):
|
if installed('torchao', quiet=True):
|
||||||
ver = package_version('torchao')
|
ver = package_version('torchao')
|
||||||
if ver != '0.5.0':
|
if ver != '0.5.0':
|
||||||
|
|
@ -492,14 +498,16 @@ def check_torchao():
|
||||||
|
|
||||||
def install_cuda():
|
def install_cuda():
|
||||||
log.info('CUDA: nVidia toolkit detected')
|
log.info('CUDA: nVidia toolkit detected')
|
||||||
|
if not (args.skip_all or args.skip_requirements):
|
||||||
install('onnxruntime-gpu', 'onnxruntime-gpu', ignore=True, quiet=True)
|
install('onnxruntime-gpu', 'onnxruntime-gpu', ignore=True, quiet=True)
|
||||||
# return os.environ.get('TORCH_COMMAND', 'torch torchvision --index-url https://download.pytorch.org/whl/cu124')
|
# return os.environ.get('TORCH_COMMAND', 'torch torchvision --index-url https://download.pytorch.org/whl/cu124')
|
||||||
return os.environ.get('TORCH_COMMAND', 'torch==2.5.1+cu124 torchvision==0.20.1+cu124 --index-url https://download.pytorch.org/whl/cu124')
|
return os.environ.get('TORCH_COMMAND', 'torch==2.5.1+cu124 torchvision==0.20.1+cu124 --index-url https://download.pytorch.org/whl/cu124')
|
||||||
|
|
||||||
|
|
||||||
def install_rocm_zluda():
|
def install_rocm_zluda():
|
||||||
|
if args.skip_all or args.skip_requirements:
|
||||||
|
return
|
||||||
from modules import rocm
|
from modules import rocm
|
||||||
|
|
||||||
if not rocm.is_installed:
|
if not rocm.is_installed:
|
||||||
log.warning('ROCm: could not find ROCm toolkit installed')
|
log.warning('ROCm: could not find ROCm toolkit installed')
|
||||||
log.info('Using CPU-only torch')
|
log.info('Using CPU-only torch')
|
||||||
|
|
|
||||||
|
|
@ -204,13 +204,13 @@ def main():
|
||||||
installer.check_python()
|
installer.check_python()
|
||||||
if args.reset:
|
if args.reset:
|
||||||
installer.git_reset()
|
installer.git_reset()
|
||||||
if args.skip_git:
|
if args.skip_git or args.skip_all:
|
||||||
installer.log.info('Skipping GIT operations')
|
installer.log.info('Skipping GIT operations')
|
||||||
installer.check_version()
|
installer.check_version()
|
||||||
installer.log.info(f'Platform: {installer.print_dict(installer.get_platform())}')
|
installer.log.info(f'Platform: {installer.print_dict(installer.get_platform())}')
|
||||||
installer.check_venv()
|
installer.check_venv()
|
||||||
installer.log.info(f'Args: {sys.argv[1:]}')
|
installer.log.info(f'Args: {sys.argv[1:]}')
|
||||||
if not args.skip_env:
|
if not args.skip_env or args.skip_all:
|
||||||
installer.set_environment()
|
installer.set_environment()
|
||||||
if args.uv:
|
if args.uv:
|
||||||
installer.install("uv", "uv")
|
installer.install("uv", "uv")
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,8 @@ console = Console(log_time=True, log_time_format='%H:%M:%S-%f')
|
||||||
dir_timestamps = {}
|
dir_timestamps = {}
|
||||||
dir_cache = {}
|
dir_cache = {}
|
||||||
max_workers = 8
|
max_workers = 8
|
||||||
|
if os.environ.get("SD_HFCACHEDIR", None) is not None:
|
||||||
|
hfcache_dir = os.environ.get("SD_HFCACHEDIR")
|
||||||
if os.environ.get("HF_HUB_CACHE", None) is not None:
|
if os.environ.get("HF_HUB_CACHE", None) is not None:
|
||||||
hfcache_dir = os.environ.get("HF_HUB_CACHE")
|
hfcache_dir = os.environ.get("HF_HUB_CACHE")
|
||||||
elif os.environ.get("HF_HUB", None) is not None:
|
elif os.environ.get("HF_HUB", None) is not None:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue