Home

Awesome

<div align="center">

Docker image for Kohya_ss

Docker Pulls Template Version

</div>

Installs

Available on RunPod

This image is designed to work on RunPod. You can use my custom RunPod template to launch it on RunPod.

Building the Docker image

[!NOTE] You will need to edit the docker-bake.hcl file and update REGISTRY_USER, and RELEASE. You can obviously edit the other values too, but these are the most important ones.

# Clone the repo
git clone https://github.com/ashleykleynhans/kohya-docker.git

# Download the models
cd kohya-docker
wget https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors

# Log in to Docker Hub
docker login

# Build the image, tag the image, and push the image to Docker Hub
docker buildx bake -f docker-bake.hcl --push

# Same as above but customize registry/user/release:
REGISTRY=ghcr.io REGISTRY_USER=myuser RELEASE=my-release docker buildx \
    bake -f docker-bake.hcl --push

Running Locally

Install Nvidia CUDA Driver

Start the Docker container

docker run -d \
  --gpus all \
  -v /workspace \
  -p 3000:3001 \
  -p 8000:8000 \
  -p 7777:7777 \
  -p 8888:8888 \
  -p 2999:2999 \
  -e ENABLE_TENSORBOARD=1 \
  ashleykza/kohya:latest

You can obviously substitute the image name and tag with your own.

Ports

Connect PortInternal PortDescription
30003001Kohya_ss
60066066Tensorboard
80008000Application Manager
77777777Code Server
88888888Jupyter Lab
29992999RunPod File Uploader

Environment Variables

VariableDescriptionDefault
JUPYTER_LAB_PASSWORDSet a password for Jupyter labnot set - no password
DISABLE_AUTOLAUNCHDisable Kohya_ss from launching automatically(not set)
DISABLE_SYNCDisable syncing if using a RunPod network volume(not set)
ENABLE_TENSORBOARDEnables Tensorboard on port 6006enabled

Logs

Kohya_ss creates a log file, and you can tail the log instead of killing the service to view the logs.

ApplicationLog file
Kohya_ss/workspace/logs/kohya_ss.log

For example:

tail -f /workspace/logs/kohya_ss.log

Acknowledgements

  1. Bernard Maltais (core developer of Kohya_ss) for assisting with optimizing the Docker image.
  2. Madiator2011 for advice and suggestions on improving these images, as well as all of the code for the code-server which was borrowed from his madiator-docker-runpod GitHub repository.

Community and Contributing

Pull requests and issues on GitHub are welcome. Bug fixes and new features are encouraged.

Appreciate my work?

<a href="https://www.buymeacoffee.com/ashleyk" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>