-
-
Notifications
You must be signed in to change notification settings - Fork 195
/
Copy pathstart-ui.bat
46 lines (39 loc) · 1.17 KB
/
start-ui.bat
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
@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"
if defined PROFILE (set PYTHON=%PYTHON% -m scalene --off --cpu --gpu --profile-all --no-browser)
echo Using Python %PYTHON%
:launch
echo Starting UI...
%PYTHON% scripts\train_ui.py
if errorlevel 1 (
echo Error: UI script exited with code %ERRORLEVEL%
)
:end
pause