-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautoinstall.bat
More file actions
77 lines (67 loc) · 2.64 KB
/
autoinstall.bat
File metadata and controls
77 lines (67 loc) · 2.64 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
70
71
72
73
74
75
76
77
@echo off
setlocal enabledelayedexpansion
:: Check for PowerShell
where powershell >nul 2>&1
if %errorlevel% neq 0 (
echo PowerShell is required to run this script
exit /b 1
)
:: GPU Detection
echo Detecting NVIDIA GPU...
powershell.exe -Command "(Get-CimInstance -ClassName Win32_VideoController).Name" | findstr -i "NVIDIA"
if %errorlevel% neq 0 (
echo No NVIDIA GPU detected. Exiting.
exit /b 1
)
echo NVIDIA GPU detected
:: Package Manager Detection
set "PKG_MGR="
for /f "tokens=1,2 delims= " %%a in ('where choco 2^>nul') do if not defined PKG_MGR set "PKG_MGR=choco"
for /f "tokens=1,2 delims= " %%a in ('where winget 2^>nul') do if not defined PKG_MGR set "PKG_MGR=winget"
for /f "tokens=1,2 delims= " %%a in ('where scoop 2^>nul') do if not defined PKG_MGR set "PKG_MGR=scoop"
if not defined PKG_MGR (
echo No supported package manager found
echo Please install one of the following first:
echo 1. Chocolatey (https://chocolatey.org/install)
echo 2. Winget (https://learn.microsoft.com/en-us/windows/package-manager/winget/)
echo 3. Scoop (https://scoop.sh/)
exit /b 1
)
echo Using package manager: %PKG_MGR%
:: Driver and CUDA Installation
echo.
echo Installing NVIDIA drivers and CUDA toolkit...
echo This may take several minutes...
if "%PKG_MGR%"=="choco" (
echo Installing with Chocolatey...
choco install nvidia-display-driver -y --ignore-checksums
choco install cuda --version=12.1.1 --yes --ignore-checksums
) else if "%PKG_MGR%"=="winget" (
echo Installing with Winget...
winget install --id=NVIDIA.CUDA --version=12.1.1.1
echo NOTE: NVIDIA drivers may need to be installed manually from Device Manager
) else if "%PKG_MGR%"=="scoop" (
echo Installing with Scoop...
scoop bucket add nvidia https://github.com/ScoopInstaller/NirSoftBucket
echo ERROR: CUDA toolkit not available in Scoop repositories
echo Manual installation from NVIDIA website is recommended
exit /b 1
)
:: Environment Setup
echo.
echo Setting up environment variables...
setx PATH "%PATH%;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\bin"
setx CUDA_PATH "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1"
setx CUDA_PATH_V12_1 "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1"
:: Verification
echo.
echo Verifying installation...
nvidia-smi
nvcc --version
echo.
echo Installation complete! Please reboot your system.
echo For full functionality, consider installing:
echo 1. Visual Studio Build Tools (for CUDA compilation)
echo 2. CUDA samples from NVIDIA website
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
pip install bitsandbytes deepspeed