Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v21.6.1 #889

Merged
merged 3 commits into from
Jun 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ wandb
setup.log
logs
SmilingWolf
uninstall.txt
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,8 @@ This will store a backup file with your current locally installed pip packages a

## Change History

* 2023/06/02 (v21.6.1)
- Add detection of files outside the venv to scripts
* 2023/06/02 (v21.6.0)
- Merge kohya_ss repo changes
- Improge logging of kohya_ss GUI
Expand Down
29 changes: 29 additions & 0 deletions gui.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,33 @@
@echo off
setlocal

REM Define color variables
set "yellow_text="
set "blue_text="
set "reset_text="

REM Run pip freeze and capture the output
for /f "delims=" %%I in ('pip freeze') do (
set "pip_output=%%I"
goto :CheckModules
)

:CheckModules
REM Check if modules are found in the output
if defined pip_output (
echo %yellow_text%=============================================================
echo Modules installed outside the virtual environment were found.
echo This can cause issues. Please review the installed modules.
echo.
echo You can uninstall all local modules with:
echo.
echo %blue_text%deactivate
echo pip freeze ^> uninstall.txt
echo pip uninstall -y -r uninstall.txt
echo %yellow_text%=============================================================%reset_text%
)

endlocal

:: Activate the virtual environment
call .\venv\Scripts\activate.bat
Expand Down
26 changes: 26 additions & 0 deletions gui.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,30 @@
# Check if a virtual environment is active and deactivate it if necessary
if ($env:VIRTUAL_ENV) {
# Write-Host "Deactivating the virtual environment to test for modules installed locally..."
& deactivate
}

# Run pip freeze and capture the output
$pipOutput = & pip freeze

# Check if modules are found in the output
if ($pipOutput) {
Write-Host " "
Write-Host -ForegroundColor Yellow -Object "============================================================="
Write-Host -ForegroundColor Yellow -Object "Modules installed outside the virtual environment were found."
Write-Host -ForegroundColor Yellow -Object "This can cause issues. Please review the installed modules."
Write-Host " "
Write-Host -ForegroundColor Yellow -Object "You can deinstall all the local modules with:"
Write-Host " "
Write-Host -ForegroundColor Blue -Object "deactivate"
Write-Host -ForegroundColor Blue -Object "pip freeze > uninstall.txt"
Write-Host -ForegroundColor Blue -Object "pip uninstall -y -r uninstall.txt"
Write-Host -ForegroundColor Yellow -Object "============================================================="
Write-Host " "
}

# Activate the virtual environment
# Write-Host "Activating the virtual environment..."
& .\venv\Scripts\activate
$env:PATH += ";$($MyInvocation.MyCommand.Path)\venv\Lib\site-packages\torch\lib"

Expand Down
6 changes: 3 additions & 3 deletions lora_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,10 +827,10 @@ def train_model(
# run_cmd += f' --conv_alphas="{conv_alphas}"'

if print_only_bool:
log.info(
'\033[93m\nHere is the trainer command as a reference. It will not be executed:\033[0m\n'
log.warning(
'Here is the trainer command as a reference. It will not be executed:\n'
)
log.info('\033[96m' + run_cmd + '\033[0m\n')
log.info(run_cmd)
else:
log.info(run_cmd)
# Run the command
Expand Down
51 changes: 51 additions & 0 deletions setup.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,53 @@
@echo off
setlocal

REM Define color variables
set "yellow_text="
set "blue_text="
set "reset_text="

REM Run pip freeze and capture the output
for /f "delims=" %%I in ('pip freeze') do (
set "pip_output=%%I"
goto :CheckModules
)

:CheckModules
REM Check if modules are found in the output
if defined pip_output (
echo %yellow_text%=============================================================
echo Modules installed outside the virtual environment were found.
echo This can cause issues. Please review the installed modules.
echo.
echo You can uninstall all local modules with:
echo.
echo %blue_text%deactivate
echo pip freeze ^> uninstall.txt
echo pip uninstall -y -r uninstall.txt
echo %yellow_text%=============================================================%reset_text%
)

:PromptUser
REM Ask the user if they want to quit or continue
echo.
echo Do you want to:
echo [1] - Quit
echo [2] - Continue with the setup
set /p "choice=Enter your choice (1 or 2): "
if /i "%choice%"=="1" (
echo You chose to quit.
echo.
goto :Quit
) else if /i "%choice%"=="2" (
echo You chose to continue.
echo.
) else (
echo Invalid choice. Please try again.
echo.
goto :PromptUser
)

endlocal

set PYTHON_VER=3.10.9

Expand Down Expand Up @@ -56,3 +105,5 @@ python.exe .\tools\update_bitsandbytes.py
@REM copy /y .\bitsandbytes_windows\main.py .\venv\Lib\site-packages\bitsandbytes\cuda_setup\main.py

accelerate config

:Quit
2 changes: 2 additions & 0 deletions uninstall.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pip freeze \
pip freeze