Commit Graph

3385 Commits (remove-unused-use-shell-flag)

Author SHA1 Message Date
google-labs-jules[bot] 4f06ff631f Refactor: Remove unused use_shell flag and related logic
The `use_shell` flag, intended to control the use of `shell=True` in subprocess calls, was not being utilized in the command execution logic. This commit removes the flag and all associated code, including:

- `use_shell` variable initialization and passing in `kohya_gui.py`.
- `use_shell_flag` parameters in tab functions (`dreambooth_gui.py`, `lora_gui.py`, `textual_inversion_gui.py`, `finetune_gui.py`).
- The `--do_not_use_shell` command-line argument.
- The `use_shell` setting in `config example.toml`.
- Mentions of the flag in documentation files.

This change simplifies the codebase by removing dead code and has no impact on functionality as the flag was not effective.
2025-06-25 17:06:41 +00:00
bmaltais 466e0a35cf Update expand_all_accordions to false 2025-06-24 22:27:47 -04:00
bmaltais ed5f0b7bee Fix missing keys 2025-06-24 22:24:53 -04:00
bmaltais 26a79fe7d4 Improve config.toml example 2025-06-24 22:08:35 -04:00
bmaltais cd510b812d
Improve clarity and formatting of config example.toml (#3314)
- Added and updated comments for better understanding of parameters.
- Improved formatting and alignment for readability.
- Corrected misleading comments regarding `cpu_offload_checkpointing` and the purpose of the final `[dataset_preparation]` section.
- Ensured all key names and TOML structure used by the GUI remain unchanged.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2025-06-24 22:00:56 -04:00
bmaltais 7d136b020c
Update config toml (#3312)
* Aligned config.toml with gradio elements

* Align Gradio UI elements with config.toml

Ensured that all relevant Gradio UI elements in Dreambooth, Finetune,
LoRA, and Textual Inversion GUIs, along with their supporting classes,
load their default values from `config.toml`.

- Added missing keys to `config example.toml` for newly configurable elements.
- Modified Python files to use `config.get()` for these elements,
  preserving original default behaviors if keys are not in `config.toml`.
- Corrected minor inconsistencies in existing `config.get()` usage.

* Update alignment

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2025-06-24 21:50:07 -04:00
bmaltais bce66dacaa
Merge pull request #3310 from bmaltais/feat/expand_all_accordions
Expand all accordions option
2025-06-24 20:39:00 -04:00
bmaltais 172a727726 Expand all accordions option 2025-06-24 20:37:32 -04:00
bmaltais 3bb052746f More readme fix 2025-06-24 17:34:38 -04:00
bmaltais 0e1c61c6b7 Update readme 2025-06-24 17:33:04 -04:00
bmaltais 547bf27131 Fix misplaced documentation 2025-06-24 17:29:58 -04:00
bmaltais c999f07816
Merge pull request #3306 from bmaltais/remove-easygui-alternative
Refactor: Remove easygui and replace dialogs with notifications
2025-06-23 09:16:29 -04:00
bmaltais d3e6ebab2e
Merge pull request #3305 from bmaltais/feature/version-from-pyproject
Refactor: Read version from pyproject.toml
2025-06-23 09:07:15 -04:00
google-labs-jules[bot] 3e1cfdac06 Refactor: Read version from pyproject.toml
Centralize version information by reading it from the `[project.version]`
field in `pyproject.toml` instead of the separate `.release` file.

Changes:
- Modified `kohya_gui.py` to use the `toml` library to parse `pyproject.toml`
  and retrieve the version string.
- Added a "v" prefix to the version for display consistency.
- Included a fallback to "vUNKNOWN" if `pyproject.toml` is missing or the
  version cannot be read.
- Deleted the now-unused `.release` file.

Note: Full runtime testing was prevented by an out-of-disk-space error
in the test environment when installing dependencies. The core code change
for version sourcing has been implemented as requested.
2025-06-23 12:54:32 +00:00
bmaltais aa6526d13a Update release 2025-06-23 08:35:07 -04:00
google-labs-jules[bot] 0e82250c52 Refactor: Remove easygui and replace dialogs with notifications
Removed all usage of the `easygui` library.

- Replaced `easygui.msgbox` calls with Gradio notifications (`gr.Info`, `gr.Warning`, `gr.Error`) to display messages and errors directly in the UI.
- Replaced `easygui.ynbox` and `easygui.boolbox` confirmation dialogs with a default action of proceeding with the operation, accompanied by a notification. This affects:
    - Model saving: Will now overwrite existing models by default, notifying the user.
    - Dataset balancing: Enabling 'insecure folder renaming' will proceed without a second confirmation, with a warning displayed.
    - Manual captioning: Importing tags will overwrite existing quick tags by default, with a notification.
- Removed `easygui` from all Python import statements.
- Removed `easygui` from `requirements.txt` and `pyproject.toml`.

Note: The `uv.lock` file has not been modified as part of this commit. It should be regenerated using the `uv` tool to reflect the dependency changes in `pyproject.toml` and `requirements.txt`.
2025-06-23 00:23:36 +00:00
bmaltais b48c86cbff
python3.11 support
The script will now detect and utilize Python 3.11 alongside Python 3.10.

Here are the key changes:
- I added a function to detect the available Python command, prioritizing python3.11, then python3.10, then python3.
- I modified virtual environment creation to use the detected Python version.
- I updated macOS Homebrew installation logic to check for python@3.11 and python-tk@3.11 first.
- I made Python-version-specific paths (e.g., for site-packages and symlinks, especially in Runpod environments) dynamic to adapt to the selected Python version.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2025-06-20 07:30:38 -04:00
bmaltais dcef66a001 Update lock file 2025-06-19 19:54:20 -04:00
bmaltais 6c05e32070 Fix bad commit 2025-06-19 19:53:15 -04:00
bmaltais e9be00a193 Update requirements 2025-06-19 19:52:10 -04:00
bmaltais 23b70c8f16
Core improvements batch1 (#3294)
* Refactor and Improve Core Components

This commit includes several improvements to the core components of the Kohya_ss GUI:

1.  **Refactored `check_torch()` in `setup/setup_common.py`**:
    *   Broke down the function into smaller, more focused functions for better readability and maintainability.
    *   Simplified the logic for detecting different hardware backends (CUDA, ROCm, Intel OneAPI).

2.  **Improved Error Handling in `setup/setup_common.py`**:
    *   Made error messages more user-friendly and informative by providing context and suggestions.
    *   Ensured consistent logging of errors.
    *   Enhanced error reporting for external processes like Git and pip/uv.

3.  **Enhanced Documentation for `config.toml`**:
    *   Updated the "Custom Path Defaults" section in `README.md` with more details on customizing `config.toml`.
    *   Provided clearer examples of common configurations.

4.  **Reviewed and Updated Dependencies**:
    *   Removed several unused dependencies from `pyproject.toml` (`altair`, `fairscale`, `imagesize`, `invisible-watermark`, `pytorch-lightning`, `voluptuous`).
    *   Updated various dependencies to their latest stable and compatible versions.

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2025-06-19 08:07:05 -04:00
bmaltais d85ae6bdb5
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)
I've modified both scripts to check for `nvidia-smi` first. If `nvidia-smi` is found, the scripts will now use the NVIDIA-specific (CUDA) requirements files, regardless of the presence of `rocminfo`. The ROCm check is now a fallback if `nvidia-smi` is not detected.

This should ensure that you get the correct PyTorch build and dependencies if you have an NVIDIA GPU, resolving the issue where ROCm packages were being erroneously selected.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2025-06-18 19:52:40 -04:00
bmaltais 8a81733794 Revert "feat: Remember last used folder for file dialogs (#3290)"
This reverts commit 51d87f5309.
2025-06-17 10:07:04 -04:00
bmaltais 51d87f5309
feat: Remember last used folder for file dialogs (#3290)
* feat: Remember last used folder for file dialogs

This commit introduces a feature to remember the last used folder for various file and folder dialogs within the GUI.

Key changes:

- Modified `KohyaSSGUIConfig` (`kohya_gui/class_gui_config.py`) to store and retrieve a `last_used_folder` value in the `config.toml` file.
- Updated file/folder dialog utility functions in `kohya_gui/common_gui.py` (e.g., `get_folder_path`, `get_file_path`, `get_saveasfilename_path`) to:
    - Accept the `KohyaSSGUIConfig` instance.
    - Use the stored `last_used_folder` as the initial directory for dialogs.
    - Update `last_used_folder` after a successful selection.
- Updated various GUI modules (`class_folders.py`, `wd14_caption_gui.py`, and other captioning utilities) to pass the `KohyaSSGUIConfig` instance to these dialog functions.

This enhancement improves your experience by defaulting file dialogs to the most recently accessed relevant directory, streamlining the workflow for you when you frequently work with specific folders.

* Fix typo

* Fix typos

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2025-06-16 07:39:29 -04:00
bmaltais 060c58a319
Docs python version uv (#3289)
* Docs: Explain .python-version file for uv installs

I've updated the Linux and Windows uv installation guides to explain that you can specify the Python version for the uv environment by editing the .python-version file at the root of the repository.

* Update linux documentation

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2025-06-16 07:28:39 -04:00
bmaltais a06a69030a Ignore .python-version changes 2025-06-16 07:11:31 -04:00
bmaltais 6357ce868b Update python verstion to 3.11 2025-06-16 07:10:02 -04:00
bmaltais ef9c32371f
Merge pull request #3287 from niels-numbers/master
Refactor Installation Docs: Extract per-platform instructions to dedicated .md files (follow-up to #3278)
2025-06-15 18:54:51 -04:00
Dr. Adam Niels Nielsen fbc17f9c82
Merge branch 'bmaltais:master' into master 2025-06-15 23:19:21 +02:00
Adam Nielsen 57ec255a1f docs: extract pip/uv installation guides to OS-specific markdown files and update main README 2025-06-15 23:16:52 +02:00
bmaltais 850c1a9c49
Merge pull request #3285 from bmaltais/dev
v25.2.0
2025-06-15 10:24:56 -04:00
bmaltais 8dfa947c49 Merge branch 'dev' of https://github.com/bmaltais/kohya_ss into dev 2025-06-15 10:23:30 -04:00
bmaltais 451f84d4ae Update release number 2025-06-15 10:23:04 -04:00
bmaltais 6ca6ecd7bd
Merge pull request #3280 from Disty0/dev
Update IPEX and ROCm
2025-06-14 14:04:16 -04:00
Disty0 1538a51e68 Cleanup 2025-06-13 20:31:42 +03:00
Disty0 df35d93289 Update IPEX and ROCm 2025-06-13 20:17:05 +03:00
bmaltais c736aec1f7
Merge pull request #3278 from niels-numbers/master
Improve README installation section for clarity and easier uv-based setup
2025-06-11 21:18:42 -04:00
Adam Nielsen c083029023 Refactor Installation Section for Clarity and Easier uv-Based Setup 2025-06-12 00:30:22 +02:00
bmaltais ed2ef9aa0f
Merge pull request #3274 from bmaltais/add-conda-instructions
Add Conda installation instructions to README
2025-06-05 15:05:28 -04:00
google-labs-jules[bot] 873f571ebb Add Conda installation instructions for Windows to README
This commit updates the README.md file to include Windows-specific
instructions for setting up the project using a Conda environment.

The "Using `conda`" subsection under "Installation Methods" now clarifies:
- `chmod +x` commands are not needed for Windows.
- Windows users should use `setup.bat` and `gui.bat` (or `gui.ps1`)
  instead of the `.sh` scripts.

The Table of Contents was previously updated to include the "Using `conda`"
section.
2025-06-05 19:04:42 +00:00
google-labs-jules[bot] 926625703d Add Conda installation instructions to README
This commit adds a new section to the README.md file detailing how to set up the project using a Conda environment.

The new "Using `conda`" subsection under "Installation Methods" includes:
- Commands to create and activate a Conda environment with Python 3.11.
- Instructions on how to make the setup and GUI scripts executable and how to run them.

The Table of Contents has also been updated to reflect this new section.
2025-06-05 19:00:22 +00:00
bmaltais e23cd3e7a4
Merge pull request #3273 from ThanaritKanjanametawatAU/master
Add support for already activated conda environment setup
2025-06-05 14:56:56 -04:00
bmaltais ffc45e579e Update sd-scripts 2025-06-05 14:29:02 -04:00
Thanarit 271bcb3bd9 Modify the GUI script to check for and handle conda env 2025-06-06 00:33:16 +07:00
Thanarit 46a21899da Add support for already activated conda environment setup 2025-06-06 00:14:22 +07:00
bmaltais 08f2ddcf82
Merge pull request #3266 from jim60105/fix/typo
fix(validate_requirements): correct typo
2025-06-02 19:49:38 -04:00
CHEN, CHUN ae0f3dbf46
fix(validate_requirements): correct typo
- Fixes a typo in the variable name and log message from "reccomended" to the correct "recommended" when logging Apple MPS memory information.

Signed-off-by: CHEN, CHUN <jim60105@gmail.com>
2025-06-02 19:39:03 +08:00
bmaltais 40556e9397
Merge pull request #3265 from bmaltais/fix/default-config-dialog-path
Fix: Default config file dialog to repo root
2025-06-01 13:56:50 -04:00
google-labs-jules[bot] 4ef34d9f5f Fix: Default config file dialog to repo root
Modified the get_file_path function in kohya_gui/common_gui.py
to ensure that when you are opening a configuration file, the
file dialog defaults to the kohya_ss repository root if no
initial path or only a filename is provided.

If a full or relative path is already present in the input field,
the dialog will open in the specified directory as before.

This change improves your experience by starting the file search
in a more relevant location.
2025-06-01 17:54:27 +00:00
google-labs-jules[bot] 69d8b96c1c Feat: Add logging for effective learning rates in LoRA GUI
This commit introduces a helper function, `get_effective_lr_messages`, into `kohya_gui/lora_gui.py` and integrates it into the `train_model` function.

The purpose is to provide you with clearer information about how the learning rates set in the GUI (Main LR, Text Encoder LR, U-Net LR, T5XXL LR) will be interpreted and effectively applied by the underlying `sd-scripts` training engine.

Before training commences, the GUI will now log:
- The Main LR.
- The effective LR for the primary Text Encoder (CLIP), indicating if it's a specific value or a fallback to the Main LR.
- The effective LR for the T5XXL Text Encoder (if applicable), indicating its source (specific, inherited from primary TE, or fallback to Main LR).
- The effective LR for the U-Net, indicating if it's a specific value or a fallback to the Main LR.

This enhances transparency by helping you understand how your LR settings interact, without modifying the `sd-scripts` submodule.
2025-06-01 13:59:07 +00:00