Skip to content

Commit

Permalink
Merge pull request #2085 from bmaltais/dev
Browse files Browse the repository at this point in the history
v23.0.9
  • Loading branch information
bmaltais committed Mar 13, 2024
2 parents a2206fe + d16be7b commit bc5165d
Show file tree
Hide file tree
Showing 11 changed files with 116 additions and 159 deletions.
2 changes: 1 addition & 1 deletion .release
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v23.0.8
v23.0.9
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ The GUI allows you to set the training parameters and generate and run the requi
- [No module called tkinter](#no-module-called-tkinter)
- [SDXL training](#sdxl-training)
- [Change History](#change-history)
- [2024/03/11 (v23.0.8)](#20240311-v2308)
- [2024/03/11 (v23.0.7)](#20240311-v2307)
- [2024/03/13 (v23.0.9)](#20240313-v2309)
- [2024/03/12 (v23.0.8)](#20240312-v2308)
- [2024/03/12 (v23.0.7)](#20240312-v2307)
- [2024/03/11 (v23.0.6)](#20240311-v2306)
- [2024/03/11 (v23.0.5)](#20240311-v2305)
- [2024/03/10 (v23.0.4)](#20240310-v2304)
Expand Down Expand Up @@ -367,11 +368,16 @@ The documentation in this section will be moved to a separate document later.
## Change History
### 2024/03/11 (v23.0.8)
### 2024/03/13 (v23.0.9)
- Reworked how setup can be run to improve Stability Matrix support
- Add support for huggingface based vea path
### 2024/03/12 (v23.0.8)
- Add the ability to create outout and logs folder if it does not exist

Check warning on line 378 in README.md

View workflow job for this annotation

GitHub Actions / build

"outout" should be "output".

Check warning on line 378 in README.md

View workflow job for this annotation

GitHub Actions / build

"outout" should be "output".
### 2024/03/11 (v23.0.7)
### 2024/03/12 (v23.0.7)
- Fix minor issues related to functions and file path
Expand Down
6 changes: 5 additions & 1 deletion kohya_gui/common_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1374,7 +1374,11 @@ def validate_paths(headless:bool = False, **kwargs):
if vae != None:
if vae != "":
log.info(f"Validating VAE file path {vae} existence...")
if not os.path.exists(vae):

# Check if it matches the Hugging Face model pattern
if re.match(r'^[\w-]+\/[\w-]+$', vae):
log.info("...huggingface.co vae model provided")
elif not os.path.exists(vae):
log.error("...vae path is invalid")
return False
else:
Expand Down
4 changes: 0 additions & 4 deletions setup-runpod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ fi
echo "Activating venv..."
source "$SCRIPT_DIR/venv/bin/activate" || exit 1

# Install packaging
echo "Installing the python packaging module..."
pip install packaging

# Run setup_linux.py script with platform requirements
echo "Running setup_linux.py..."
python "$SCRIPT_DIR/setup/setup_linux.py" --platform-requirements-file=requirements_runpod.txt --show_stdout --no_run_accelerate
Expand Down
18 changes: 2 additions & 16 deletions setup.bat
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
@echo off

set PYTHON_VER=3.10.9

:: Check if Python version meets the recommended version
python --version 2>nul | findstr /b /c:"Python %PYTHON_VER%" >nul
if errorlevel 1 (
echo Warning: Python version %PYTHON_VER% is required. Kohya_ss GUI will most likely fail to run.
)

IF NOT EXIST venv (
echo Creating venv...
python -m venv venv
Expand All @@ -16,24 +8,18 @@ IF NOT EXIST venv (
:: Create the directory if it doesn't exist
mkdir ".\logs\setup" > nul 2>&1

:: Deactivate the virtual environment
:: Deactivate the virtual environment to prevent error
call .\venv\Scripts\deactivate.bat

:: Calling external python program to check for local modules
:: python .\setup\check_local_modules.py

call .\venv\Scripts\activate.bat

echo "Installing packaging python module..."
pip install packaging

REM Check if the batch was started via double-click
IF /i "%comspec% /c %~0 " equ "%cmdcmdline:"=%" (
REM echo This script was started by double clicking.
cmd /k python .\setup\setup_windows.py
) ELSE (
REM echo This script was started from a command prompt.
python .\setup\setup_windows.py
python .\setup\setup_windows.py %*
)

:: Deactivate the virtual environment
Expand Down
15 changes: 1 addition & 14 deletions setup.ps1
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@

# Check if Python version meets the recommended version
$pythonVersion = & .\venv\Scripts\python.exe --version 2>$null
if ($pythonVersion -notmatch "^Python $PYTHON_VER") {
Write-Host "Warning: Python version $PYTHON_VER is recommended."
}

if (-not (Test-Path -Path "venv")) {
Write-Host "Creating venv..."
python -m venv venv
Expand All @@ -16,15 +9,9 @@ $null = New-Item -ItemType Directory -Force -Path ".\logs\setup"
# Deactivate the virtual environment
& .\venv\Scripts\deactivate.bat

# Calling external python program to check for local modules
# & .\venv\Scripts\python.exe .\setup\check_local_modules.py

& .\venv\Scripts\activate.bat

Write-Host "Installing python packaging module..."
& pip install packaging

& .\venv\Scripts\python.exe .\setup\setup_windows.py
& .\venv\Scripts\python.exe .\setup\setup_windows.py $args

# Deactivate the virtual environment
& .\venv\Scripts\deactivate.bat
4 changes: 0 additions & 4 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,6 @@ install_python_dependencies() {
source "$DIR/venv/bin/activate"
fi

# Install packaging
echo "Installing the python packaging module..."
pip install packaging

case "$OSTYPE" in
"lin"*)
if [ "$RUNPOD" = true ]; then
Expand Down
44 changes: 9 additions & 35 deletions setup/setup_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@
import os
import re
import sys
import filecmp
import logging
import shutil
import sysconfig
import datetime
import platform
import pkg_resources

from packaging import version

errors = 0 # Define the 'errors' variable before using it
log = logging.getLogger('sd')

Expand All @@ -25,6 +20,8 @@ def check_python_version():
min_version = (3, 10, 9)
max_version = (3, 11, 0)

from packaging import version

try:
current_version = sys.version_info
log.info(f"Python version is {sys.version}")
Expand Down Expand Up @@ -584,42 +581,19 @@ def ensure_base_requirements():
import rich # pylint: disable=unused-import
except ImportError:
install('--upgrade rich', 'rich')

try:
import packaging
except ImportError:
install('packaging')


def run_cmd(run_cmd):
try:
subprocess.run(run_cmd, shell=True, check=False, env=os.environ)
except subprocess.CalledProcessError as e:
print(f'Error occurred while running command: {run_cmd}')
print(f'Error: {e}')


# check python version
def check_python(ignore=True, skip_git=False):
#
# This function was adapted from code written by vladimandic: https://github.com/vladmandic/automatic/commits/master
#

supported_minors = [9, 10]
log.info(f'Python {platform.python_version()} on {platform.system()}')
if not (
int(sys.version_info.major) == 3
and int(sys.version_info.minor) in supported_minors
):
log.error(
f'Incompatible Python version: {sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro} required 3.{supported_minors}'
)
if not ignore:
sys.exit(1)
if not skip_git:
git_cmd = os.environ.get('GIT', 'git')
if shutil.which(git_cmd) is None:
log.error('Git not found')
if not ignore:
sys.exit(1)
else:
git_version = git('--version', folder=None, ignore=False)
log.debug(f'Git {git_version.replace("git version", "").strip()}')
log.error(f'Error occurred while running command: {run_cmd}')
log.error(f'Error: {e}')


def delete_file(file_path):
Expand Down
2 changes: 1 addition & 1 deletion setup/setup_linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def main_menu(platform_requirements_file, show_stdout: bool = False, no_run_acce
log.info("If this operation ever runs too long, you can rerun this script in verbose mode to check.")

setup_common.check_repo_version()
setup_common.check_python()
# setup_common.check_python()

# Upgrade pip if needed
setup_common.install('pip')
Expand Down
2 changes: 1 addition & 1 deletion setup/setup_runpod.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def main_menu(platform_requirements_file):
log.info("If this operation ever runs too long, you can rerun this script in verbose mode to check.")

setup_common.check_repo_version()
setup_common.check_python()
# setup_common.check_python()

# Upgrade pip if needed
setup_common.install('pip')
Expand Down
Loading

0 comments on commit bc5165d

Please sign in to comment.