lifeos / scripts /build_cuda.bat
awaisaziz's picture
Add EasyOCR/CUDA support and UI improvements
d1ce419
Raw
History Blame Contribute Delete
1.23 kB
@echo off
REM Build llama-cpp-python from source with CUDA for this machine's CPU (AVX2)
REM and GPU (Quadro RTX 3000, compute 7.5). Run from the repo root.
setlocal
call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
if errorlevel 1 ( echo vcvars64 failed & exit /b 1 )
REM Short temp dir to dodge the Windows 260-char path limit when pip extracts
REM the deeply-nested llama.cpp vendor tree.
if not exist C:\t mkdir C:\t
set "TEMP=C:\t"
set "TMP=C:\t"
REM Best-effort: enable Win32 long paths for this session's tools.
reg add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v LongPathsEnabled /t REG_DWORD /d 1 /f >nul 2>&1
set "CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6"
set "PATH=%CUDA_PATH%\bin;%PATH%"
set "CMAKE_GENERATOR=Ninja"
set "CMAKE_ARGS=-DGGML_CUDA=on -DCMAKE_CUDA_ARCHITECTURES=75"
set "CMAKE_BUILD_PARALLEL_LEVEL=12"
echo === nvcc ===
nvcc --version | findstr release
echo === building llama-cpp-python (this takes a while) ===
"%~dp0..\.venv\Scripts\python.exe" -m pip install llama-cpp-python==0.3.28 ^
--no-binary llama-cpp-python --force-reinstall --no-cache-dir --verbose
echo === build exit code: %errorlevel% ===
endlocal