Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
6dab485
Make opencv-python an optional dependency (Windows on ARM64 / RTX Spa…
kohya-ss Sep 22, 2026
439836f
Bump transformers/schedulefree/safetensors for Windows on ARM64 wheel…
kohya-ss Sep 22, 2026
79d77e6
Sync requirements-no-opencv.txt with the dependency bumps from #2431
kohya-ss Sep 22, 2026
a6a8046
Merge pull request #2432 from kohya-ss/fix-sync-requirements-no-opencv
kohya-ss Sep 22, 2026
2f74afa
Merge requirements-no-opencv.txt into requirements.txt with environme…
kohya-ss Sep 22, 2026
ef6b366
Fill in the PR number in the README change history
kohya-ss Sep 22, 2026
d43b69b
Merge pull request #2433 from kohya-ss/feat-arm64-requirements-markers
kohya-ss Sep 22, 2026
bbf63c6
Add local-only regression harness for dependency upgrades (tests/local)
kohya-ss Sep 22, 2026
29ab494
Let --models run entries with enabled = false, show them in list
kohya-ss Sep 22, 2026
7ae6920
Fix tokenizer sources that are no longer accessible on the Hugging Fa…
kohya-ss Sep 22, 2026
58e5c9f
Merge pull request #2435 from kohya-ss/fix-hub-tokenizer-sources
kohya-ss Sep 22, 2026
0b766dd
Merge branch 'dev' into feat-local-regression-harness
kohya-ss Sep 22, 2026
132ad4a
Fix byT5 loader unpacking, add a quoted-text prompt for the HunyuanIm…
kohya-ss Sep 22, 2026
d33246b
Merge pull request #2434 from kohya-ss/feat-local-regression-harness
kohya-ss Sep 22, 2026
8cddce4
Update transformers to 5.5.4, diffusers to 0.40.0, accelerate to 1.15…
kohya-ss Sep 22, 2026
9aa4fd5
Fill in the PR number in the README change history
kohya-ss Sep 22, 2026
7ad2929
Suppress the spurious "should be kept in float32: []" warning of diff…
kohya-ss Sep 23, 2026
4636bf6
Use a different mojibake example in test_clip_tokenizer (typos CI fla…
kohya-ss Sep 23, 2026
8eeebb1
CI: test with PyTorch 2.6.0 and 2.8.0 instead of 2.4.0 and 2.6.0, fai…
kohya-ss Sep 23, 2026
07007bf
Merge pull request #2436 from kohya-ss/feat-bump-transformers5-diffus…
kohya-ss Sep 23, 2026
3c164fc
Support transformers 5.6+: keep the CLIPTextModel layout and the eage…
kohya-ss Sep 23, 2026
464ebc5
Fill in the PR number in the README change history
kohya-ss Sep 23, 2026
fa356a9
Keep the default (SDPA) T5 attention and bump transformers to 5.17.0
kohya-ss Sep 23, 2026
958ca07
Merge pull request #2437 from kohya-ss/feat-clip-text-model-wrapper
kohya-ss Sep 23, 2026
9fefacb
Fix the dpmsolver / dpmsingle samplers and give a clear error for lms…
kohya-ss Sep 24, 2026
5ef1662
Fill in the PR number in the README change history
kohya-ss Sep 24, 2026
4ae0c12
Merge pull request #2438 from kohya-ss/fix-sampler-schedulers
kohya-ss Sep 24, 2026
a14468c
Remove gen_img_diffusers.py, the old SD1.x / SD2.x image generation s…
kohya-ss Sep 24, 2026
7c33fd4
Fill in the PR number in the README change history
kohya-ss Sep 24, 2026
0205d63
Merge pull request #2439 from kohya-ss/remove-gen-img-diffusers
kohya-ss Sep 24, 2026
5f58a63
docs: Add version 0.12.0 to the change history
kohya-ss Sep 24, 2026
0f41729
docs: Order the 0.12.0 entries by importance and soften the pip insta…
kohya-ss Sep 24, 2026
d02db9a
Merge pull request #2440 from kohya-ss/doc-update-readme-for-release
kohya-ss Sep 24, 2026
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: 7 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
matrix:
os: [ubuntu-latest]
python-version: ["3.10"] # Python versions to test
pytorch-version: ["2.4.0", "2.6.0"] # PyTorch versions to test
pytorch-version: ["2.6.0", "2.8.0"] # PyTorch versions to test (diffusers >= 0.40 requires torch >= 2.6)

steps:
- uses: actions/checkout@v4
Expand All @@ -46,6 +46,12 @@ jobs:
pip install dadaptation==3.2 torch==${{ matrix.pytorch-version }} torchvision pytest==8.3.4
pip install -r requirements.txt

- name: Check that the pinned PyTorch version is still installed
run: |
# If a requirement needs a newer torch, pip silently upgrades torch and leaves torchvision behind,
# which breaks every import ("operator torchvision::nms does not exist"). Fail loudly instead.
python -c "import torch, torchvision; print(torch.__version__, torchvision.__version__); assert torch.__version__.startswith('${{ matrix.pytorch-version }}'), 'torch was upgraded by requirements.txt'"

- name: Test with pytest
run: pytest # See pytest.ini for configuration

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ tests/test_data/
tests/test_output_*/
tests/downloaded_data/
tests/mask_viz/

# local-only regression tests (local model paths, recorded references)
tests/local/models.toml
tests/local/references/
34 changes: 33 additions & 1 deletion README-ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,30 @@ Stable Diffusion等の画像生成モデルの学習、モデルによる画像

### 更新履歴

- **次のリリースに含まれる予定の更新:** 次のリリースに含まれる予定の主な変更点は以下の通りです。リリース前の変更点は予告なく変更される可能性があります。
- **Version 0.12.0 (2026-09-24):**
- Windows on ARM64(NVIDIA RTX Spark PC など)に対応しました。[PR #2430](https://github.com/kohya-ss/sd-scripts/pull/2430)、[PR #2431](https://github.com/kohya-ss/sd-scripts/pull/2431)、[PR #2433](https://github.com/kohya-ss/sd-scripts/pull/2433)
- `opencv-python` がオプションになり(未インストール時は Pillow/NumPy による代替実装を使用)、`requirements.txt` が Windows ARM64 用 wheel のあるパッケージを自動的に選択するようになりました。詳細は[OpenCVなしでのインストール/Windows on ARM64について](#opencvなしでのインストールwindows-on-arm64について)をご覧ください。
- `requirements.txt` の `transformers`、`schedulefree`、`safetensors` を Windows ARM64 用 wheel が提供されているバージョンに更新しました。
- `requirements.txt` の依存関係を更新しました: `transformers` 4.57.6 → 5.5.4、`diffusers` 0.32.1 → 0.40.0、`accelerate` 1.6.0 → 1.15.0、`huggingface-hub` 0.34.3 → 1.32.0。[PR #2436](https://github.com/kohya-ss/sd-scripts/pull/2436)
- 主にセキュリティ上の保守のための更新です(`transformers` 4.x 系と `diffusers` 0.38 未満には修正が提供されなくなっています)。以前のバージョンのライブラリでもこのリリースは動作しますので、すぐに更新する必要はありませんが、なるべく早めに `pip install --upgrade -r requirements.txt` を実行することをお勧めします。
- `diffusers` 0.40 は PyTorch 2.6 以降を必要とします(sd-scripts はすでに PyTorch 2.6.0 以降を必要としています)。CI は PyTorch 2.6.0 と 2.8.0 でテストするようになりました。
- `transformers` 5.x の `CLIPTokenizer` は、オリジナルの CLIP トークナイザが行っていた `ftfy` によるテキスト正規化(曲がった引用符の直線化、全角文字の半角化など)を行わなくなりました。sd-scripts 側で同じ正規化を行うようにしたため、トークナイズ結果は従来と変わりません。
- `tests/local` のローカル回帰テストにより、Text Encoder の出力、VAE の出力、ノイズスケジューラが従来のバージョンと同一であることを確認しています。
- `diffusers` 0.40 は `.to(dtype)` のたびに "There are modules in AutoencoderKL that should be kept in float32: [] ..." という誤った警告を出します(リストが空でも警告する diffusers 側のバグ)。sd-scripts ではリストが空の場合にこの警告を抑制しています。
- `transformers` 5.6 以降に対応し、`requirements.txt` の `transformers` を 5.17.0 に更新しました。[PR #2437](https://github.com/kohya-ss/sd-scripts/pull/2437)
- `transformers` 5.6 で `CLIPTextModel` の内部構造が変わりました(`text_model` サブモジュールが無くなりました)。sd-scripts ではモデルをラップすることで、チェックポイントのキー、Text Encoder の LoRA の重み名(`lora_te_text_model_...`)、`text_encoder.text_model.*` によるアクセスが従来と変わらないようにしています。`transformers` 5.6 未満ではラップは行われず、何も変わりません。
- また `transformers` 5.6 では T5(FLUX.1 / SD3 の T5-XXL、HunyuanImage の byT5)の attention の実装が SDPA に切り替わり、高速化・省メモリ化が期待できます。T5 の bf16/fp16 出力は従来のバージョンからごくわずかに変わります(T5-XXL でコサイン類似度 ≈ 0.998、fp32 に対する精度は同等)。生成画像や学習結果の細部が変わる可能性がありますが、以前のバージョンでキャッシュした Text Encoder 出力もそのまま使えます。他の Text Encoder の出力は同一です。
- 上記と同様に、以前のバージョンの `transformers` でも動作しますが、`pip install --upgrade -r requirements.txt` での更新をお勧めします。
- SD1.x / SD2.x / SDXL の学習向けに、OFTv2 と BOFT のネットワークモジュール(`networks.oft_v2`、`networks.boft`)を追加しました。[PR #2357](https://github.com/kohya-ss/sd-scripts/pull/2357)
- PEFT の実装に準拠した直交変換系のアダプタです。PEFT 形式の重みも読み込めます。umisetokikaze 氏に感謝します。
- これらのモジュールでは `--network_dim` はブロックサイズを意味します。詳細は[ドキュメント](./docs/train_network_oft_boft.md)をご覧ください。
- FLUX.1 および Anima の LoRA 学習で、サブセットごとの timestep sampling offset(`custom_attributes.timestep_sampling.offset`)を追加しました。[PR #2401](https://github.com/kohya-ss/sd-scripts/pull/2401) okdsf 氏に感謝します。
- データセットのサブセットごとに、timestep のサンプリング分布を低ノイズ側または高ノイズ側へ偏らせることができます。詳細は[ドキュメント](./docs/timestep_sampling_offset.md)をご覧ください。
- `--show_timesteps` 使用時に offset を適用した timestep の分布を確認できる `--show_timesteps_offset` を追加しました。[PR #2410](https://github.com/kohya-ss/sd-scripts/pull/2410)
- `shift` / `flux_shift` の timestep sampling における offset の挙動もドキュメントに記載しました。
- SD1.x / SD2.x 用の古い画像生成スクリプト `gen_img_diffusers.py` を削除しました。しばらく前から動作しておらず(リファクタリングで削除された関数に依存していました)、実験的な CLIP / VGG16 guidance を除くすべての機能は `gen_img.py` でサポートされています。代わりに `gen_img.py` をお使いください([gen_img_README-ja.md](./docs/gen_img_README-ja.md) をご覧ください)。ファイルは以前のリリースから取得できます。[PR #2439](https://github.com/kohya-ss/sd-scripts/pull/2439)
- 学習中のサンプル画像生成の `--sample_sampler`、および `gen_img.py` / `sdxl_gen_img.py` の `--sampler` で、`dpmsolver` と `dpmsingle` を指定すると最近のバージョンの `diffusers` でエラーになる問題を修正しました。[PR #2438](https://github.com/kohya-ss/sd-scripts/pull/2438)
- `lms` / `k_lms` サンプラーには `requirements.txt` に含まれない `scipy` パッケージが必要です。`scipy` が未インストールの場合、(最初のサンプル生成時ではなく)起動時に分かりやすいエラーを表示するようにしました。使用する場合は `pip install scipy` を実行してください。

- **Version 0.11.1 (2026-06-16):**
- Anima LoRA/LLLite学習でtorch.compileサポートを追加しました。[PR #2379](https://github.com/kohya-ss/sd-scripts/pull/2379)
Expand Down Expand Up @@ -255,6 +271,22 @@ PyTorchは環境によってバージョンが異なるため、requirements.txt

RTX 50シリーズGPUの場合、PyTorch 2.8.0とCUDA 12.8/12.9を使用してください。`requirements.txt`はこのバージョンでも動作します。

### OpenCVなしでのインストール/Windows on ARM64について

`opencv-python` は `requirements.txt` に含まれていますが、学習・データセット処理パイプラインが利用している OpenCV 機能は限定的です(主に `cv2.resize`、`cv2.cvtColor`、およびデバッグ用の `cv2.imshow`)。`opencv-python` がインストールされていない場合、Pillow と NumPy による軽量な代替実装(`library/_cv2_stub`)が自動的に `cv2` として登録されるため、既存のスクリプトはそのまま動作します。OpenCV の大きなインストールを避けたい場合は、requirements のインストール後にアンインストールしてください:

```bash
pip uninstall opencv-python
```

Windows on ARM64(たとえば NVIDIA RTX Spark PC など)では `opencv-python` のビルド済み wheel が提供されていないため、`requirements.txt` の環境マーカーにより自動的にスキップされます。通常どおり `pip install --upgrade -r requirements.txt` でインストールできます。同じ理由で、このプラットフォームでは `tensorboard` の代わりに `tensorboardX` がインストールされます(TensorBoard 2.x が依存する `grpcio` に Windows ARM64 用 wheel がないため)。`--log_with tensorboard` でのログ出力は `tensorboardX` 経由でそのまま動作します。ログの閲覧は別のマシンの TensorBoard で行ってください。

以下に注意してください:

- OpenCV を含むデフォルトのインストールが推奨される経路です。代替実装は、データセット処理がデフォルトで使う `INTER_AREA` と `INTER_LINEAR` のリサイズを NumPy で OpenCV と同じ計算で再現しているため、学習結果は丸め誤差の範囲で一致しますが、OpenCV より低速です(2400 万画素の画像 1 枚あたり 0.1 秒程度)。`INTER_CUBIC` / `INTER_LANCZOS4` は Pillow を経由するため、わずかに結果が異なります。
- 次のツールは実際の `opencv-python` を必要とし、未インストール時は明確なメッセージで終了します:`tools/canny.py`、`tools/detect_face_rotate.py`、および `gen_img.py` / `sdxl_gen_img.py` の ControlNet `canny` プリプロセッサ。
- データセット確認時の `cv2.imshow` は、OpenCV が無い場合 Pillow 標準のビューア(`PIL.Image.show`)で表示され、`cv2.waitKey` はターミナルでの `input()` 待ちに置き換わります(1枚ずつ確認できます)。

### xformersのインストール(オプション)

xformersをインストールするには、仮想環境を有効にした状態で以下のコマンドを実行してください。
Expand Down
Loading
Loading