200 Ai Ml Applications
title: “AI/ML Application Containerization” tags: [“kb”]
AI/ML Application Containerization
This section details the containerization specifics for AI and Machine Learning applications within the project.
1. Core Principles
- Base Image: Primarily uses
nvidia/cuda:11.7.1-runtime-ubuntu20.04to provide a GPU-enabled Ubuntu environment with CUDA capabilities. - Reproducibility: Application code is typically cloned directly from Git repositories using
git cloneand then explicitly version-pinned withgit reset --hard <commit_hash>. - Dependency Management: Varies between Miniconda and Python’s
virtualenv/pipbased on the application’s requirements.
2. Key AI/ML Applications and Their Dockerfiles
2.1. hlky/stable-diffusion Web UI Variant
- Dockerfile: Specific
Dockerfilevariant for anhlkyfork of the Stable Diffusion web UI. - Environment Management: Leverages Miniconda.
- Features: Includes a textual inversion patch.
- Git Repos:
https://github.com/hlky/stable-diffusion.githttps://github.com/hlky/sd-enable-textual-inversion.git
- Running: Exposes port 7860. Entrypoint:
python3 -u scripts/webui.py. - Model Handling: Includes logic to dynamically link pre-downloaded models from a
/modelsvolume.
2.2. naifu AI Service
- Dockerfile: Defines the Docker image for the
naifuAI service (a FastAPI application). - Environment Management: Uses
virtualenvandpipfor Python dependency management. - Key Files:
requirements.txt: Specifies Python dependencies includingtorch,transformers,fastapi,uvicorn.main.py: The core FastAPI application for image generation, text generation, and tag prediction via API endpoints.
- Git Repo:
https://gitea.cheapassbox.com/acmcarther/naifu.git - Running: Exposes port 6969. Entrypoint:
./run.sh.
2.3. AUTOMATIC1111/stable-diffusion-webui Variant
- Dockerfile: Defines the Docker image for the popular AUTOMATIC1111 Stable Diffusion web UI.
- Dependency Management: Uses
pip. - Included Libraries: Integrates several AI enhancement libraries such as CodeFormer, BLIP, k-diffusion.
- Git Repos:
https://github.com/CompVis/stable-diffusion.githttps://github.com/sczhou/CodeFormer.githttps://github.com/salesforce/BLIP.githttps://github.com/CompVis/taming-transformers.githttps://github.com/crowsonkb/k-diffusion.githttps://github.com/AUTOMATIC1111/stable-diffusion-webui.githttps://github.com/TencentARC/GFPGAN.githttps://github.com/openai/CLIP.git
- Configuration:
config.jsonis copied into the image, detailing output directories, image generation parameters, and post-processing settings. - Running: Exposes port 7860. Entrypoint:
python3 -u ../../webui.py. Requires mountingconfig.jsonand potentially otherdockerhelper scripts.