| |
| |
| |
| |
| [CmdletBinding()] |
| param( |
| [ValidateSet("cuda", "cpu", "")] |
| [string]$Backend = "" |
| ) |
| $ErrorActionPreference = "Stop" |
|
|
| function Info($msg) { Write-Host "[INFO] $msg" -ForegroundColor Green } |
| function Warn($msg) { Write-Host "[WARN] $msg" -ForegroundColor Yellow } |
| function Die($msg) { Write-Host "[ERROR] $msg" -ForegroundColor Red; exit 1 } |
|
|
| $RepoUrl = "https://huggingface.co/AIMindLink/lambda-mindlink-memotron" |
|
|
| |
| if (-not $Backend) { |
| $suggest = 2 |
| if (Get-Command nvidia-smi -ErrorAction SilentlyContinue) { $suggest = 1 } |
| Write-Host "" |
| Write-Host "Select llama-cpp-python backend:" |
| Write-Host " 1) CUDA - NVIDIA GPU" |
| Write-Host " 2) CPU - no GPU (slow)" |
| $choice = Read-Host "Choice [1-2, default $suggest]" |
| if (-not $choice) { $choice = "$suggest" } |
| if ($choice -in "1","cuda") { $Backend = "cuda" } |
| elseif ($choice -in "2","cpu") { $Backend = "cpu" } |
| else { Die "Unknown choice '$choice'" } |
| } |
| Info "Backend: $Backend" |
|
|
| |
| if (-not (Get-Command python -ErrorAction SilentlyContinue)) { |
| Die "Python not found on PATH. Install 3.11/3.12 from python.org and tick 'Add Python to PATH'." |
| } |
| $pyver = ((python --version) 2>&1 | Out-String).Trim() |
| if ($pyver -notmatch '^Python 3\.\d+') { |
| Die "Could not read Python version (got '$pyver'). Is the Windows Store python alias interfering?" |
| } |
| if ($pyver -notmatch '^Python 3\.(11|12)\.') { |
| Warn "Found $pyver β the project targets 3.11/3.12. Continuing anyway." |
| } |
| Info "Found $pyver" |
|
|
| |
| if (-not (Test-Path "main.py")) { |
| if (-not (Get-Command git -ErrorAction SilentlyContinue)) { |
| Die "git not found. Install from git-scm.com, or download the project ZIP and re-run from inside the folder." |
| } |
| Info "Cloning repository..." |
| git clone $RepoUrl |
| Set-Location "lambda-mindlink-memotron" |
| } |
|
|
| |
| if (-not (Test-Path ".venv")) { |
| Info "Creating virtual environment..." |
| python -m venv .venv |
| } |
| |
| $py = Join-Path (Get-Location) ".venv\Scripts\python.exe" |
| Info "Upgrading pip..." |
| & $py -m pip install --upgrade pip |
|
|
| |
| if ($Backend -eq "cuda") { |
| |
| $detected = "" |
| if (Get-Command nvcc -ErrorAction SilentlyContinue) { |
| if ((nvcc --version | Out-String) -match 'release (\d+)\.(\d+)') { $detected = "cu$($Matches[1])$($Matches[2])" } |
| } |
| if (-not $detected -and (Get-Command nvidia-smi -ErrorAction SilentlyContinue)) { |
| if ((nvidia-smi | Out-String) -match 'CUDA Version:\s*(\d+)\.(\d+)') { $detected = "cu$($Matches[1])$($Matches[2])" } |
| } |
| if (-not $detected -or $detected -notin "cu118","cu121","cu122","cu123","cu124") { |
| if (-not $detected) { $detected = "cu121" } |
| else { Warn "Detected $detected has no prebuilt wheel β defaulting to cu121."; $detected = "cu121" } |
| } |
| $tag = Read-Host "CUDA wheel tag [default: $detected] (cu118, cu121, cu122, cu123, cu124)" |
| if (-not $tag) { $tag = $detected } |
| Info "Installing llama-cpp-python (CUDA wheel: $tag)..." |
| & $py -m pip install llama-cpp-python --extra-index-url "https://abetlen.github.io/llama-cpp-python/whl/$tag" |
| Warn "If pip says 'Building wheel for llama-cpp-python', no wheel matched β re-run with another tag." |
| } |
| else { |
| Info "Installing llama-cpp-python (CPU only)..." |
| & $py -m pip install llama-cpp-python |
| Warn "If pip compiles from source, install 'Visual Studio Build Tools' with the C++ workload." |
| } |
|
|
| |
| Info "Installing requirements.txt..." |
| & $py -m pip install -r requirements.txt |
| New-Item -ItemType Directory -Force -Path "ai" | Out-Null |
|
|
| |
| Write-Host "" |
| Info "Installation complete." |
| Write-Host "Next steps:" |
| Write-Host " 1. Copy your .gguf files into: $(Get-Location)\ai\" |
| Write-Host " 2. Edit config.py (_ALPHA_INTELLIGENCE_TO_LOAD, _MODEL_TYPE)" |
| Write-Host " 3. Start the app:" |
| Write-Host " .\.venv\Scripts\Activate.ps1" |
| Write-Host " python main.py" |
| ``` |
|
|
| Optionally add a tiny `install.bat` so Windows users can just double-click: |
|
|
| ```bat |
| @echo off |
| rem Double-click-friendly wrapper for install.ps1 |
| powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0install.ps1" %* |
| pause |