Buckets:
| @echo off | |
| REM install_llama_windows.bat — Helper to install prerequisites and build llama.cpp on Windows | |
| REM Use with caution: script can attempt to install via winget if available, but asks for confirmation. | |
| setlocal EnableDelayedExpansion | |
| cd /d "%~dp0" | |
| echo. | |
| echo === COSMOS: llama.cpp Build Helper === | |
| echo This script will check for: git, cmake, Python 3.9+, and Visual Studio Build Tools. | |
| echo It can optionally install missing items via winget if winget is available. | |
| echo. | |
| :: Helper to check a command exists | |
| where %1 >nul 2>&1 nIF %ERRORLEVEL% EQU 0 (set "HAS_%1=1") else (set "HAS_%1=0") | |
| n:: Check tools necho Checking for required tools... | |
| where git >nul 2>&1 && set HAS_git=1 || set HAS_git=0 | |
| where cmake >nul 2>&1 && set HAS_cmake=1 || set HAS_cmake=0 | |
| where python >nul 2>&1 && set HAS_python=1 || set HAS_python=0 | |
| where winget >nul 2>&1 && set HAS_winget=1 || set HAS_winget=0 | |
| where cl >nul 2>&1 && set HAS_cl=1 || set HAS_cl=0 | |
| necho Git: %HAS_git% (1=found) | |
| echo CMake: %HAS_cmake% (1=found) | |
| echo Python: %HAS_python% (1=found) | |
| echo MSVC(cl): %HAS_cl% (1=found — Visual Studio Build Tools) | |
| echo WinGet: %HAS_winget% (1=found — can auto-install) | |
| echo. | |
| n:: If anything missing, offer winget install (safe prompt) set MISSING=0 nif "%HAS_git%"=="0" set /a MISSING+=1 nif "%HAS_cmake%"=="0" set /a MISSING+=1 nif "%HAS_python%"=="0" set /a MISSING+=1 nif "%HAS_cl%"=="0" set /a MISSING+=1 n nif %MISSING% GTR 0 ( | |
| echo Some prerequisites are missing. | |
| if "%HAS_winget%"=="1" ( | |
| echo Winget is available. Would you like to attempt automatic installation of missing tools? (Requires elevated privileges) | |
| choice /C YN /N /M "Auto-install missing via winget? (Y/N)" | |
| if errorlevel 2 goto SKIP_INSTALLS | |
| if errorlevel 1 goto DO_INSTALLS | |
| ) else ( | |
| echo Winget not found. Please install the missing tools manually: | |
| if "%HAS_git%"=="0" echo - Install Git: https://git-scm.com/download/win | |
| if "%HAS_cmake%"=="0" echo - Install CMake: https://cmake.org/download/ | |
| if "%HAS_python%"=="0" echo - Install Python 3.9+: https://www.python.org/downloads/windows/ | |
| if "%HAS_cl%"=="0" echo - Install Visual Studio Build Tools: https://visualstudio.microsoft.com/downloads/ (select "Build Tools for Visual Studio") | |
| echo. | |
| pause | |
| goto AFTER_INSTALL_CHECKS | |
| ) | |
| ) | |
| goto AFTER_INSTALL_CHECKS | |
| :DO_INSTALLS | |
| echo Attempting to install missing packages via winget (requires consent)... | |
| if "%HAS_git%"=="0" ( | |
| echo Installing Git... | |
| winget install --id Git.Git -e --silent || echo Git install failed — please install manually. | |
| ) | |
| if "%HAS_python%"=="0" ( | |
| echo Installing Python 3... | |
| winget install --id Python.Python.3 -e --silent || winget install --id Python.Python.3.11 -e --silent || echo Python install failed — please install manually. | |
| ) | |
| if "%HAS_cmake%"=="0" ( | |
| echo Installing CMake... | |
| winget install --id Kitware.CMake -e --silent || echo CMake install failed — please install manually. | |
| ) | |
| if "%HAS_cl%"=="0" ( | |
| echo Installing Visual Studio 2022 Build Tools (this is large and requires user interaction)... | |
| echo You may be prompted by the Visual Studio Installer — please accept workloads for C++ build tools. | |
| winget install --id Microsoft.VisualStudio.2022.BuildTools -e || echo VS Build Tools install failed — please install manually. | |
| ) | |
| :SKIP_INSTALLS | |
| n:AFTER_INSTALL_CHECKS | |
| echo Re-checking environment... | |
| where git >nul 2>&1 && set HAS_git=1 || set HAS_git=0 | |
| where cmake >nul 2>&1 && set HAS_cmake=1 || set HAS_cmake=0 | |
| where python >nul 2>&1 && set HAS_python=1 || set HAS_python=0 | |
| where cl >nul 2>&1 && set HAS_cl=1 || set HAS_cl=0 | |
| necho. | |
| if "%HAS_git%"=="0" echo ERROR: git still not found. | |
| if "%HAS_cmake%"=="0" echo ERROR: cmake still not found. | |
| if "%HAS_python%"=="0" echo ERROR: python still not found. | |
| if "%HAS_cl%"=="0" echo WARNING: MSVC compiler not detected — build may fail without Visual Studio Build Tools. | |
| necho. necho Now cloning/updating llama.cpp in the Cosmos_code folder. | |
| set ROOT=%cd% | |
| set LLAMA_DIR=%ROOT%\llama.cpp | |
| nif exist "%LLAMA_DIR%" ( | |
| echo llama.cpp already exists at %LLAMA_DIR% — pulling latest changes... | |
| pushd "%LLAMA_DIR%" | |
| git pull | |
| popd | |
| ) else ( | |
| echo Cloning llama.cpp into %LLAMA_DIR%... | |
| git clone https://github.com/ggerganov/llama.cpp.git "%LLAMA_DIR%" | |
| ) | |
| n:: Run CMake configure + build | |
| pushd "%LLAMA_DIR%" necho Configuring with CMake... | |
| cmake -S . -B build -DCMAKE_BUILD_TYPE=Release nif %ERRORLEVEL% NEQ 0 ( | |
| echo CMake configuration failed. Ensure CMake + VS Build Tools are installed. | |
| pause | |
| exit /b 1 | |
| ) | |
| echo Building llama.cpp (Release)... This may take several minutes... | |
| cmake --build build --config Release nif %ERRORLEVEL% NEQ 0 ( | |
| echo Build failed. Check errors in the output above. | |
| pause | |
| exit /b 1 | |
| ) | |
| necho Build complete. nif exist "build\bin\llama-quantize.exe" ( | |
| echo Found llama-quantize at build\bin\llama-quantize.exe n) else ( | |
| echo llama-quantize not found in build\bin — you may need to build quantize target or use prebuilt binaries. | |
| ) | |
| necho To convert your COSMOS HF body to GGUF, run (adjust paths): necho python convert_hf_to_gguf.py C:\path\to\merged_body --outfile C:\out\cosmos.f16.gguf --outtype f16 --model-family cosmos-54d --model-name cosmos-namebind necho build\bin\llama-quantize.exe C:\out\cosmos.f16.gguf C:\out\cosmos-namebind-weights.gguf Q4_K_M necho Then run: ollama create cosmos-namebind -f Modelfile.cosmos-namebind | |
| necho Done. Press any key to exit. npause >nul | |
| endlocal | |
Xet Storage Details
- Size:
- 5.7 kB
- Xet hash:
- e943e3ac63c2cf714c6938d815f40f49c46bf1f90e86f8647bf3fddb48718ebd
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.