forked from Nerogar/OneTrainer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.bat
52 lines (43 loc) · 1.19 KB
/
install.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
47
48
49
50
51
52
@echo off
if not defined PYTHON (set PYTHON=python)
if not defined VENV_DIR (set "VENV_DIR=%~dp0%venv")
:check_venv
dir "%VENV_DIR%" > NUL 2> NUL
if %ERRORLEVEL% == 0 goto :activate_venv
echo creating venv in %VENV_DIR%
%PYTHON% -m venv "%VENV_DIR%"
if %ERRORLEVEL% == 0 goto :activate_venv
echo Couldn't create venv
goto :end_error
:activate_venv
echo activating venv %VENV_DIR%
set PYTHON="%VENV_DIR%\Scripts\python.exe"
:install_dependencies
echo installing dependencies
%PYTHON% -m pip install -r requirements.txt
:check_cuda
echo checking if CUDA is available
for /f "tokens=*" %%i in ('CALL %PYTHON% -c "import torch; print(torch.cuda.is_available())"') do set CUDA_AVAILABLE=%%i
if %CUDA_AVAILABLE% == True goto :end_success
set /p USE_ZLUDA=CUDA is not available. Are you using AMD GPUs on Windows? (y/n)
if "%USE_ZLUDA%" == "y" goto :install_zluda
if "%USE_ZLUDA%" == "Y" goto :install_zluda
goto :end_error
:install_zluda
echo continue with ZLUDA
%PYTHON% scripts/install_zluda.py
goto :end_success
:end_success
echo.
echo ************
echo Install done
echo ************
goto:end
:end_error
echo.
echo ********************
echo Error during install
echo ********************
goto:end
:end
pause