[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-71077":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":8,"htmlUrl":8,"language":9,"languages":8,"totalLinesOfCode":8,"stars":10,"forks":11,"watchers":12,"openIssues":13,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":15,"stars7d":16,"stars30d":17,"stars90d":14,"forks30d":14,"starsTrendScore":18,"compositeScore":19,"rankGlobal":8,"rankLanguage":8,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":23,"hasPages":21,"topics":24,"createdAt":8,"pushedAt":8,"updatedAt":25,"readmeContent":26,"aiSummary":27,"trendingCount":14,"starSnapshotCount":14,"syncStatus":28,"lastSyncTime":29,"discoverSource":30},71077,"sd-scripts","kohya-ss\u002Fsd-scripts","kohya-ss",null,"Python",7113,1198,55,781,0,10,24,89,30,103.14,"Apache License 2.0",false,"main",true,[],"2026-06-12 04:00:58","# sd-scripts\n\n[English](.\u002FREADME.md) \u002F [日本語](.\u002FREADME-ja.md)\n\n## Table of Contents\n\u003Cdetails>\n\u003Csummary>Click to expand\u003C\u002Fsummary>\n\n- [Introduction](#introduction)\n    - [Supported Models](#supported-models)\n    - [Features](#features)\n    - [Sponsors](#sponsors)\n    - [Support the Project](#support-the-project)\n- [Documentation](#documentation)\n    - [Training Documentation (English and Japanese)](#training-documentation-english-and-japanese)\n    - [Other Documentation (English and Japanese)](#other-documentation-english-and-japanese)\n- [For Developers Using AI Coding Agents](#for-developers-using-ai-coding-agents)\n- [Windows Installation](#windows-installation)\n    - [Windows Required Dependencies](#windows-required-dependencies)\n    - [Installation Steps](#installation-steps)\n    - [About requirements.txt and PyTorch](#about-requirementstxt-and-pytorch)\n    - [xformers installation (optional)](#xformers-installation-optional)\n- [Linux\u002FWSL2 Installation](#linuxwsl2-installation)\n    - [DeepSpeed installation (experimental, Linux or WSL2 only)](#deepspeed-installation-experimental-linux-or-wsl2-only)\n- [Upgrade](#upgrade)\n    - [Upgrade PyTorch](#upgrade-pytorch)\n- [Credits](#credits)\n- [License](#license)\n\n\u003C\u002Fdetails>\n\n## Introduction\n\nThis repository contains training, generation and utility scripts for Stable Diffusion and other image generation models.\n\n### Sponsors\n\nWe are grateful to the following companies for their generous sponsorship:\n\n\u003Ca href=\"https:\u002F\u002Faihub.co.jp\u002Ftop-en\">\n  \u003Cimg src=\".\u002Fimages\u002Flogo_aihub.png\" alt=\"AiHUB Inc.\" title=\"AiHUB Inc.\" height=\"100px\">\n\u003C\u002Fa>\n\n### Support the Project\n\nIf you find this project helpful, please consider supporting its development via [GitHub Sponsors](https:\u002F\u002Fgithub.com\u002Fsponsors\u002Fkohya-ss\u002F). Your support is greatly appreciated!\n\n### Change History\n\n- **Version 0.10.5 (2026-05-08):**\n    - Support for transformers version 5 and later has been added. Thanks to marcus165090-spec for [PR #2315](https:\u002F\u002Fgithub.com\u002Fkohya-ss\u002Fsd-scripts\u002Fpull\u002F2315) (followed by [PR #2316](https:\u002F\u002Fgithub.com\u002Fkohya-ss\u002Fsd-scripts\u002Fpull\u002F2316)).\n        - The `transformers` version in `requirements.txt` remains 4.x, but it also works with 5.x. If you use 5.x for any reason, please also update `diffusers` to the latest version.\n    - Support for ControlNet-LLLite training for Anima has been added. Thanks to [PR #2317](https:\u002F\u002Fgithub.com\u002Fkohya-ss\u002Fsd-scripts\u002Fpull\u002F2317).\n        - For details, please refer to the [documentation](.\u002Fdocs\u002Fanima_train_control_net_lllite.md).\n\n- **Version 0.10.4 (2026-05-07):**\n    - Improved compatibility with Intel GPUs. Thanks to WhitePr for [PR #2307](https:\u002F\u002Fgithub.com\u002Fkohya-ss\u002Fsd-scripts\u002Fpull\u002F2307).\n    - Support for training inpainting models for SD 1.5\u002FSDXL has been added. Thanks to allanoepping for [PR #2309](https:\u002F\u002Fgithub.com\u002Fkohya-ss\u002Fsd-scripts\u002Fpull\u002F2309) (followed by [PR #2318](https:\u002F\u002Fgithub.com\u002Fkohya-ss\u002Fsd-scripts\u002Fpull\u002F2318)).\n        - For details, please refer to the [documentation](.\u002Fdocs\u002Finpainting_training.md).\n\n- **Version 0.10.3 (2026-04-02):**\n    - Stability when training with fp16 on Anima has been further improved. See [PR #2302](https:\u002F\u002Fgithub.com\u002Fkohya-ss\u002Fsd-scripts\u002Fpull\u002F2302) for details. We deeply appreciate those who reported the issue.\n\n- **Version 0.10.2 (2026-03-30):**\n    - LECO training for SD\u002FSDXL is now supported. Many thanks to umisetokikaze for [PR #2285](https:\u002F\u002Fgithub.com\u002Fkohya-ss\u002Fsd-scripts\u002Fpull\u002F2285) and [PR #2294](https:\u002F\u002Fgithub.com\u002Fkohya-ss\u002Fsd-scripts\u002Fpull\u002F2294).\n        - Please refer to the [documentation](.\u002Fdocs\u002Ftrain_leco.md) for details.\n    - `networks\u002Fresize_lora.py` has been updated to use `torch.svd_lowrank`, resulting in a significant speedup. Many thanks to woct0rdho for [PR #2240](https:\u002F\u002Fgithub.com\u002Fkohya-ss\u002Fsd-scripts\u002Fpull\u002F2240) and [PR #2296](https:\u002F\u002Fgithub.com\u002Fkohya-ss\u002Fsd-scripts\u002Fpull\u002F2296).\n        - It is enabled by default. You can specify the number of iterations with the `--svd_lowrank_niter` option (default is 2, more iterations will improve accuracy). Setting it to 0 will revert to the previous method. Please check `--help` for details.\n    - LoKr\u002FLoHa is now supported for SDXL\u002FAnima. See [PR #2275](https:\u002F\u002Fgithub.com\u002Fkohya-ss\u002Fsd-scripts\u002Fpull\u002F2275) for details.\n        - Please refer to the [documentation](.\u002Fdocs\u002Floha_lokr.md) for details.\n    - Multi-resolution datasets (using the same image resized to multiple bucket sizes) are now supported in SD\u002FSDXL training. We also addressed the issue of duplicate images with the same resolution being used in multi-resolution datasets. See [PR #2269](https:\u002F\u002Fgithub.com\u002Fkohya-ss\u002Fsd-scripts\u002Fpull\u002F2269) and [PR #2273](https:\u002F\u002Fgithub.com\u002Fkohya-ss\u002Fsd-scripts\u002Fpull\u002F2273) for details.\n        - Thanks to woct0rdho for the contribution.\n        - Please refer to the [English documentation](.\u002Fdocs\u002Fconfig_README-en.md#behavior-when-there-are-duplicate-subsets) \u002F [Japanese documentation](.\u002Fdocs\u002Fconfig_README-ja.md#重複したサブセットが存在する時の挙動) for details.\n    - Stability when training with fp16 on Anima has been improved. See [PR #2297](https:\u002F\u002Fgithub.com\u002Fkohya-ss\u002Fsd-scripts\u002Fpull\u002F2297) for details. However, it still seems to be unstable in some cases. If you encounter any issues, please let us know the details via Issues.\n    - Other minor bug fixes and improvements were made.\n\n### Supported Models\n\n* **Stable Diffusion 1.x\u002F2.x**\n* **SDXL**\n* **SD3\u002FSD3.5**\n* **FLUX.1**\n* **LUMINA**\n* **HunyuanImage-2.1**\n* **Anima preview**\n\n### Features\n\n* LoRA training\n* Fine-tuning (native training, DreamBooth): except for HunyuanImage-2.1\n* Textual Inversion training: SD\u002FSDXL\n* Inpainting model training: SD1.5 and SDXL\n* Image generation\n* Other utilities such as model conversion, image tagging, LoRA merging, etc.\n\n## Documentation\n\n### Training Documentation (English and Japanese)\n\n* [LoRA Training Overview](.\u002Fdocs\u002Ftrain_network.md)\n* [Dataset config](.\u002Fdocs\u002Fconfig_README-en.md) \u002F [Japanese version](.\u002Fdocs\u002Fconfig_README-ja.md)\n* [Advanced Training](.\u002Fdocs\u002Ftrain_network_advanced.md)\n* [SDXL Training](.\u002Fdocs\u002Fsdxl_train_network.md)\n* [SD3 Training](.\u002Fdocs\u002Fsd3_train_network.md)\n* [FLUX.1 Training](.\u002Fdocs\u002Fflux_train_network.md)\n* [LUMINA Training](.\u002Fdocs\u002Flumina_train_network.md)\n* [HunyuanImage-2.1 Training](.\u002Fdocs\u002Fhunyuan_image_train_network.md)\n* [Fine-tuning](.\u002Fdocs\u002Ffine_tune.md)\n* [Textual Inversion Training](.\u002Fdocs\u002Ftrain_textual_inversion.md)\n* [ControlNet-LLLite Training](.\u002Fdocs\u002Ftrain_lllite_README.md) \u002F [Japanese version](.\u002Fdocs\u002Ftrain_lllite_README-ja.md)\n* [Validation](.\u002Fdocs\u002Fvalidation.md)\n* [Masked Loss Training](.\u002Fdocs\u002Fmasked_loss_README.md) \u002F [Japanese version](.\u002Fdocs\u002Fmasked_loss_README-ja.md)\n* [Inpainting Training](.\u002Fdocs\u002Finpainting_training.md)\n\n### Other Documentation (English and Japanese)\n\n* [Image generation](.\u002Fdocs\u002Fgen_img_README.md) \u002F [Japanese version](.\u002Fdocs\u002Fgen_img_README-ja.md)\n* [Tagging images with WD14 Tagger](.\u002Fdocs\u002Fwd14_tagger_README-en.md) \u002F [Japanese version](.\u002Fdocs\u002Fwd14_tagger_README-ja.md)\n\n## For Developers Using AI Coding Agents\n\nThis repository provides recommended instructions to help AI agents like Claude and Gemini understand our project context and coding standards.\n\nTo use them, you need to opt-in by creating your own configuration file in the project root.\n\n**Quick Setup:**\n\n1.  Create a `CLAUDE.md` and\u002For `GEMINI.md` file in the project root.\n2.  Add the following line to your `CLAUDE.md` to import the repository's recommended prompt:\n\n    ```markdown\n    @.\u002F.ai\u002Fclaude.prompt.md\n    ```\n\n    or for Gemini:\n\n    ```markdown\n    @.\u002F.ai\u002Fgemini.prompt.md\n    ```\n\n3.  You can now add your own personal instructions below the import line (e.g., `Always respond in Japanese.`).\n\nThis approach ensures that you have full control over the instructions given to your agent while benefiting from the shared project context. Your `CLAUDE.md` and `GEMINI.md` are already listed in `.gitignore`, so they won't be committed to the repository.\n\n## Windows Installation\n\n### Windows Required Dependencies\n\nPython 3.10.x and Git:\n\n- Python 3.10.x: Download Windows installer (64-bit) from https:\u002F\u002Fwww.python.org\u002Fdownloads\u002Fwindows\u002F\n- git: Download latest installer from https:\u002F\u002Fgit-scm.com\u002Fdownload\u002Fwin\n\nPython 3.11.x, and 3.12.x will work but not tested.\n\nGive unrestricted script access to powershell so venv can work:\n\n- Open an administrator powershell window\n- Type `Set-ExecutionPolicy Unrestricted` and answer A\n- Close admin powershell window\n\n### Installation Steps\n\nOpen a regular Powershell terminal and type the following inside:\n\n```powershell\ngit clone https:\u002F\u002Fgithub.com\u002Fkohya-ss\u002Fsd-scripts.git\ncd sd-scripts\n\npython -m venv venv\n.\\venv\\Scripts\\activate\n\npip install torch==2.6.0 torchvision==0.21.0 --index-url https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fcu124\npip install --upgrade -r requirements.txt\n\naccelerate config\n```\n\nIf `python -m venv` shows only `python`, change `python` to `py`.\n\nNote: `bitsandbytes`, `prodigyopt` and `lion-pytorch` are included in the requirements.txt. If you'd like to use another version, please install it manually.\n\nThis installation is for CUDA 12.4. If you use a different version of CUDA, please install the appropriate version of PyTorch. For example, if you use CUDA 12.1, please install `pip install torch==2.6.0 torchvision==0.21.0 --index-url https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fcu121`.\n\nAnswers to accelerate config:\n\n```txt\n- This machine\n- No distributed training\n- NO\n- NO\n- NO\n- all\n- fp16\n```\n\nIf you'd like to use bf16, please answer `bf16` to the last question.\n\nNote: Some user reports ``ValueError: fp16 mixed precision requires a GPU`` is occurred in training. In this case, answer `0` for the 6th question: \n``What GPU(s) (by id) should be used for training on this machine as a comma-separated list? [all]:`` \n\n(Single GPU with id `0` will be used.)\n\n## About requirements.txt and PyTorch\n\nThe file does not contain requirements for PyTorch. Because the version of PyTorch depends on the environment, it is not included in the file. Please install PyTorch first according to the environment. See installation instructions below.\n\nThe scripts are tested with PyTorch 2.6.0. PyTorch 2.6.0 or later is required.\n\nFor RTX 50 series GPUs, PyTorch 2.8.0 with CUDA 12.8\u002F12.9 should be used. `requirements.txt` will work with this version.\n\n### xformers installation (optional)\n\nTo install xformers, run the following command in your activated virtual environment:\n\n```bash\npip install xformers --index-url https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fcu124\n```\n\nPlease change the CUDA version in the URL according to your environment if necessary. xformers may not be available for some GPU architectures.\n\n## Linux\u002FWSL2 Installation\n\nLinux or WSL2 installation steps are almost the same as Windows. Just change `venv\\Scripts\\activate` to `source venv\u002Fbin\u002Factivate`.\n\nNote: Please make sure that NVIDIA driver and CUDA toolkit are installed in advance.\n\n### DeepSpeed installation (experimental, Linux or WSL2 only)\n  \nTo install DeepSpeed, run the following command in your activated virtual environment:\n\n```bash\npip install deepspeed==0.16.7 \n```\n\n## Upgrade\n\nWhen a new release comes out you can upgrade your repo with the following command:\n\n```powershell\ncd sd-scripts\ngit pull\n.\\venv\\Scripts\\activate\npip install --use-pep517 --upgrade -r requirements.txt\n```\n\nOnce the commands have completed successfully you should be ready to use the new version.\n\n### Upgrade PyTorch\n\nIf you want to upgrade PyTorch, you can upgrade it with `pip install` command in [Windows Installation](#windows-installation) section.\n\n## Credits\n\nThe implementation for LoRA is based on [cloneofsimo's repo](https:\u002F\u002Fgithub.com\u002Fcloneofsimo\u002Flora). Thank you for great work!\n\nThe LoRA expansion to Conv2d 3x3 was initially released by cloneofsimo and its effectiveness was demonstrated at [LoCon](https:\u002F\u002Fgithub.com\u002FKohakuBlueleaf\u002FLoCon) by KohakuBlueleaf. Thank you so much KohakuBlueleaf!\n\n## License\n\nThe majority of scripts is licensed under ASL 2.0 (including codes from Diffusers, cloneofsimo's and LoCon), however portions of the project are available under separate license terms:\n\n[Memory Efficient Attention Pytorch](https:\u002F\u002Fgithub.com\u002Flucidrains\u002Fmemory-efficient-attention-pytorch): MIT\n\n[bitsandbytes](https:\u002F\u002Fgithub.com\u002FTimDettmers\u002Fbitsandbytes): MIT\n\n[BLIP](https:\u002F\u002Fgithub.com\u002Fsalesforce\u002FBLIP): BSD-3-Clause\n","该项目提供了一套用于Stable Diffusion及其他图像生成模型的训练、生成及实用脚本。核心功能包括支持多种模型训练与生成，以及对最新版transformers和ControlNet-LLLite的支持，同时兼容Intel GPU，增强在不同硬件环境下的适用性。项目采用Python编写，并提供了详尽的英文和日文文档，便于开发者理解和使用。适合需要自定义或改进图像生成模型的研究人员及开发者，特别是在探索特定风格图像生成、模型微调等场景中应用广泛。",2,"2026-06-11 03:35:46","high_star"]