forked from Nerogar/OneTrainer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-ui.bat
More file actions
69 lines (59 loc) · 1.76 KB
/
start-ui.bat
File metadata and controls
69 lines (59 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
@echo off
REM Avoid footgun by explictly navigating to the directory containing the batch file
cd /d "%~dp0"
REM Verify that OneTrainer is our current working directory
if not exist "scripts\train_ui.py" (
echo Error: train_ui.py does not exist, you have done something very wrong. Reclone the repository.
goto :end
)
if not defined PYTHON (
where python >NUL 2>NUL
if errorlevel 1 (
echo Error: Python is not installed or not in PATH
goto :end
)
set PYTHON=python
)
if not defined VENV_DIR (set "VENV_DIR=%~dp0venv")
:check_venv
dir "%VENV_DIR%" > NUL 2> NUL
if not errorlevel 1 goto :activate_venv
echo venv not found, please run install.bat first
goto :end
:activate_venv
echo activating venv %VENV_DIR%
if not exist "%VENV_DIR%\Scripts\python.exe" (
echo Error: Python executable not found in virtual environment
goto :end
)
set PYTHON="%VENV_DIR%\Scripts\python.exe" -X utf8
if defined PROFILE (set PYTHON=%PYTHON% -m scalene --off --cpu --gpu --profile-all --no-browser)
echo Using Python %PYTHON%
REM Disable HF_HUB_DISABLE_XET, buggy; default disables Xet (set to 0 to enable) - https://github.com/Nerogar/OneTrainer/issues/949
if not defined HF_HUB_DISABLE_XET (
set "HF_HUB_DISABLE_XET=1"
)
echo HF_HUB_DISABLE_XET=%HF_HUB_DISABLE_XET%
echo.
echo NOTE: Xet disabled, to enable it set as 0 before launch
:check_python_version
echo Checking Python version...
%PYTHON% --version
if errorlevel 1 (
echo Error: Failed to get Python version
goto :end_error
)
echo.
%PYTHON% "%~dp0scripts\util\version_check.py" 3.10 3.13 2>&1
if errorlevel 1 (
echo.
goto :wrong_python_version
)
:launch
echo Starting UI...
%PYTHON% scripts\train_ui.py
if errorlevel 1 (
echo Error: UI script exited with code %ERRORLEVEL%
)
:end
pause