# Nimble lokal ausprobieren – Windows (PowerShell) # Automatisch erzeugt von Tokenstrom (tokenstrom.com). # Aufruf: powershell -ExecutionPolicy Bypass -File try_windows.ps1 $ErrorActionPreference = "Stop" Set-Location $PSScriptRoot Write-Host "== Nimble ==" if (Get-Command nvidia-smi -ErrorAction SilentlyContinue) { nvidia-smi --query-gpu=name,memory.total --format=csv,noheader } if ($true) { Write-Host "== Ollama ==" if (-not (Get-Command ollama -ErrorAction SilentlyContinue)) { Write-Host "Installing Ollama ..." winget install -e --id Ollama.Ollama --accept-source-agreements --accept-package-agreements $env:Path = [Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [Environment]::GetEnvironmentVariable("Path","User") } try { Invoke-WebRequest -UseBasicParsing http://localhost:11434/api/tags | Out-Null } catch { Start-Process -WindowStyle Hidden ollama -ArgumentList "serve"; Start-Sleep 3 } # Pick the right variant for your hardware (to choose your own: $env:MODEL="") if (-not $env:MODEL) { $choices = @(@{need=7.5; ref="nimble:9b-q4_K_M"; def=$false}, @{need=11.5; ref="nimble:9b"; def=$true}, @{need=11.5; ref="nimble:9b-q8_0"; def=$false}, @{need=21.0; ref="nimble:9b-bf16"; def=$false}) $mem = 0 if (Get-Command nvidia-smi -ErrorAction SilentlyContinue) { $mem = [math]::Floor(((nvidia-smi --query-gpu=memory.total --format=csv,noheader,nounits) | ForEach-Object { [int]$_ } | Measure-Object -Maximum).Maximum / 1024) } else { $mem = [math]::Floor((Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory / 1GB) - 4 } $pick = $choices | Where-Object { $_.def -and $_.need -le $mem } | Select-Object -First 1 if (-not $pick) { $pick = $choices | Where-Object { $_.need -le $mem } | Select-Object -Last 1 } if (-not $pick) { $pick = $choices[0] } $env:MODEL = $pick.ref Write-Host "Available memory: approx. $mem GB -> selected variant: $($env:MODEL)" -ForegroundColor Cyan } if (-not $env:MODEL) { $env:MODEL = "nimble" } Write-Host "Downloading $($env:MODEL) (the first time this takes a few minutes, depending on size) ..." ollama pull $env:MODEL Write-Host "" Write-Host "Done! Now type your question and press Enter. Quit with /bye" -ForegroundColor Green ollama run $env:MODEL exit }