This repository has been archived by the owner on Oct 22, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 51
/
StableTuner.cmd
75 lines (62 loc) · 2.63 KB
/
StableTuner.cmd
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
70
71
72
73
74
75
@echo off
:: This file is part of sygil-webui (https://github.com/Sygil-Dev/sygil-webui/).
::
:: Copyright 2022 Sygil-Dev team.
:: This program is free software: you can redistribute it and/or modify
:: it under the terms of the GNU Affero General Public License as published by
:: the Free Software Foundation, either version 3 of the License, or
:: (at your option) any later version.
::
:: This program is distributed in the hope that it will be useful,
:: but WITHOUT ANY WARRANTY; without even the implied warranty of
:: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
:: GNU Affero General Public License for more details.
::
:: You should have received a copy of the GNU Affero General Public License
:: along with this program. If not, see <http://www.gnu.org/licenses/>.
:: Run all commands using this script's directory as the working directory
cd %~dp0
:: copy over the first line from environment.yaml, e.g. name: ldm, and take the second word after splitting by ":" delimiter
set v_conda_env_name="ST"
echo Environment name is set as %v_conda_env_name% as per environment.yaml
:: Put the path to conda directory in a file called "custom_conda_path.txt" if it's installed at non-standard path
IF EXIST custom_conda_path.txt (
FOR /F %%i IN (custom_conda_path.txt) DO set v_custom_path=%%i
)
set INSTALL_ENV_DIR=%cd%\installer_files\env
set PATH=%INSTALL_ENV_DIR%;%INSTALL_ENV_DIR%\Library\bin;%INSTALL_ENV_DIR%\Scripts;%INSTALL_ENV_DIR%\Library\usr\bin;%PATH%
set v_paths=%INSTALL_ENV_DIR%
set v_paths=%v_paths%;%ProgramData%\miniconda3
set v_paths=%v_paths%;%USERPROFILE%\miniconda3
set v_paths=%v_paths%;%ProgramData%\anaconda3
set v_paths=%v_paths%;%USERPROFILE%\anaconda3
for %%a in (%v_paths%) do (
IF NOT "%v_custom_path%"=="" (
set v_paths=%v_custom_path%;%v_paths%
)
)
for %%a in (%v_paths%) do (
if EXIST "%%a\Scripts\activate.bat" (
SET v_conda_path=%%a
echo anaconda3/miniconda3 detected in %%a
goto :CONDA_FOUND
)
)
IF "%v_conda_path%"=="" (
echo anaconda3/miniconda3 not found. Install from here https://docs.conda.io/en/latest/miniconda.html
pause
exit /b 1
)
:CONDA_FOUND
echo Starting conda environment %v_conda_env_name% from %v_conda_path%
call "%v_conda_path%\Scripts\activate.bat" "%v_conda_env_name%"
::call git pull | findstr /r /c:"changed" && set "HasChanges=1"
::IF "%HasChanges%" == "0" GOTO START_GUI
::echo StableTuner updated, running installer!
::call conda env create --name "%v_conda_env_name%" -f environment.yaml
::call conda env update --name "%v_conda_env_name%" -f environment.yaml
::python windows_install.py
:START_GUI
::set HasChanges=0
python scripts/configuration_gui.py
::cmd /k