Update requirements syntax (for windows)

pull/2927/head
bmaltais 2024-10-26 10:29:42 -04:00
parent 03e97424b9
commit 7d6ebcb7cd
11 changed files with 49 additions and 22 deletions

View File

@ -7,8 +7,14 @@ call .\venv\Scripts\deactivate.bat
:: Activate the virtual environment :: Activate the virtual environment
call .\venv\Scripts\activate.bat call .\venv\Scripts\activate.bat
:: Update pip to latest version
python -m pip install --upgrade pip -q
set PATH=%PATH%;%~dp0venv\Lib\site-packages\torch\lib set PATH=%PATH%;%~dp0venv\Lib\site-packages\torch\lib
echo Starting the GUI... this might take some time...
:: If the exit code is 0, run the kohya_gui.py script with the command-line arguments :: If the exit code is 0, run the kohya_gui.py script with the command-line arguments
if %errorlevel% equ 0 ( if %errorlevel% equ 0 (
REM Check if the batch was started via double-click REM Check if the batch was started via double-click

View File

@ -7,8 +7,13 @@ if ($env:VIRTUAL_ENV) {
# Activate the virtual environment # Activate the virtual environment
# Write-Host "Activating the virtual environment..." # Write-Host "Activating the virtual environment..."
& .\venv\Scripts\activate & .\venv\Scripts\activate
python.exe -m pip install --upgrade pip -q
$env:PATH += ";$($MyInvocation.MyCommand.Path)\venv\Lib\site-packages\torch\lib" $env:PATH += ";$($MyInvocation.MyCommand.Path)\venv\Lib\site-packages\torch\lib"
Write-Host "Starting the GUI... this might take some time..."
$argsFromFile = @() $argsFromFile = @()
if (Test-Path .\gui_parameters.txt) { if (Test-Path .\gui_parameters.txt) {
$argsFromFile = Get-Content .\gui_parameters.txt -Encoding UTF8 | Where-Object { $_ -notmatch "^#" } | Foreach-Object { $_ -split " " } $argsFromFile = Get-Content .\gui_parameters.txt -Encoding UTF8 | Where-Object { $_ -notmatch "^#" } | Foreach-Object { $_ -split " " }

View File

@ -7,7 +7,7 @@ easygui==0.98.3
einops==0.7.0 einops==0.7.0
fairscale==0.4.13 fairscale==0.4.13
ftfy==6.1.1 ftfy==6.1.1
gradio==5.0.1 gradio==5.4.0
huggingface-hub==0.25.2 huggingface-hub==0.25.2
imagesize==1.4.1 imagesize==1.4.1
invisible-watermark==0.2.0 invisible-watermark==0.2.0

View File

@ -1,3 +1,8 @@
torch==2.4.1+cu124 --index-url https://download.pytorch.org/whl/cu124 # Custom index URL for specific packages
torchvision==0.19.1+cu124 --index-url https://download.pytorch.org/whl/cu124 --extra-index-url https://download.pytorch.org/whl/cu124
xformers==0.0.28.post1 --index-url https://download.pytorch.org/whl/cu124
torch==2.4.1+cu124
torchvision==0.19.1+cu124
xformers==0.0.28.post1
-r requirements_windows.txt

View File

@ -2,4 +2,5 @@ bitsandbytes==0.44.0
tensorboard tensorboard
tensorflow>=2.16.1 tensorflow>=2.16.1
onnxruntime-gpu==1.17.1 onnxruntime-gpu==1.17.1
-r requirements.txt -r requirements.txt

@ -1 +1 @@
Subproject commit 5fba6f514a0792851149ed1a7071070ee35cbeca Subproject commit 8549669f89ed05bb7ce0bf774a7c5589dc15df35

View File

@ -13,6 +13,9 @@ call .\venv\Scripts\deactivate.bat
call .\venv\Scripts\activate.bat call .\venv\Scripts\activate.bat
REM first make sure we have setuptools available in the venv
python -m pip install --require-virtualenv --no-input -q -q setuptools
REM Check if the batch was started via double-click REM Check if the batch was started via double-click
IF /i "%comspec% /c %~0 " equ "%cmdcmdline:"=%" ( IF /i "%comspec% /c %~0 " equ "%cmdcmdline:"=%" (
REM echo This script was started by double clicking. REM echo This script was started by double clicking.

View File

@ -158,16 +158,16 @@ def install_requirements_inbulk(
log.error(f"Could not find the requirements file in {requirements_file}.") log.error(f"Could not find the requirements file in {requirements_file}.")
return return
log.info(f"Installing requirements from {requirements_file}...") log.info(f"Installing/Validating requirements from {requirements_file}...")
if upgrade: optional_parm += " -U" if upgrade else ""
optional_parm += " -U"
if show_stdout: cmd = f"pip install -r {requirements_file} {optional_parm}"
run_cmd(f"pip install -r {requirements_file} {optional_parm}") if not show_stdout:
else: cmd += " --quiet"
run_cmd(f"pip install -r {requirements_file} {optional_parm} --quiet")
log.info(f"Requirements from {requirements_file} installed.") run_cmd(cmd)
log.info(f"Requirements from {requirements_file} installed/validated.")
def configure_accelerate(run_accelerate=False): def configure_accelerate(run_accelerate=False):
@ -649,7 +649,7 @@ def run_cmd(run_cmd):
log.debug(f"Running command: {run_cmd}") log.debug(f"Running command: {run_cmd}")
try: try:
subprocess.run(run_cmd, shell=True, check=True, env=os.environ) subprocess.run(run_cmd, shell=True, check=True, env=os.environ)
log.info(f"Command executed successfully: {run_cmd}") log.debug(f"Command executed successfully: {run_cmd}")
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
log.error(f"Error occurred while running command: {run_cmd}") log.error(f"Error occurred while running command: {run_cmd}")
log.error(f"Error: {e}") log.error(f"Error: {e}")

View File

@ -123,12 +123,13 @@ def install_kohya_ss_torch2(headless: bool = False):
# ) # )
setup_common.install_requirements_inbulk( setup_common.install_requirements_inbulk(
"requirements_pytorch_windows.txt", show_stdout=True, optional_parm="--index-url https://download.pytorch.org/whl/cu124" "requirements_pytorch_windows.txt", show_stdout=True,
# optional_parm="--index-url https://download.pytorch.org/whl/cu124"
) )
setup_common.install_requirements_inbulk( # setup_common.install_requirements_inbulk(
"requirements_windows.txt", show_stdout=True, upgrade=True # "requirements_windows.txt", show_stdout=True, upgrade=True
) # )
setup_common.run_cmd("accelerate config default") setup_common.run_cmd("accelerate config default")

View File

@ -177,11 +177,17 @@ def main():
# Install required packages from the specified requirements file # Install required packages from the specified requirements file
requirements_file = args.requirements or "requirements_pytorch_windows.txt" requirements_file = args.requirements or "requirements_pytorch_windows.txt"
log.debug(f"Installing requirements from: {requirements_file}") log.debug(f"Installing requirements from: {requirements_file}")
setup_common.install_requirements(requirements_file, check_no_verify_flag=True) setup_common.install_requirements_inbulk(
log.debug("Installing additional requirements from: requirements_windows.txt") requirements_file, show_stdout=False,
setup_common.install_requirements( # optional_parm="--index-url https://download.pytorch.org/whl/cu124"
"requirements_windows.txt", check_no_verify_flag=True
) )
# setup_common.install_requirements(requirements_file, check_no_verify_flag=True)
# log.debug("Installing additional requirements from: requirements_windows.txt")
# setup_common.install_requirements(
# "requirements_windows.txt", check_no_verify_flag=True
# )
if __name__ == "__main__": if __name__ == "__main__":
log.debug("Starting main function...") log.debug("Starting main function...")

BIN
venv-r/Scripts/python.exe Normal file

Binary file not shown.