forked from bmaltais/kohya_ss
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request bmaltais#363 from bmaltais/LoHa-Support
Lo ha support
- Loading branch information
Showing
7 changed files
with
111 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
@echo off | ||
|
||
call venv\Scripts\activate.bat | ||
python.exe kohya_gui.py %* | ||
:: Activate the virtual environment | ||
call .\venv\Scripts\activate.bat | ||
|
||
pause | ||
:: Validate the requirements and store the exit code | ||
python.exe .\tools\validate_requirements.py | ||
|
||
:: If the exit code is 0, run the kohya_gui.py script with the command-line arguments | ||
if %errorlevel% equ 0 ( | ||
python.exe kohya_gui.py %* | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,10 @@ | ||
.\venv\Scripts\activate | ||
python.exe kohya_gui.py $args | ||
# Activate the virtual environment | ||
& .\venv\Scripts\activate | ||
|
||
# Validate the requirements and store the exit code | ||
python.exe .\tools\validate_requirements.py | ||
|
||
# If the exit code is 0, run the kohya_gui.py script with the command-line arguments | ||
if ($LASTEXITCODE -eq 0) { | ||
python.exe kohya_gui.py $args | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import sys | ||
import pkg_resources | ||
|
||
print("Validating that requirements are satisfied.") | ||
|
||
# Load the requirements from the requirements.txt file | ||
with open('requirements.txt') as f: | ||
requirements = f.readlines() | ||
|
||
# Check each requirement against the installed packages | ||
missing_requirements = [] | ||
wrong_version_requirements = [] | ||
for requirement in requirements: | ||
requirement = requirement.strip() | ||
if requirement == ".": | ||
# Skip the current requirement if it is a dot (.) | ||
continue | ||
try: | ||
pkg_resources.require(requirement) | ||
except pkg_resources.DistributionNotFound: | ||
missing_requirements.append(requirement) | ||
except pkg_resources.VersionConflict as e: | ||
wrong_version_requirements.append((requirement, str(e.req), e.dist.version)) | ||
|
||
# If there are any missing or wrong version requirements, print an error message and exit with a non-zero exit code | ||
if missing_requirements or wrong_version_requirements: | ||
if missing_requirements: | ||
print("Error: The following packages are missing:") | ||
for requirement in missing_requirements: | ||
print(f" - {requirement}") | ||
if wrong_version_requirements: | ||
print("Error: The following packages have the wrong version:") | ||
for requirement, expected_version, actual_version in wrong_version_requirements: | ||
print(f" - {requirement} (expected version {expected_version}, found version {actual_version})") | ||
print('\nRun \033[33mupgrade.ps1\033[0m or \033[33mpip install -U -r requirements.txt\033[0m to resolve the missing requirements listed above...') | ||
|
||
sys.exit(1) | ||
|
||
# All requirements satisfied | ||
print("All requirements satisfied.") | ||
sys.exit(0) |