Skip to content

v25.1.0 #3252

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 322 commits into from
May 25, 2025
Merged

v25.1.0 #3252

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
322 commits
Select commit Hold shift + click to select a range
41d473a
Fix merge issue
bmaltais Aug 9, 2024
fad8634
Update gradio version
bmaltais Aug 9, 2024
067776b
Merge branch 'dev' into sd3
bmaltais Aug 9, 2024
a3fe369
Update to latest flux.1 code
bmaltais Aug 10, 2024
2ce5658
Add Flux.1 Model checkbox and detection
bmaltais Aug 10, 2024
03532bb
Adding LoRA type "Flux1" to dropdown
bmaltais Aug 10, 2024
5c53db4
Added Flux.1 parameters to GUI
bmaltais Aug 10, 2024
6f0a837
Update sd-scripts and requirements
bmaltais Aug 13, 2024
c036fda
Add missing Flux.1 GUI parameters
bmaltais Aug 13, 2024
bbae489
Update to latest sd-scripts sd3 code
bmaltais Aug 15, 2024
2eb677d
Fix issue with cache_text_encoder_outputs
bmaltais Aug 15, 2024
d427934
Update to latest sd-scripts flux1 code
bmaltais Aug 16, 2024
0a49908
Adding new flux.1 options to GUI
bmaltais Aug 16, 2024
d3fe25c
Update to latest sd-scripts version of flux.1
bmaltais Aug 17, 2024
1e5ce98
Adding guidance_scale option
bmaltais Aug 17, 2024
7a3d8fe
Update to latest sd3 flux.1 sd-scripts
bmaltais Aug 18, 2024
647295a
Add dreambooth and finetuning support for flux.1
bmaltais Aug 18, 2024
6d15362
Update README
bmaltais Aug 18, 2024
8df754f
Fix t5xxl path issue in DB
bmaltais Aug 18, 2024
2611de7
add missing fp8_base parameter
bmaltais Aug 18, 2024
3b2c622
Fix issue with guidance scale not being passed as float for values li…
bmaltais Aug 18, 2024
8aa658f
Temporary fir for blockwise_fused_optimizers
bmaltais Aug 18, 2024
67ab8f4
Update to latest sd-scripts Flux.1 code
bmaltais Aug 19, 2024
215a053
Fix blockwise_fused_optimizers typo
bmaltais Aug 19, 2024
f57973f
Add mem_eff_save option to GUI for Flux.1
bmaltais Aug 19, 2024
6e03055
Added support for Flux.1 LoRA Merge
bmaltais Aug 19, 2024
da2d629
Update to latest sd-scripts sd3 branch code
bmaltais Aug 20, 2024
0ee4053
Add diffusers option to flux.1 merge LoRA utility
bmaltais Aug 20, 2024
33937c2
Fix issue with split_mode and train_blocks
bmaltais Aug 21, 2024
c50ecbb
Updating requirements
bmaltais Aug 21, 2024
5668ff0
Add flux_fused_backward_pass to dreambooth and finetuning
bmaltais Aug 21, 2024
1d5e665
Update requirements_linux_docker.txt
eftSharptooth Aug 22, 2024
b31c651
Update to latest sd3 flux code
bmaltais Aug 22, 2024
23ca858
Add extract flux lora GUI
bmaltais Aug 23, 2024
1191a1c
Merge pull request #2728 from eftSharptooth/sd3-flux.1
bmaltais Aug 23, 2024
64f4d43
MErged latest sd3 branch code
bmaltais Aug 24, 2024
d2e0917
Add support for split_qkv
bmaltais Aug 24, 2024
f066bfd
Add missing network argument for split_qkv
bmaltais Aug 24, 2024
b283136
Add timestep_sampling shift support
bmaltais Aug 25, 2024
cf98171
Update to latest sd-scripts flux.1 code
bmaltais Aug 27, 2024
de38d2a
Add support for fp8_base_unet
bmaltais Aug 27, 2024
0fd9c58
Update requirements as per sd-scripts suggestion
bmaltais Aug 27, 2024
cfc79b8
Upgrade to cu124
bmaltais Aug 27, 2024
2d1f78b
Update IPEX and ROCm
Disty0 Aug 28, 2024
a7e132f
Merge pull request #2751 from Disty0/sd3-flux.1
bmaltais Aug 29, 2024
5273bd0
Fix issue with balancing when folder with name already exist
bmaltais Aug 29, 2024
139f2c6
Update sd-scripts
bmaltais Aug 29, 2024
8a524c7
Removed unsupported parameters from flux lora network
bmaltais Aug 31, 2024
94e1d7f
Bump crate-ci/typos from 1.23.6 to 1.24.3
dependabot[bot] Sep 1, 2024
c2c70fc
Update sd-scripts code
bmaltais Sep 1, 2024
dedda58
Adding flux_shift option to timestep_sampling
bmaltais Sep 1, 2024
41afd26
Update sd-scripts release
bmaltais Sep 4, 2024
3b6ed2c
Add support for Train T5-XXL
bmaltais Sep 4, 2024
1b3d71f
Update sd-scripts submodule
bmaltais Sep 5, 2024
a5fb38b
Add support for cpu_offload_checkpointing to GUI
bmaltais Sep 5, 2024
d5b083a
Force t5xxl_max_token_length to be served as an integer
bmaltais Sep 6, 2024
9448c95
Merge branch 'master' into sd3-flux.1
bmaltais Sep 6, 2024
8901c3c
Merge pull request #2765 from bmaltais/dependabot/github_actions/crat…
bmaltais Sep 6, 2024
95ad147
Fix typo for flux_shift
bmaltais Sep 6, 2024
2a09447
Merge branch 'sd3-flux.1' of https://github.com/bmaltais/kohya_ss int…
bmaltais Sep 6, 2024
98ce6f2
Update to latest sd-scripts code
bmaltais Sep 7, 2024
8f6229f
Grouping lora parameters
bmaltais Sep 7, 2024
4bae4fc
Validate if lora type is Flux1 when flux1_checkbox is true
bmaltais Sep 8, 2024
63c1e48
Improve visual sectioning of parameters for lora
bmaltais Sep 8, 2024
968a8f0
Add dark mode styles
wcole3 Sep 11, 2024
7531b36
Missed one color
wcole3 Sep 11, 2024
f365b63
Update sd-scripts and add support for t5xxl LR
bmaltais Sep 11, 2024
3cc33f4
Update transformers and wandb module
bmaltais Sep 11, 2024
7c190ed
Fix issue with new text_encoder_lr parameter syntax
bmaltais Sep 12, 2024
e655ebf
Add support for lr_warmup_steps override
bmaltais Sep 13, 2024
20d7e65
Update lr_warmup_steps code
bmaltais Sep 13, 2024
d8b5723
Merge pull request #2802 from wcole3/dark-mode-styles
bmaltais Sep 13, 2024
0d53ac6
Removing stable-diffusion-1.5 default model
bmaltais Sep 13, 2024
46b57ed
Fix for max_train_steps
bmaltais Sep 13, 2024
f744479
Revert some changes
bmaltais Sep 13, 2024
31c77d6
Preliminary support for Flux1 OFT
bmaltais Sep 14, 2024
c554984
Fix logic typo
bmaltais Sep 14, 2024
6c5c9d4
Update sd-scripts
bmaltais Sep 14, 2024
d24fae1
Add support for Rank for layers
bmaltais Sep 14, 2024
9a37a0e
Update lora_gui.py
iamrohitanshu Sep 16, 2024
f8ddd59
Update dreambooth_gui.py
iamrohitanshu Sep 16, 2024
b8c4de1
Update textual_inversion_gui.py
iamrohitanshu Sep 16, 2024
416ef0e
Add support for Blocks to train
bmaltais Sep 16, 2024
8c11a08
Add missing network parms
bmaltais Sep 16, 2024
e696df2
Fix issue with old_lr_warmup_steps
bmaltais Sep 17, 2024
0ba8ab6
Merge pull request #2829 from iamrohitanshu/sd3-flux.1
bmaltais Sep 17, 2024
74a66d2
Update sd-scripts
bmaltais Sep 17, 2024
cee8636
Add support for ScheduleFree Optimizer Type
bmaltais Sep 17, 2024
06c7512
Update sd-scripts
bmaltais Sep 18, 2024
5f04009
Update requirements_pytorch_windows.txt
wzgrx Sep 23, 2024
1beadeb
Update requirements_pytorch_windows.txt
wzgrx Sep 23, 2024
95bf7ff
Update sd-scripts from origin
bmaltais Sep 28, 2024
28dd25d
Another sd-script update
bmaltais Sep 29, 2024
a28026b
Adding support for blocks_to_swap option to gui
bmaltais Sep 29, 2024
c8f7149
Merge branch 'sd3-flux.1' into master
bmaltais Sep 29, 2024
f92548c
Merge pull request #2848 from wzgrx/master
bmaltais Sep 29, 2024
79a4a3a
Fix xformers install issue
bmaltais Sep 29, 2024
f8cf272
feat(docker): mount models folder as a volume
vvsotnikov Sep 29, 2024
d89f0be
feat(docker): add models folder to .dockerignore
vvsotnikov Sep 29, 2024
34db05e
Add support for AdEMAMix8bit optimizer
bmaltais Sep 29, 2024
7fb2307
Bump crate-ci/typos from 1.23.6 to 1.25.0
dependabot[bot] Oct 1, 2024
36c57c0
Fix typo on README.md
bulieme Oct 1, 2024
1734a01
Merge branch 'sd3-flux.1' into dependabot/github_actions/crate-ci/typ…
bmaltais Oct 3, 2024
e23a269
Merge pull request #2875 from bmaltais/dependabot/github_actions/crat…
bmaltais Oct 3, 2024
3f1d414
Merge pull request #2876 from bulieme/patch-1
bmaltais Oct 3, 2024
54c0bee
Merge pull request #2868 from vvsotnikov/master
bmaltais Oct 3, 2024
b2a58ef
Add new --noverify option to skip requirements validation on startup
bmaltais Oct 5, 2024
7ab6efc
Update startup GUI code
bmaltais Oct 5, 2024
0d27fea
Update setup code
bmaltais Oct 5, 2024
ee3fcc0
Update sd-scripts
bmaltais Oct 5, 2024
52d1cc5
Update sf-scripts
bmaltais Oct 6, 2024
faa3d19
Update Lycoris support
bmaltais Oct 7, 2024
55cd56a
Allow to specify tensorboard host via env var TENSORBOARD_HOST
bmaltais Oct 10, 2024
d992dac
Merge pull request #2893 from bmaltais/2886-why-it-must-betensorboard…
bmaltais Oct 10, 2024
7ae14d5
Update sd-scripts version
bmaltais Oct 12, 2024
09c4fbf
Merge branch 'sd3-flux.1' of https://github.com/bmaltais/kohya_ss int…
bmaltais Oct 12, 2024
6f9df25
Update sd-scripts release
bmaltais Oct 14, 2024
8255372
Update sd-scripts
bmaltais Oct 14, 2024
3c3f1ed
Add --skip_cache_check option to GUI
bmaltais Oct 14, 2024
c258fc1
Fix requirements issue
bmaltais Oct 15, 2024
5e10c38
Add support for LyCORIS LoRA when training Flux.1
bmaltais Oct 17, 2024
b424e53
Pin huggingface-hub version for gradio 5
bmaltais Oct 18, 2024
ee51432
Update sd-scripts
bmaltais Oct 18, 2024
b9fe58c
Add support for --save_last_n_epochs_state
bmaltais Oct 18, 2024
10bc465
Update sd-scripts to version with Differential Output Preservation
bmaltais Oct 20, 2024
d29a546
Increase maximum flux-lora merge strength to 2
b-fission Oct 21, 2024
03e9742
Update to latest sd-scripts
bmaltais Oct 25, 2024
64fd4b2
Merge pull request #2915 from b-fission/flux-mergelora-max-at2
bmaltais Oct 25, 2024
7d6ebcb
Update requirements syntax (for windows)
bmaltais Oct 26, 2024
bf22d7e
Merge branch 'sd3-flux.1' of https://github.com/bmaltais/kohya_ss int…
bmaltais Oct 26, 2024
0d2a976
Update requirements for linux
bmaltais Oct 26, 2024
67f5f7b
Update torch version and validation output
bmaltais Oct 26, 2024
b77da10
Fix typo
bmaltais Oct 26, 2024
bb81cbe
Merge pull request #2927 from bmaltais/2925-resume-for-textual-invers…
bmaltais Oct 26, 2024
599206e
Update README
bmaltais Oct 27, 2024
06c3d65
Fix validation issue on linux
bmaltais Oct 27, 2024
7928f45
Update sd-scripts, improve requirements outputs
bmaltais Oct 27, 2024
de14fac
Update requirements_runpod.txt
bmaltais Oct 27, 2024
ea8de51
Update requirements for onnxruntime-gpu
b-fission Oct 28, 2024
59be944
Update onnxruntime-gpu==1.19.2
bmaltais Oct 28, 2024
c031511
Merge branch 'sd3-flux.1' of https://github.com/bmaltais/kohya_ss int…
bmaltais Oct 28, 2024
b88254c
Merge pull request #2937 from b-fission/sd3-flux.1
bmaltais Oct 28, 2024
695b44a
Update sd-scripts release
bmaltais Oct 30, 2024
021c6f5
Add support for save_last_n_epochs
bmaltais Oct 30, 2024
2e6a69f
Update sd-scripts
bmaltais Nov 1, 2024
fe9066d
Bump crate-ci/typos from 1.23.6 to 1.26.8 (#2940)
dependabot[bot] Nov 2, 2024
7266e97
fix 'cached_download' from 'huggingface_hub' (#2947)
hqnicolas Nov 3, 2024
a35d0cd
Add support for quiet output for linux setup
bmaltais Nov 7, 2024
d634edd
Fix quiet issue
bmaltais Nov 7, 2024
7edcbb0
Update sd-scripts
bmaltais Nov 11, 2024
e198f71
Update sd-scripts with blocks_to_swap support
bmaltais Nov 15, 2024
0d8fe4d
Make blocks_to_swap visible in LoRA tab
bmaltais Nov 16, 2024
b332b1d
Fix blocks_to_swap not properly working
bmaltais Nov 17, 2024
d47e3e6
Update sd-scripts and allow python 3.10 to 3.12
bmaltais Nov 17, 2024
a6f0ff7
Fix issue with max_train_steps
bmaltais Nov 17, 2024
309a9bb
Fix max_train_steps_info error
bmaltais Nov 18, 2024
d0cd9f5
Reverting all changes for max_train_steps
bmaltais Nov 19, 2024
3c264e7
Update sd-scripts
bmaltais Nov 22, 2024
10e6f14
Update sd-scripts
bmaltais Dec 3, 2024
79e5c36
Update to latest sd-scripts
bmaltais Dec 15, 2024
45cfc1d
Add support for RAdamScheduleFree
bmaltais Dec 31, 2024
fce89ad
Add support for huber_scale
bmaltais Dec 31, 2024
7068c7d
Add support for fused_backward_pass for sd3 finetuning
bmaltais Dec 31, 2024
730ed13
Add support for prodigyplus.ProdigyPlusScheduleFree
bmaltais Dec 31, 2024
3eec4c9
SD3 LoRA training MVP
bmaltais Dec 31, 2024
3c860c4
Make blocks_to_swap common
bmaltais Dec 31, 2024
4a741a8
Add support for sd3 lora disable_mmap_load_safetensors
bmaltais Dec 31, 2024
65da590
Add a bunch of missing SD3 parameters
bmaltais Dec 31, 2024
4fd25ce
Fix clip_l issue for missing path
bmaltais Dec 31, 2024
8afcaf8
Fix train_t5xxl issue
bmaltais Dec 31, 2024
a10986a
Fix network_module issue
bmaltais Dec 31, 2024
6299e82
Add uniform to weighting_scheme
bmaltais Dec 31, 2024
1a8f551
Bump crate-ci/typos from 1.23.6 to 1.28.1 (#2996)
dependabot[bot] Dec 31, 2024
e03ffc1
Update README.md (#3031)
ruucm Jan 2, 2025
afd16e9
Bump crate-ci/typos from 1.23.6 to 1.29.0 (#3029)
dependabot[bot] Jan 3, 2025
c521ec6
Start work to migrate from pip to uv
bmaltais Jan 16, 2025
b018959
Update uv config for linux
bmaltais Jan 17, 2025
319b11b
Fix for uv on windows
bmaltais Jan 17, 2025
86fbd8c
Update gui-uv.bat and fix typos
bmaltais Jan 17, 2025
bf14151
Update gui run uv scripts
bmaltais Jan 17, 2025
2e341c3
Update linux gui script
bmaltais Jan 17, 2025
89c92ff
Update detection of uv
bmaltais Jan 17, 2025
e0f5ae1
Update sd-scripts version
bmaltais Jan 26, 2025
5f9a461
Update sd-script
bmaltais Jan 26, 2025
b157249
Update setup.sh (#3054)
CaledoniaProject Jan 26, 2025
78c79e0
Removing wrong folder
bmaltais Jan 26, 2025
836417c
Fix issue with SD3 Lora training blocks_to_swap and fused_backward_pass
bmaltais Feb 24, 2025
954a8c7
Fix dreambooth issue
bmaltais Feb 25, 2025
3f8ae26
Update to lastest sd-scripts code
bmaltais Mar 6, 2025
0c94852
Run on novita (#3119) (#3120)
bmaltais Mar 20, 2025
530156d
Bump crate-ci/typos from 1.23.6 to 1.30.0 (#3101)
dependabot[bot] Mar 28, 2025
e6f93a0
updated prodigyopt to 1.1.2 and removed duplicated row in requirement…
Koronos Mar 28, 2025
781e7e5
fixed names on LR Schedure dropdown (#3064)
Koronos Mar 28, 2025
fbd0e0a
Update to latest sd-scripts version
bmaltais Mar 28, 2025
8fb9001
fixed names on LR Schedure dropdown (#3064)
Koronos Mar 28, 2025
dbde0b2
Merge branch 'sd3-flux.1' into sd3-flux.1-uv
bmaltais Mar 28, 2025
fc9e55a
Update prodigyopt release
bmaltais Mar 28, 2025
c1de483
Remove obsolete kohya_ss submodule reference
bmaltais Mar 28, 2025
b6a4385
Fix issue with bat script
bmaltais Mar 28, 2025
46a9aca
Fix VENV warning
bmaltais Mar 28, 2025
90ec190
Cleanup venv3
bmaltais Mar 28, 2025
bd40864
Fix issue with gradio on new installations
bmaltais Mar 28, 2025
543ad92
Merge branch 'sd3-flux.1' into sd3-flux.1-uv
bmaltais Mar 28, 2025
7ad8dc8
Update uv requirements
bmaltais Mar 28, 2025
b24ba93
Update default .venv in linux scipt
bmaltais Mar 28, 2025
88e4dac
Update sd-scripts release
bmaltais Mar 28, 2025
9b2e01e
Merge branch 'master' into dev
bmaltais Mar 28, 2025
cf645e0
Merge branch 'master' into sd3-flux.1-uv
bmaltais Mar 28, 2025
41e264b
Merge branch 'master' into dev
bmaltais Mar 28, 2025
5a2dc0a
Merge branch 'master' into sd3-flux.1-uv
bmaltais Mar 28, 2025
144b5db
Update requirements
bmaltais Mar 28, 2025
b7b44ba
Merge branch 'sd3-flux.1-uv' into dev
bmaltais Mar 28, 2025
f5c3881
Update README with information about alternative uv based method to r…
bmaltais Mar 28, 2025
6ce4751
Another fix gradio ASGI issue
bmaltais Mar 28, 2025
7b527e3
Update release and README
bmaltais Mar 28, 2025
bb54928
Update installation instructions
bmaltais Mar 29, 2025
dca0aef
Update requirements for uv
bmaltais Mar 29, 2025
955c4bd
Update README
bmaltais Mar 30, 2025
eabfc4f
Fix issue with local variable 'do_not_set_learning_rate' referenced b…
bmaltais Mar 30, 2025
dadcbc5
Merge branch '3147-learning-settings-that-were-available-in-v2417-are…
bmaltais Mar 30, 2025
f2efdcf
Update to latest sd-scripts release
bmaltais Mar 30, 2025
1c7ab4d
Add support for LoRA-GGPO
bmaltais Mar 30, 2025
8f24761
Add pytorch_optimizer.CAME to optimizer list.
bmaltais Mar 30, 2025
e79f041
Fix issue with v_param when SDXL is selected
bmaltais Apr 5, 2025
b4ea70b
Update to latest sd-scripts
bmaltais Apr 6, 2025
9d500d9
Apple Silicone Support (This time not on Master) (#3174)
rgeorgi Apr 19, 2025
0a6ec13
Merge branch 'master' into dev
bmaltais Apr 19, 2025
f4ad0ec
Sync latest sd-scripts
bmaltais Apr 19, 2025
2c06b29
Merge branch 'master' into dev
bmaltais Apr 22, 2025
3ad2a27
Merge branch 'master' into dev
bmaltais Apr 23, 2025
950ee5e
Update sd-scripts
bmaltais May 2, 2025
e69834c
Update CUDA and PyTorch configuration in Dockerfile (#3195)
JoeYang1412 May 3, 2025
b68dcec
Bump crate-ci/typos from 1.31.1 to 1.31.2 (#3208)
dependabot[bot] May 3, 2025
9442940
Update to python 3.11 as version for the gui
bmaltais May 3, 2025
dc78079
Updates for linux support
bmaltais May 3, 2025
35354b1
Update lycoris release
bmaltais May 3, 2025
d8bf6ef
Fix some logic issues in lora handling
bmaltais May 3, 2025
c30249f
Fix logic issues
bmaltais May 3, 2025
e3f7975
Fix issue with library in project
bmaltais May 4, 2025
f28f96b
Docs: Comprehensive README overhaul (#3245)
bmaltais May 24, 2025
44cca1c
build(docker): switch from pip to uv for package management (#3229)
jim60105 May 24, 2025
1121544
Refactor README.md to clarify uv vs pip usage (#3246)
bmaltais May 24, 2025
528de60
Update to latest sd-scripts
bmaltais May 24, 2025
3ed552b
Update scripted installation of uv
bmaltais May 25, 2025
e1a769d
The message is fine as is. (#3250)
bmaltais May 25, 2025
93a06c7
docs: doc uv install method is fine for Docker use (#3247)
jim60105 May 25, 2025
c424740
Feat/add max grad norm dreambooth (#3251)
bmaltais May 25, 2025
f91cee6
Getting ready for v25.1.0 release
bmaltais May 25, 2025
59b4bb6
Removing unneeded file
bmaltais May 25, 2025
451f051
Update kohya_gui/blip2_caption_gui.py
bmaltais May 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/typos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
- uses: actions/checkout@v4

- name: typos-action
uses: crate-ci/[email protected].1
uses: crate-ci/[email protected].2
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.10
3.11
2 changes: 1 addition & 1 deletion .release
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v25.0.3
v25.1.0
144 changes: 88 additions & 56 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,87 +3,116 @@ ARG UID=1000
ARG VERSION=EDGE
ARG RELEASE=0

FROM python:3.10-slim as build
########################################
# Base stage
########################################
FROM docker.io/library/python:3.11-slim-bullseye AS base

# RUN mount cache for multi-arch: https://github.com/docker/buildx/issues/549#issuecomment-1788297892
ARG TARGETARCH
ARG TARGETVARIANT

WORKDIR /tmp

ENV NVIDIA_VISIBLE_DEVICES=all
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility

# Install CUDA partially
# https://docs.nvidia.com/cuda/cuda-installation-guide-linux/#debian
# Installing the complete CUDA Toolkit system-wide usually adds around 8GB to the image size.
# Since most CUDA packages already installed through pip, there's no need to download the entire toolkit.
# Therefore, we opt to install only the essential libraries.
# Here is the package list for your reference: https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64

ADD https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64/cuda-keyring_1.1-1_all.deb /tmp/cuda-keyring_x86_64.deb
RUN --mount=type=cache,id=apt-$TARGETARCH$TARGETVARIANT,sharing=locked,target=/var/cache/apt \
--mount=type=cache,id=aptlists-$TARGETARCH$TARGETVARIANT,sharing=locked,target=/var/lib/apt/lists \
dpkg -i cuda-keyring_x86_64.deb && \
rm -f cuda-keyring_x86_64.deb && \
apt-get update && \
apt-get install -y --no-install-recommends \
# !If you experience any related issues, replace the following line with `cuda-12-4` to obtain the complete CUDA package.
cuda-nvcc-12-4

ENV PATH="/usr/local/cuda/bin${PATH:+:${PATH}}"
ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64
ENV CUDA_VERSION=12.4
ENV NVIDIA_REQUIRE_CUDA=cuda>=12.4
ENV CUDA_HOME=/usr/local/cuda

########################################
# Build stage
########################################
FROM base AS build

# RUN mount cache for multi-arch: https://github.com/docker/buildx/issues/549#issuecomment-1788297892
ARG TARGETARCH
ARG TARGETVARIANT

WORKDIR /app

# Install under /root/.local
ENV PIP_USER="true"
ARG PIP_NO_WARN_SCRIPT_LOCATION=0
ARG PIP_ROOT_USER_ACTION="ignore"
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

ENV UV_PROJECT_ENVIRONMENT=/venv
ENV VIRTUAL_ENV=/venv
ENV UV_LINK_MODE=copy
ENV UV_PYTHON_DOWNLOADS=0
ENV UV_INDEX=https://download.pytorch.org/whl/cu124

# Install build dependencies
RUN --mount=type=cache,id=apt-$TARGETARCH$TARGETVARIANT,sharing=locked,target=/var/cache/apt \
--mount=type=cache,id=aptlists-$TARGETARCH$TARGETVARIANT,sharing=locked,target=/var/lib/apt/lists \
apt-get update && apt-get upgrade -y && \
apt-get install -y --no-install-recommends python3-launchpadlib git curl

# Install PyTorch
# The versions must align and be in sync with the requirements_linux_docker.txt
# hadolint ignore=SC2102
RUN --mount=type=cache,id=pip-$TARGETARCH$TARGETVARIANT,sharing=locked,target=/root/.cache/pip \
pip install -U --extra-index-url https://download.pytorch.org/whl/cu121 --extra-index-url https://pypi.nvidia.com \
torch==2.1.2 torchvision==0.16.2 \
xformers==0.0.23.post1 \
ninja \
pip setuptools wheel

# Install requirements
RUN --mount=type=cache,id=pip-$TARGETARCH$TARGETVARIANT,sharing=locked,target=/root/.cache/pip \
--mount=source=requirements_linux_docker.txt,target=requirements_linux_docker.txt \
--mount=source=requirements.txt,target=requirements.txt \
--mount=source=setup/docker_setup.py,target=setup.py \
--mount=source=sd-scripts,target=sd-scripts,rw \
pip install -r requirements_linux_docker.txt -r requirements.txt
# Install big dependencies separately for layer caching
# !Please note that the version restrictions should be the same as pyproject.toml
# No packages listed should be removed in the next `uv sync` command
# If this happens, please update the version restrictions or update the uv.lock file
RUN --mount=type=cache,id=uv-$TARGETARCH$TARGETVARIANT,sharing=locked,target=/root/.cache/uv \
uv venv --system-site-packages /venv && \
uv pip install --no-deps \
# torch (866.2MiB)
torch==2.5.1+cu124 \
# triton (199.8MiB)
triton==3.1.0 \
# tensorflow (615.0MiB)
tensorflow>=2.16.1 \
# onnxruntime-gpu (215.7MiB)
onnxruntime-gpu==1.19.2
Comment on lines +76 to +83
Copy link
Preview

Copilot AI May 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Inline comments and trailing whitespace on continuation lines may cause Docker parsing issues. Move comments above or split into separate RUN steps.

Suggested change
# torch (866.2MiB)
torch==2.5.1+cu124 \
# triton (199.8MiB)
triton==3.1.0 \
# tensorflow (615.0MiB)
tensorflow>=2.16.1 \
# onnxruntime-gpu (215.7MiB)
onnxruntime-gpu==1.19.2
# torch (866.2MiB)
torch==2.5.1+cu124 \
# triton (199.8MiB)
triton==3.1.0 \
# tensorflow (615.0MiB)
tensorflow>=2.16.1 \
# onnxruntime-gpu (215.7MiB)
onnxruntime-gpu==1.19.2

Copilot uses AI. Check for mistakes.


# Install dependencies
RUN --mount=type=cache,id=uv-$TARGETARCH$TARGETVARIANT,sharing=locked,target=/root/.cache/uv \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=sd-scripts,target=sd-scripts,rw \
uv sync --frozen --no-dev --no-install-project --no-editable

# Replace pillow with pillow-simd (Only for x86)
ARG TARGETPLATFORM
RUN --mount=type=cache,id=apt-$TARGETARCH$TARGETVARIANT,sharing=locked,target=/var/cache/apt \
--mount=type=cache,id=aptlists-$TARGETARCH$TARGETVARIANT,sharing=locked,target=/var/lib/apt/lists \
if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
apt-get update && apt-get install -y --no-install-recommends zlib1g-dev libjpeg62-turbo-dev build-essential && \
pip uninstall -y pillow && \
CC="cc -mavx2" pip install -U --force-reinstall pillow-simd; \
uv pip uninstall pillow && \
CC="cc -mavx2" uv pip install pillow-simd; \
fi

FROM python:3.10-slim as final
########################################
# Final stage
########################################
FROM base AS final

ARG TARGETARCH
ARG TARGETVARIANT

ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility

WORKDIR /tmp

ENV CUDA_VERSION=12.1.1
ENV NV_CUDA_CUDART_VERSION=12.1.105-1
ENV NVIDIA_REQUIRE_CUDA=cuda>=12.1
ENV NV_CUDA_COMPAT_PACKAGE=cuda-compat-12-1

# Install CUDA partially
ADD https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64/cuda-keyring_1.0-1_all.deb .
RUN --mount=type=cache,id=apt-$TARGETARCH$TARGETVARIANT,sharing=locked,target=/var/cache/apt \
--mount=type=cache,id=aptlists-$TARGETARCH$TARGETVARIANT,sharing=locked,target=/var/lib/apt/lists \
dpkg -i cuda-keyring_1.0-1_all.deb && \
rm cuda-keyring_1.0-1_all.deb && \
sed -i 's/^Components: main$/& contrib/' /etc/apt/sources.list.d/debian.sources && \
apt-get update && \
apt-get install -y --no-install-recommends \
# Installing the whole CUDA typically increases the image size by approximately **8GB**.
# To decrease the image size, we opt to install only the necessary libraries.
# Here is the package list for your reference: https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64
# !If you experience any related issues, replace the following line with `cuda-12-1` to obtain the complete CUDA package.
cuda-cudart-12-1=${NV_CUDA_CUDART_VERSION} ${NV_CUDA_COMPAT_PACKAGE} libcusparse-12-1 libnvjitlink-12-1

# Install runtime dependencies
RUN --mount=type=cache,id=apt-$TARGETARCH$TARGETVARIANT,sharing=locked,target=/var/cache/apt \
--mount=type=cache,id=aptlists-$TARGETARCH$TARGETVARIANT,sharing=locked,target=/var/lib/apt/lists \
apt-get update && \
apt-get update && apt-get upgrade -y && \
apt-get install -y --no-install-recommends libgl1 libglib2.0-0 libjpeg62 libtcl8.6 libtk8.6 libgoogle-perftools-dev dumb-init

# Fix missing libnvinfer7
Expand All @@ -98,20 +127,23 @@ RUN groupadd -g $UID $UID && \
# Create directories with correct permissions
RUN install -d -m 775 -o $UID -g 0 /dataset && \
install -d -m 775 -o $UID -g 0 /licenses && \
install -d -m 775 -o $UID -g 0 /app
install -d -m 775 -o $UID -g 0 /app && \
install -d -m 775 -o $UID -g 0 /venv

# Copy licenses (OpenShift Policy)
COPY --link --chmod=775 LICENSE.md /licenses/LICENSE.md

# Copy dependencies and code (and support arbitrary uid for OpenShift best practice)
COPY --link --chown=$UID:0 --chmod=775 --from=build /root/.local /home/$UID/.local
COPY --link --chown=$UID:0 --chmod=775 --from=build /venv /venv
COPY --link --chown=$UID:0 --chmod=775 . /app

ENV PATH="/usr/local/cuda/lib:/usr/local/cuda/lib64:/home/$UID/.local/bin:$PATH"
ENV PYTHONPATH="${PYTHONPATH}:/home/$UID/.local/lib/python3.10/site-packages"
ENV LD_LIBRARY_PATH="/usr/local/cuda/lib:/usr/local/cuda/lib64:${LD_LIBRARY_PATH}"
ENV PATH="/venv/bin${PATH:+:${PATH}}"
ENV PYTHONPATH="/venv/lib/python3.11/site-packages"

ENV LD_LIBRARY_PATH="/venv/lib/python3.11/site-packages/nvidia/cudnn/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}"
ENV LD_PRELOAD=libtcmalloc.so
ENV PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python

# Rich logging
# https://rich.readthedocs.io/en/stable/console.html#interactive-mode
ENV FORCE_COLOR="true"
Expand All @@ -130,7 +162,7 @@ STOPSIGNAL SIGINT

# Use dumb-init as PID 1 to handle signals properly
ENTRYPOINT ["dumb-init", "--"]
CMD ["python3", "kohya_gui.py", "--listen", "0.0.0.0", "--server_port", "7860", "--headless"]
CMD ["python3", "kohya_gui.py", "--listen", "0.0.0.0", "--server_port", "7860", "--headless", "--noverify"]

ARG VERSION
ARG RELEASE
Expand All @@ -144,4 +176,4 @@ LABEL name="bmaltais/kohya_ss" \
release=${RELEASE} \
io.k8s.display-name="kohya_ss" \
summary="Kohya's GUI: This repository provides a Gradio GUI for Kohya's Stable Diffusion trainers(https://github.com/kohya-ss/sd-scripts)." \
description="The GUI allows you to set the training parameters and generate and run the required CLI commands to train the model. This is the docker image for Kohya's GUI. For more information about this tool, please visit the following website: https://github.com/bmaltais/kohya_ss."
description="The GUI allows you to set the training parameters and generate and run the required CLI commands to train the model. This is the docker image for Kohya's GUI. For more information about this tool, please visit the following website: https://github.com/bmaltais/kohya_ss."
Loading
Loading