Go to file
sungjoonkim aabc199d2b update 2025-10-24 23:05:40 +09:00
.cache Docker: empty directories for docker volumes 2023-06-12 17:02:19 +03:00
.vscode Restructure files 2024-04-03 19:36:02 -04:00
assets Update style 2025-05-26 08:50:23 -04:00
config_files update 2025-10-24 22:56:00 +09:00
dataset update 2025-10-24 22:16:44 +09:00
docs Docs python version uv (#3289) 2025-06-16 07:28:39 -04:00
examples v25.0.0 release (#3138) 2025-03-28 11:00:44 -04:00
kohya_gui Revert "feat: Remember last used folder for file dialogs (#3290)" 2025-06-17 10:07:04 -04:00
localizations Bump crate-ci/typos from 1.18.2 to 1.19.0 (#2189) 2024-04-01 11:20:45 -04:00
models Add support for user managed path config 2024-03-16 20:58:22 -04:00
presets v25.0.0 release (#3138) 2025-03-28 11:00:44 -04:00
sd-scripts@33601e6e2f update 2025-10-24 22:56:00 +09:00
setup Core improvements batch1 (#3294) 2025-06-19 08:07:05 -04:00
test Add pytorch_optimizer.CAME to optimizer list. 2025-03-30 14:44:24 -04:00
tools Cleanup files 2025-05-27 08:47:38 -04:00
.augmentignore Dev pure (#2039) 2024-03-09 09:30:20 -05:00
.dockerignore update 2025-10-24 22:56:00 +09:00
.env chore(docker): Configure TensorBoard port through .env file (#2397) 2024-04-26 19:43:37 -04:00
.gitattributes Address issue 188 2023-04-15 08:52:23 -04:00
.gitignore update 2025-10-24 05:53:37 +09:00
.gitmodules Dev pure (#2039) 2024-03-09 09:30:20 -05:00
.hadolint.yml chore(docker): rewrite Dockerfile 2024-02-18 09:58:59 +08:00
.python-version Update python verstion to 3.11 2025-06-16 07:10:02 -04:00
.release Update release 2025-06-23 08:35:07 -04:00
Dockerfile update 2025-10-24 23:05:40 +09:00
LICENSE.md Add support for new arguments: 2023-01-15 11:05:22 -05:00
README.md update 2025-10-24 22:56:00 +09:00
_typos.toml v25.0.0 release (#3138) 2025-03-28 11:00:44 -04:00
config example.toml v25.0.0 release (#3138) 2025-03-28 11:00:44 -04:00
docker-build.cmd update 2025-10-24 23:05:40 +09:00
docker-compose.yaml v25.0.0 release (#3138) 2025-03-28 11:00:44 -04:00
docker-compose.yml update 2025-10-24 23:05:40 +09:00
epoch와-steps설정.md update 2025-10-23 15:10:47 +09:00
gui-uv.bat Update how uv is installed on windows 2025-05-25 19:16:58 -04:00
gui-uv.sh Add message when --quiet is used 2025-05-26 18:39:36 -04:00
gui.bat Merge branch 'master' into dev 2025-03-28 11:20:53 -04:00
gui.ps1 v25.0.0 release (#3138) 2025-03-28 11:00:44 -04:00
gui.sh It looks like the setup.sh and gui.sh scripts were incorrectly defaulting to ROCm package installation if `rocminfo` was present, even on systems with NVIDIA GPUs. (#3293) 2025-06-18 19:52:40 -04:00
kohya_gui.py v25.0.0 release (#3138) 2025-03-28 11:00:44 -04:00
pyproject.toml Update release 2025-06-23 08:35:07 -04:00
requirements.txt Fix bad commit 2025-06-19 19:53:15 -04:00
requirements_ipex_xpu.txt Update IPEX and ROCm 2025-06-13 20:17:05 +03:00
requirements_linux.txt Fix requirements issues 2025-05-26 21:33:06 -04:00
requirements_linux_ipex.txt Cleanup 2025-06-13 20:31:42 +03:00
requirements_linux_rocm.txt Update IPEX and ROCm 2025-06-13 20:17:05 +03:00
requirements_macos_amd64.txt v25.0.0 release (#3138) 2025-03-28 11:00:44 -04:00
requirements_macos_arm64.txt Apple Silicone Support (This time not on Master) (#3174) 2025-04-19 10:22:53 -04:00
requirements_pytorch_windows.txt Update requirements file for 50X0 support 2025-05-26 07:11:25 -04:00
requirements_runpod.txt v25.0.0 release (#3138) 2025-03-28 11:00:44 -04:00
requirements_windows.txt Update requirements file for 50X0 support 2025-05-26 07:11:25 -04:00
setup-3.10.bat v25.0.0 release (#3138) 2025-03-28 11:00:44 -04:00
setup-runpod.sh Improve setup. Add --headless option 2024-03-12 20:31:22 -04:00
setup.bat Core improvements batch1 (#3294) 2025-06-19 08:07:05 -04:00
setup.ps1 Improve setup. Add --headless option 2024-03-12 20:31:22 -04:00
setup.sh python3.11 support 2025-06-20 07:30:38 -04:00
uv.lock Update release 2025-06-23 08:35:07 -04:00
로컬-설치가이드.md update 2025-10-23 15:10:47 +09:00

README.md

NVIDIA Studio Driver(SDR) : Windows 10/11 → 531.79 / 536.67 등 : 아래서 기종 선택하고 Studio Driver 선택하고 검색 버튼 https://www.nvidia.com/ko-kr/geforce/drivers/ 제일 낮은 버전이 아마 괜찮을 듯 함.

CUDA 12.3 : https://developer.nvidia.com/cuda-12-3-0-download-archive cuDNN v9.5.0 : https://developer.nvidia.com/cudnn-9-5-0-download-archive

cuDNN (예: C:\Program Files\NVIDIA\CUDNN\v9.5 )폴더 안에는 bin, include, lib 폴더가 있습니다. 각 폴더의 내용을 CUDA Toolkit이 설치된 경로 내의 해당 폴더에 복사합니다. 예시: cuDNN/bin을 C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\bin으로 복사합니다.

  1. SDXL 모델 다운로드 SDXL 기본 해상도는 1024x1024 X이며, 다음 모델이 필요합니다: 필수 모델: SDXL Base 모델 (.safetensors 또는 .ckpt) Hugging Face 또는 CivitAI에서 다운로드

권장: VAE 모델 (선택사항이지만 권장) https://huggingface.co/madebyollin/sdxl-vae-fp16-fix SDXL fp16 VAE GitHub: madebyollin/sdxl-vae-fp16-fix 모델을 원하는 폴더에 저장하세요 (예: C:/models/sdxl/)

이 저장소에는 Stable Diffusion용 훈련, 생성 및 유틸리티 스크립트가 포함되어 있습니다.

변경 내역은 페이지 하단으로 이동했습니다.

최신 업데이트: 2025-03-21 (버전 0.9.1)

일본어판 README는 여기

개발 버전은 dev 브랜치에 있습니다. 최신 변경 사항은 dev 브랜치를 확인해 주세요.

FLUX.1 및 SD3/SD3.5 지원은 sd3 브랜치에서 이루어집니다. 해당 모델을 훈련하려면 sd3 브랜치를 사용해 주세요.

더 쉬운 사용법(GUI 및 PowerShell 스크립트 등)을 원하시면 bmaltais가 관리하는 저장소를 방문해 주세요. @bmaltais 님께 감사드립니다!

이 저장소에는 다음 스크립트가 포함되어 있습니다:

  • DreamBooth 훈련 (U-Net 및 텍스트 인코더 포함)
  • 미세 조정 (네이티브 훈련) (U-Net 및 텍스트 인코더 포함)
  • LoRA 훈련
  • 텍스트 역전 훈련
  • 이미지 생성
  • 모델 변환 (1.x 및 2.x, Stable Diffusion ckpt/safetensors 및 Diffusers 지원)

후원사

아래 기업들의 아낌없는 후원에 깊이 감사드립니다:

AiHUB Inc.

프로젝트 후원

이 프로젝트가 도움이 되셨다면 GitHub 후원을 통해 개발을 후원해 주시기 바랍니다. 여러분의 후원에 깊이 감사드립니다!

requirements.txt 파일 안내

이 파일에는 PyTorch 요구 사항이 포함되어 있지 않습니다. PyTorch 버전은 환경에 따라 달라지므로 별도로 관리됩니다. 먼저 환경에 맞는 PyTorch를 설치해 주세요. 설치 방법은 아래를 참고하세요.

스크립트는 PyTorch 2.1.2로 테스트되었습니다. PyTorch 2.2 이상도 작동합니다. 적절한 버전의 PyTorch와 xformers를 설치해 주세요.

사용법 문서 링크

대부분의 문서는 일본어로 작성되었습니다.

darkstorm2150님의 영어 번역본은 여기에서 확인하실 수 있습니다. darkstorm2150님께 감사드립니다!

Windows Required Dependencies

Windows 필수 종속성

Python 3.10.6 및 Git:

Python 3.10.x, 3.11.x, 3.12.x도 작동하지만 테스트되지 않았습니다.

venv가 작동하도록 PowerShell에 제한 없는 스크립트 실행 권한 부여:

  • 관리자 권한 PowerShell 창 열기
  • Set-ExecutionPolicy Unrestricted 입력 후 A 선택
  • 관리자 권한 PowerShell 창 닫기

Windows 설치

일반 PowerShell 터미널을 열고 다음 명령어를 입력하세요:

git clone https://github.com/kohya-ss/sd-scripts.git
cd sd-scripts

python -m venv venv
.\venv\Scripts\activate

pip install torch==2.1.2 torchvision==0.16.2 --index-url https://download.pytorch.org/whl/cu118
pip install --upgrade -r requirements.txt
pip install xformers==0.0.23.post1 --index-url https://download.pytorch.org/whl/cu118

accelerate config

python -m venv 명령어 실행 시 python만 표시된다면, pythonpy로 변경하십시오.

참고: 현재 bitsandbytes==0.44.0, prodigyopt==1.0lion-pytorch==0.0.6이 requirements.txt에 포함되어 있습니다. 다른 버전을 사용하려면 수동으로 설치하십시오.

이 설치는 CUDA 11.8용입니다. 다른 버전의 CUDA를 사용하는 경우, 해당 버전의 PyTorch와 xformers를 설치하십시오. 예를 들어, CUDA 12를 사용하는 경우 pip install torch==2.1.2 torchvision==0.16.2 --index-url https://download.pytorch.org/whl/cu121pip install xformers==0.0.23.post1 --index-url https://download.pytorch.org/whl/cu121를 실행하십시오.

PyTorch 2.2 이상을 사용하는 경우 torch==2.1.2, torchvision==0.16.2, xformers==0.0.23.post1을 적절한 버전으로 변경하십시오.

accelerate config에 대한 답변:

- This machine
- No distributed training
- NO
- NO
- NO
- all
- fp16

bf16을 사용하려면 마지막 질문에 bf16이라고 답변해 주세요.

참고: 일부 사용자가 훈련 중 ValueError: fp16 혼합 정밀도는 GPU가 필요합니다 오류가 발생한다고 보고했습니다. 이 경우, 여섯 번째 질문에 0을 입력하세요: 이 머신에서 훈련에 사용할 GPU(ID 기준)를 쉼표로 구분된 목록으로 입력하세요? [all]:

(ID 0의 단일 GPU가 사용됩니다.)

업그레이드

새 버전이 출시되면 다음 명령어로 저장소를 업그레이드할 수 있습니다:

cd sd-scripts
git pull
.\venv\Scripts\activate
pip install --use-pep517 --upgrade -r requirements.txt

명령어가 성공적으로 완료되면 새 버전을 사용할 준비가 된 것입니다.

PyTorch 업그레이드

PyTorch를 업그레이드하려면 Windows 설치 섹션의 pip install 명령어로 업그레이드할 수 있습니다. PyTorch를 업그레이드할 때 xformers도 함께 업그레이드해야 합니다.

크레딧

LoRA 구현은 cloneofsimo의 저장소를 기반으로 합니다. 훌륭한 작업에 감사드립니다!

Conv2d 3x3에 대한 LoRA 확장은 cloneofsimo에 의해 처음 공개되었으며, 그 효과는 KohakuBlueleaf에 의해 LoCon에서 입증되었습니다. KohakuBlueleaf님께 진심으로 감사드립니다!

라이선스

대부분의 스크립트는 ASL 2.0 라이선스 하에 배포됩니다(Diffusers, cloneofsimo 및 LoCon의 코드 포함). 다만 프로젝트의 일부 구성 요소는 별도의 라이선스 조건이 적용됩니다:

Memory Efficient Attention Pytorch: MIT

bitsandbytes: MIT

BLIP: BSD-3-Clause

Change History

Mar 21, 2025 / 2025-03-21 Version 0.9.1

  • Fixed a bug where some of LoRA modules for CLIP Text Encoder were not trained. Thank you Nekotekina for PR #1964
    • The LoRA modules for CLIP Text Encoder are now 264 modules, which is the same as before. Only 88 modules were trained in the previous version.

Jan 17, 2025 / 2025-01-17 Version 0.9.0

  • important The dependent libraries are updated. Please see Upgrade and update the libraries.

    • bitsandbytes, transformers, accelerate and huggingface_hub are updated.
    • If you encounter any issues, please report them.
  • The dev branch is merged into main. The documentation is delayed, and I apologize for that. I will gradually improve it.

  • The state just before the merge is released as Version 0.8.8, so please use it if you encounter any issues.

  • The following changes are included.

변경 사항

추가 정보

LoRA 명명 규칙

train_network.py에서 지원하는 LoRA의 명칭을 혼동을 피하기 위해 변경하였습니다. 관련 문서도 업데이트되었습니다. 본 저장소에서 사용하는 LoRA 유형의 명칭은 다음과 같습니다.

  1. LoRA-LierLa : (LoRA for Li n e a r La yers)

    LoRA for Linear layers and Conv2d layers with 1x1 kernel

  2. LoRA-C3Lier : (LoRA for C olutional layers with 3 x3 Kernel and Li n e a r layers)

    In addition to 1., LoRA for Conv2d layers with 3x3 kernel

LoRA-LierLa는 train_network.py의 기본 LoRA 유형입니다(네트워크 인자 conv_dim 제외).

훈련 중 샘플 이미지 생성

예를 들어 프롬프트 파일은 다음과 같을 수 있습니다

# prompt 1
masterpiece, best quality, (1girl), in white shirts, upper body, looking at viewer, simple background --n low quality, worst quality, bad anatomy,bad composition, poor, low effort --w 768 --h 768 --d 1 --l 7.5 --s 28

# prompt 2
masterpiece, best quality, 1boy, in business suit, standing at street, looking back --n (low quality, worst quality), bad anatomy,bad composition, poor, low effort --w 576 --h 832 --d 2 --l 5.5 --s 40

#로 시작하는 줄은 주석입니다. 프롬프트 뒤에 --n과 같은 옵션을 사용하여 생성된 이미지의 옵션을 지정할 수 있습니다. 다음을 사용할 수 있습니다.

  • --n 다음 옵션까지 프롬프트를 음수로 지정합니다.
  • --w 생성된 이미지의 너비를 지정합니다.
  • --h 생성된 이미지의 높이를 지정합니다.
  • --d 생성된 이미지의 시드(seed)를 지정합니다.
  • --l 생성된 이미지의 CFG 스케일을 지정합니다.
  • --s 생성 과정의 단계 수를 지정합니다.

( )[ ]와 같은 프롬프트 가중치 기능이 작동합니다.