Skip to content
Merged

v22.6.2 #1995

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
6849546
add gradual latent
kohya-ss Nov 23, 2023
610566f
Update README.md
kohya-ss Nov 23, 2023
2897a89
Merge branch 'dev' into gradual_latent_hires_fix
kohya-ss Nov 26, 2023
298c6c2
fix gradual latent cannot be disabled
kohya-ss Nov 26, 2023
2c50ea0
apply unsharp mask
kohya-ss Nov 27, 2023
29b6fa6
add unsharp mask
kohya-ss Nov 28, 2023
2952bca
fix strength error
kohya-ss Dec 1, 2023
7a4e507
add target_x flag (not sure this impl is correct)
kohya-ss Dec 3, 2023
e8c3a02
Merge branch 'dev' into gradual_latent_hires_fix
kohya-ss Dec 7, 2023
9278031
Merge branch 'dev' into gradual_latent_hires_fix
kohya-ss Dec 11, 2023
07ef03d
fix controlnet to work with gradual latent
kohya-ss Dec 11, 2023
d61ecb2
enable comment in prompt file, record raw prompt to metadata
kohya-ss Dec 11, 2023
da9b34f
Merge branch 'dev' into gradual_latent_hires_fix
kohya-ss Jan 4, 2024
2e4bee6
Log accelerator device
akx Jan 16, 2024
afc3870
Refactor memory cleaning into a single function
akx Jan 16, 2024
478156b
Refactor device determination to function; add MPS fallback
akx Jan 16, 2024
8f6f734
Merge branch 'dev' into gradual_latent_hires_fix
kohya-ss Jan 27, 2024
ccc3a48
Update IPEX Libs
Disty0 Jan 28, 2024
d4b9568
fix broken import in svd_merge_lora script
mgz-dev Jan 28, 2024
988dee0
IPEX torch.tensor FP64 workaround
Disty0 Jan 29, 2024
9d7729c
Merge pull request #1086 from Disty0/dev
kohya-ss Jan 31, 2024
7f948db
Merge pull request #1087 from mgz-dev/fix-imports-on-svd_merge_lora
kohya-ss Jan 31, 2024
2ca4d0c
Merge pull request #1054 from akx/mps
kohya-ss Jan 31, 2024
a6a2b5a
Fix IPEX support and add XPU device to device_utils
Disty0 Jan 31, 2024
9f0f0d5
Merge pull request #1092 from Disty0/dev_device_support
kohya-ss Feb 1, 2024
5cca1fd
add highvram option and do not clear cache in caching latents
kohya-ss Feb 1, 2024
1567ce1
Enable distributed sample image generation on multi-GPU enviroment (#…
DKnight54 Feb 3, 2024
11aced3
simplify multi-GPU sample generation
kohya-ss Feb 3, 2024
2f9a344
fix typo
kohya-ss Feb 3, 2024
6269682
unificaition of gen scripts for SD and SDXL, work in progress
kohya-ss Feb 3, 2024
bf2de56
fix formatting in resize_lora.py
mgz-dev Feb 4, 2024
1492bcb
add --new_conv_rank option
mgz-dev Feb 4, 2024
e793d77
reduce peak VRAM in sample gen
kohya-ss Feb 4, 2024
5f6bf29
Replace print with logger if they are logs (#905)
shirayu Feb 4, 2024
6279b33
fallback to basic logging if rich is not installed
kohya-ss Feb 4, 2024
efd3b58
Add logging arguments and update logging setup
kohya-ss Feb 4, 2024
74fe045
add comment for get_preferred_device
kohya-ss Feb 8, 2024
9b8ea12
update log initialization without rich
kohya-ss Feb 8, 2024
055f02e
add logging args for training scripts
kohya-ss Feb 8, 2024
5d9e287
make rich to output to stderr instead of stdout
kohya-ss Feb 8, 2024
7202596
log to print tag frequencies
kohya-ss Feb 10, 2024
f897d55
Merge pull request #1113 from kohya-ss/dev_multi_gpu_sample_gen
kohya-ss Feb 11, 2024
75ecb04
Merge branch 'dev' into dev_device_support
kohya-ss Feb 11, 2024
e24d960
add clean_memory_on_device and use it from training
kohya-ss Feb 12, 2024
e579648
fix help for highvram arg
kohya-ss Feb 12, 2024
672851e
Merge branch 'dev' into dev_improve_log
kohya-ss Feb 12, 2024
20ae603
Merge branch 'dev' into gradual_latent_hires_fix
kohya-ss Feb 12, 2024
35c6053
Merge pull request #1104 from kohya-ss/dev_improve_log
kohya-ss Feb 12, 2024
98f42d3
Merge branch 'dev' into gradual_latent_hires_fix
kohya-ss Feb 12, 2024
c748719
fix indent
kohya-ss Feb 12, 2024
358ca20
Merge branch 'dev' into dev_device_support
kohya-ss Feb 12, 2024
d3745db
add args for logging
kohya-ss Feb 12, 2024
cbe9c5d
supprt deep shink with regional lora, add prompter module
kohya-ss Feb 12, 2024
41d32c0
Merge pull request #1117 from kohya-ss/gradual_latent_hires_fix
kohya-ss Feb 12, 2024
93bed60
fix to work `--console_log_xxx` options
kohya-ss Feb 12, 2024
71ebcc5
update readme and gradual latent doc
kohya-ss Feb 12, 2024
baa0e97
Merge branch 'dev' into dev_device_support
kohya-ss Feb 17, 2024
42f3318
Merge pull request #1116 from kohya-ss/dev_device_support
kohya-ss Feb 17, 2024
75e4a95
update readme
kohya-ss Feb 17, 2024
d1fb480
format by black
kohya-ss Feb 18, 2024
6a9d9be
Fix lora_network_weights
bmaltais Feb 18, 2024
83bf2e0
chore(docker): rewrite Dockerfile
jim60105 Feb 17, 2024
dc94512
ci(docker): Add docker CI
jim60105 Feb 17, 2024
5dc9db6
Revert "ci(docker): Add docker CI"
jim60105 Feb 17, 2024
8330597
chore(docker): Add EXPOSE ports and change final base image to python…
jim60105 Feb 17, 2024
543d12f
chore(docker): fix dependencies for slim image
jim60105 Feb 17, 2024
d7add28
chore(docker): Add label
jim60105 Feb 18, 2024
a6f1ed2
fix dylora create_modules error
tamlog06 Feb 18, 2024
07116dc
Update options.md
mikeboensel Feb 18, 2024
a63c49c
Update options.md
mikeboensel Feb 18, 2024
5b19748
Update options.md
mikeboensel Feb 18, 2024
39e3a4b
Label clarifications
mikeboensel Feb 18, 2024
f71b3cf
Merge pull request #1978 from mikeboensel/patch-1
bmaltais Feb 18, 2024
7a49955
Merge pull request #1979 from mikeboensel/patch-2
bmaltais Feb 18, 2024
6a6c932
Merge pull request #1980 from mikeboensel/patch-3
bmaltais Feb 18, 2024
78e2df1
Merge pull request #1976 from jim60105/master
bmaltais Feb 18, 2024
2d0ed8e
Merge pull request #1981 from mikeboensel/patch-4
bmaltais Feb 18, 2024
86279c8
Merge branch 'dev' into DyLoRA-xl
kohya-ss Feb 24, 2024
488d187
Merge pull request #1126 from tamlog06/DyLoRA-xl
kohya-ss Feb 24, 2024
f413201
fix to work with cpu_count() == 1 closes #1134
kohya-ss Feb 24, 2024
24092e6
update einops to 0.7.0 #1122
kohya-ss Feb 24, 2024
fb9110b
format by black
kohya-ss Feb 24, 2024
0e70360
Merge branch 'dev' into resize_lora-add-rank-for-conv
kohya-ss Feb 24, 2024
738c397
Merge pull request #1102 from mgz-dev/resize_lora-add-rank-for-conv
kohya-ss Feb 24, 2024
52b3799
fix format, add new conv rank to metadata comment
kohya-ss Feb 24, 2024
8b7c142
some log output to print
kohya-ss Feb 24, 2024
81e8af6
fix ipex init
kohya-ss Feb 24, 2024
a21218b
update readme
kohya-ss Feb 24, 2024
e69d341
Merge pull request #1136 from kohya-ss/dev
kohya-ss Feb 24, 2024
a20c2bd
Merge branch 'main' of https://github.com/kohya-ss/sd-scripts into dev
bmaltais Feb 24, 2024
822d94c
Merge branch 'dev' of https://github.com/bmaltais/kohya_ss into dev
bmaltais Feb 24, 2024
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
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,11 @@ bitsandbytes_windows_deprecated/
dataset/
__pycache__/
venv/
**/.hadolint.yml
**/*.log
**/.git
**/.gitignore
**/.env
**/.github
**/.vscode
**/*.ps1
6 changes: 6 additions & 0 deletions .hadolint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ignored:
- DL3042 # Avoid use of cache directory with pip. Use `pip install --no-cache-dir <package>`
- DL3013 # Pin versions in pip. Instead of `pip install <package>` use `pip install <package>==<version>`
- DL3008 # Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`
- DL4006 # Set the SHELL option -o pipefail before RUN with a pipe in it
- SC2015 # Note that A && B || C is not if-then-else. C may run when A is true.
138 changes: 101 additions & 37 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,54 +1,118 @@
FROM nvcr.io/nvidia/pytorch:23.04-py3 as base
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/London

RUN apt update && apt-get install -y software-properties-common
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
add-apt-repository ppa:deadsnakes/ppa && \
apt update && \
apt-get install -y git curl libgl1 libglib2.0-0 libgoogle-perftools-dev \
python3.10-dev python3.10-tk python3-html5lib python3-apt python3-pip python3.10-distutils && \
rm -rf /var/lib/apt/lists/*
# syntax=docker/dockerfile:1
ARG UID=1000
ARG VERSION=EDGE
ARG RELEASE=0

# Set python 3.10 and cuda 11.8 as default
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 3 && \
update-alternatives --set python3 /usr/bin/python3.10 && \
update-alternatives --set cuda /usr/local/cuda-11.8
FROM python:3.10-slim as build

RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3
# RUN mount cache for multi-arch: https://github.com/docker/buildx/issues/549#issuecomment-1788297892
ARG TARGETARCH
ARG TARGETVARIANT

WORKDIR /app
RUN --mount=type=cache,target=/root/.cache/pip python3 -m pip install wheel

# Todo: Install torch 2.1.0 for cu121 support (only available as nightly as of writing)
## RUN --mount=type=cache,target=/root/.cache/pip python3 -m pip install --pre torch ninja setuptools --extra-index-url https://download.pytorch.org/whl/nightly/cu121
# Install under /root/.local
ENV PIP_USER="true"
ARG PIP_NO_WARN_SCRIPT_LOCATION=0
ARG PIP_ROOT_USER_ACTION="ignore"

# Install build dependencies
RUN apt-get update && apt-get upgrade -y && \
apt-get install -y --no-install-recommends python3-launchpadlib git curl && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Todo: Install xformers nightly for Torch 2.1.0 support
## RUN --mount=type=cache,target=/root/.cache/pip python3 -m pip install -v -U git+https://github.com/facebookresearch/xformers.git@main#egg=xformers
# Install PyTorch and TensorFlow
# 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 \
# Why [and-cuda]: https://github.com/tensorflow/tensorflow/issues/61468#issuecomment-1759462485
tensorflow[and-cuda]==2.14.0 \
ninja \
pip setuptools wheel

# Install requirements
COPY ./requirements.txt ./requirements_linux_docker.txt ./
COPY ./setup/docker_setup.py ./setup.py
RUN --mount=type=cache,target=/root/.cache/pip python3 -m pip install -r ./requirements_linux_docker.txt
RUN --mount=type=cache,target=/root/.cache/pip python3 -m pip install -r ./requirements.txt
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 \
pip install -r requirements_linux_docker.txt -r requirements.txt

# Replace pillow with pillow-simd (Only for x86)
ARG TARGETPLATFORM
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
apt-get update && apt-get install -y --no-install-recommends zlib1g-dev libjpeg62-turbo-dev build-essential && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
pip uninstall -y pillow && \
CC="cc -mavx2" pip install -U --force-reinstall pillow-simd; \
fi

FROM python:3.10-slim as final

# Replace pillow with pillow-simd
RUN --mount=type=cache,target=/root/.cache/pip python3 -m pip uninstall -y pillow && \
CC="cc -mavx2" python3 -m pip install -U --force-reinstall pillow-simd
ARG UID
ARG VERSION
ARG RELEASE

LABEL name="bmaltais/kohya_ss" \
vendor="bmaltais" \
maintainer="bmaltais" \
# Dockerfile source repository
url="https://github.com/bmaltais/kohya_ss" \
version=${VERSION} \
# This should be a number, incremented with each change
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."

# Install runtime dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends libgl1 libglib2.0-0 libjpeg62 libtcl8.6 libtk8.6 libgoogle-perftools-dev dumb-init && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Fix missing libnvinfer7
USER root
RUN ln -s /usr/lib/x86_64-linux-gnu/libnvinfer.so /usr/lib/x86_64-linux-gnu/libnvinfer.so.7 && \
ln -s /usr/lib/x86_64-linux-gnu/libnvinfer_plugin.so /usr/lib/x86_64-linux-gnu/libnvinfer_plugin.so.7

RUN useradd -m -s /bin/bash appuser && \
chown -R appuser: /app
USER appuser
COPY --chown=appuser . .
# Create user
RUN groupadd -g $UID $UID && \
useradd -l -u $UID -g $UID -m -s /bin/sh -N $UID

STOPSIGNAL SIGINT
# 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

# Copy dist and support arbitrary user ids (OpenShift best practice)
COPY --chown=$UID:0 --chmod=775 \
--from=build /root/.local /home/$UID/.local

WORKDIR /app
COPY --chown=$UID:0 --chmod=775 . .

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

ENV PATH="/home/$UID/.local/bin:$PATH"
ENV PYTHONPATH="${PYTHONPATH}:/home/$UID/.local/lib/python3.10/site-packages"
ENV LD_PRELOAD=libtcmalloc.so
ENV PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
ENV PATH="$PATH:/home/appuser/.local/bin"
CMD python3 "./kohya_gui.py" ${CLI_ARGS} --listen 0.0.0.0 --server_port 7860

VOLUME [ "/dataset" ]

# 7860: Kohya GUI
# 6006: TensorBoard
EXPOSE 7860 6006

USER $UID

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"]
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,30 @@ masterpiece, best quality, 1boy, in business suit, standing at street, looking b
## Change History
* 2024/02/17 (v22.6.2)
- Fix issue with Lora Extract GUI
- Fix syntax issue where parameter lora_network_weights is actually called network_weights
- Merge sd-scripts v0.8.4 code update
- Fixed a bug that the VRAM usage without Text Encoder training is larger than before in training scripts for LoRA etc (`train_network.py`, `sdxl_train_network.py`).
- Text Encoders were not moved to CPU.
- Fixed typos. Thanks to akx! [PR #1053](https://github.com/kohya-ss/sd-scripts/pull/1053)
- The log output has been improved. PR [#905](https://github.com/kohya-ss/sd-scripts/pull/905) Thanks to shirayu!
- The log is formatted by default. The `rich` library is required. Please see [Upgrade](#upgrade) and update the library.
- If `rich` is not installed, the log output will be the same as before.
- The following options are available in each training script:
- `--console_log_simple` option can be used to switch to the previous log output.
- `--console_log_level` option can be used to specify the log level. The default is `INFO`.
- `--console_log_file` option can be used to output the log to a file. The default is `None` (output to the console).
- The sample image generation during multi-GPU training is now done with multiple GPUs. PR [#1061](https://github.com/kohya-ss/sd-scripts/pull/1061) Thanks to DKnight54!
- The support for mps devices is improved. PR [#1054](https://github.com/kohya-ss/sd-scripts/pull/1054) Thanks to akx! If mps device exists instead of CUDA, the mps device is used automatically.
- The `--new_conv_rank` option to specify the new rank of Conv2d is added to `networks/resize_lora.py`. PR [#1102](https://github.com/kohya-ss/sd-scripts/pull/1102) Thanks to mgz-dev!
- An option `--highvram` to disable the optimization for environments with little VRAM is added to the training scripts. If you specify it when there is enough VRAM, the operation will be faster.
- Currently, only the cache part of latents is optimized.
- The IPEX support is improved. PR [#1086](https://github.com/kohya-ss/sd-scripts/pull/1086) Thanks to Disty0!
- Fixed a bug that `svd_merge_lora.py` crashes in some cases. PR [#1087](https://github.com/kohya-ss/sd-scripts/pull/1087) Thanks to mgz-dev!
- DyLoRA is fixed to work with SDXL. PR [#1126](https://github.com/kohya-ss/sd-scripts/pull/1126) Thanks to tamlog06!
- The common image generation script `gen_img.py` for SD 1/2 and SDXL is added. The basic functions are the same as the scripts for SD 1/2 and SDXL, but some new features are added.
- External scripts to generate prompts can be supported. It can be called with `--from_module` option. (The documentation will be added later)
- The normalization method after prompt weighting can be specified with `--emb_normalize_mode` option. `original` is the original method, `abs` is the normalization with the average of the absolute values, `none` is no normalization.
- Gradual Latent Hires fix is added to each generation script. See [here](./docs/gen_img_README-ja.md#about-gradual-latent) for details.

* 2024/02/15 (v22.6.1)
- Add support for multi-gpu parameters in the GUI under the "Parameters > Advanced" tab.
Expand Down
4 changes: 2 additions & 2 deletions XTI_hijack.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import torch
from library.ipex_interop import init_ipex

from library.device_utils import init_ipex
init_ipex()

from typing import Union, List, Optional, Dict, Any, Tuple
from diffusers.models.unet_2d_condition import UNet2DConditionOutput

Expand Down
18 changes: 10 additions & 8 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ services:
kohya-ss-gui:
container_name: kohya-ss-gui
image: kohya-ss-gui:latest
user: 1000:0
build:
context: .
args:
- UID=1000
ports:
- 127.0.0.1:3000:3000
- 7860:7860
- 6006:6006
tty: true
Expand All @@ -16,15 +18,15 @@ services:
SAFETENSORS_FAST_GPU: 1
DISPLAY: $DISPLAY
tmpfs:
- /tmp
- /tmp
volumes:
- ./dataset:/dataset
- ./.cache/user:/home/appuser/.cache
- ./.cache/triton:/home/appuser/.triton
- ./.cache/config:/app/appuser/.config
- ./.cache/nv:/home/appuser/.nv
- ./.cache/keras:/home/appuser/.keras
- /tmp/.X11-unix:/tmp/.X11-unix
- ./dataset:/dataset
- ./.cache/user:/home/1000/.cache
- ./.cache/triton:/home/1000/.triton
- ./.cache/nv:/home/1000/.nv
- ./.cache/keras:/home/1000/.keras
- ./.cache/config:/home/1000/.config
deploy:
resources:
reservations:
Expand Down
26 changes: 13 additions & 13 deletions docs/LoRA/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ U-Net is divided into "Down" (left half), "Mid" (bottom) and "Up" (right half).

And it consists of 25 blocks in total: Down12 block, Mid1 block, and Up12 block. The neural net added here is simply called "UNet" in Kohya_ss.

### RoLA Learning Object 2: Text Encoder
### LoRA Learning Object 2: Text Encoder

This isn't the only time LoRA adds neural nets .

Expand Down Expand Up @@ -177,15 +177,15 @@ The default value is 0.0001.

### LR Scheduler:

You can change the learning rate in the middle of learning. A scheduler is a setting for how to change the learning rate.
You can change the learning rate in the middle of learning. A scheduler is a setting for how to change the learning rate. Possible values include:

adafactor: Select this to set the optimizer (described later) to Adafactor . Learn while automatically adjusting the learning rate according to the situation to save VRAM
constant: the learning rate does not change from beginning to end
constant_with_warmup: Start with a learning rate of 0 and gradually increase it toward the set value of Learning rate during warm-up, and use the set value of Learning rate during main learning.
cosine : Gradually decrease the learning rate toward 0 while drawing a wave (cosine curve)
cosine _with_restarts: repeat cosine many times (see also description of LR number of cycles)
linear: Start at the Learning rate setting and decrease linearly towards 0
polynomial: Same behavior as linear, but a bit more complicated to reduce (see also LR power description)
- `adafactor`: Select this to set the optimizer (described later) to Adafactor . Learn while automatically adjusting the learning rate according to the situation to save VRAM
- `constant`: the learning rate does not change from beginning to end
- `constant_with_warmup`: Start with a learning rate of 0 and gradually increase it toward the set value of Learning rate during warm-up, and use the set value of Learning rate during main learning.
- `cosine` : Gradually decrease the learning rate toward 0 while drawing a wave (cosine curve)
- `cosine _with_restarts`: repeat cosine many times (see also description of LR number of cycles)
- `linear`: Start at the Learning rate setting and decrease linearly towards 0
- `polynomial`: Same behavior as linear, but a bit more complicated to reduce (see also LR power description)
Set to constant if you want the learning rate to be fixed at the Learning rate setting.

Default is cosine
Expand All @@ -204,13 +204,13 @@ Default is 10.

### Optimizer

The optimizer is a setting for "how to update the neural net weights during training ". Various methods have been proposed for smart learning, but the most commonly used in LoRA learning is ``AdamW'' (32-bit) or ``AdamW8bit''. AdamW8bit uses less VRAM and has enough accuracy, so if you get lost, use this.
The optimizer is a setting for "how to update the neural net weights during training ". Various methods have been proposed for smart learning, but the most commonly used in LoRA learning is "AdamW" (32-bit) or "AdamW8bit". AdamW8bit uses less VRAM and has enough accuracy, so if you get lost, use this.

In addition, "Adafactor", which adjusts the learning rate appropriately according to the progress of learning while incorporating Adam's method, is also often used (Learning rate setting is ignored when using Adafactor).

``DAdapt'' is an optimizer that adjusts the learning rate , and ``Lion'' is a relatively new optimizer , but it has not been fully verified yet. There is a report that "SGDNesterov" has good learning accuracy but slows down.
"DAdapt" is an optimizer that adjusts the learning rate, and "Lion" is a relatively new optimizer , but it has not been fully verified yet. There is a report that "SGDNesterov" has good learning accuracy but slows down.

The default is AdamW8bit. There is no problem basically as it is.
The default is "AdamW8bit". There is no problem basically as it is.

### Optimizer extra arguments

Expand Down Expand Up @@ -785,4 +785,4 @@ Here are some commonly used settings:

Default is blank. When the field is blank, the description example is displayed in faint color, so please refer to it.



33 changes: 33 additions & 0 deletions docs/gen_img_README-ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -452,3 +452,36 @@ python gen_img_diffusers.py --ckpt wd-v1-3-full-pruned-half.ckpt

- `--network_show_meta` : 追加ネットワークのメタデータを表示します。


---

# About Gradual Latent

Gradual Latent is a Hires fix that gradually increases the size of the latent. `gen_img.py`, `sdxl_gen_img.py`, and `gen_img_diffusers.py` have the following options.

- `--gradual_latent_timesteps`: Specifies the timestep to start increasing the size of the latent. The default is None, which means Gradual Latent is not used. Please try around 750 at first.
- `--gradual_latent_ratio`: Specifies the initial size of the latent. The default is 0.5, which means it starts with half the default latent size.
- `--gradual_latent_ratio_step`: Specifies the ratio to increase the size of the latent. The default is 0.125, which means the latent size is gradually increased to 0.625, 0.75, 0.875, 1.0.
- `--gradual_latent_ratio_every_n_steps`: Specifies the interval to increase the size of the latent. The default is 3, which means the latent size is increased every 3 steps.

Each option can also be specified with prompt options, `--glt`, `--glr`, `--gls`, `--gle`.

__Please specify `euler_a` for the sampler.__ Because the source code of the sampler is modified. It will not work with other samplers.

It is more effective with SD 1.5. It is quite subtle with SDXL.

# Gradual Latent について

latentのサイズを徐々に大きくしていくHires fixです。`gen_img.py` 、``sdxl_gen_img.py` 、`gen_img_diffusers.py` に以下のオプションが追加されています。

- `--gradual_latent_timesteps` : latentのサイズを大きくし始めるタイムステップを指定します。デフォルトは None で、Gradual Latentを使用しません。750 くらいから始めてみてください。
- `--gradual_latent_ratio` : latentの初期サイズを指定します。デフォルトは 0.5 で、デフォルトの latent サイズの半分のサイズから始めます。
- `--gradual_latent_ratio_step`: latentのサイズを大きくする割合を指定します。デフォルトは 0.125 で、latentのサイズを 0.625, 0.75, 0.875, 1.0 と徐々に大きくします。
- `--gradual_latent_ratio_every_n_steps`: latentのサイズを大きくする間隔を指定します。デフォルトは 3 で、3ステップごとに latent のサイズを大きくします。

それぞれのオプションは、プロンプトオプション、`--glt`、`--glr`、`--gls`、`--gle` でも指定できます。

サンプラーに手を加えているため、__サンプラーに `euler_a` を指定してください。__ 他のサンプラーでは動作しません。

SD 1.5 のほうが効果があります。SDXL ではかなり微妙です。

Loading