# Beam-1.0-501B-A23B lokal ausprobieren – Windows (PowerShell) # Automatisch erzeugt von Tokenstrom (tokenstrom.com). # Aufruf: powershell -ExecutionPolicy Bypass -File try_windows.ps1 # $env:MODE='hf'; powershell -ExecutionPolicy Bypass -File try_windows.ps1 (Python statt Ollama) $ErrorActionPreference = "Stop" Set-Location $PSScriptRoot Write-Host "== Beam-1.0-501B-A23B ==" if (Get-Command nvidia-smi -ErrorAction SilentlyContinue) { nvidia-smi --query-gpu=name,memory.total --format=csv,noheader } Write-Host "WARNUNG: Groß (501,3 B parameters, MoE): running entirely on the GPU takes a lot of VRAM (video memory). With MoE offloading, a regular graphics card plus plenty of RAM is enough (see table). Colab Free isn't enough." -ForegroundColor Yellow if ($env:MODE -ne "hf") { 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=207.0; ref="hf.co/unsloth/Beam-1.0-501B-A23B-GGUF:UD-Q2_K_XL"; def=$false}, @{need=268.0; ref="hf.co/unsloth/Beam-1.0-501B-A23B-GGUF:UD-Q3_K_XL"; def=$false}, @{need=338.5; ref="hf.co/unsloth/Beam-1.0-501B-A23B-GGUF:UD-Q4_K_XL"; def=$true}, @{need=407.5; ref="hf.co/unsloth/Beam-1.0-501B-A23B-GGUF:UD-Q5_K_XL"; def=$false}, @{need=500.0; ref="hf.co/unsloth/Beam-1.0-501B-A23B-GGUF:UD-Q6_K_XL"; def=$false}, @{need=587.5; ref="hf.co/unsloth/Beam-1.0-501B-A23B-GGUF:Q8_0"; def=$false}, @{need=1104.0; ref="hf.co/unsloth/Beam-1.0-501B-A23B-GGUF: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 = "beam:cloud" } 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 } Write-Host "== Python / Hugging Face ==" python -m venv .venv-beam-1-0-501b-a23b & .\.venv-beam-1-0-501b-a23b\Scripts\Activate.ps1 python -m pip install -q -U pip if (Get-Command nvidia-smi -ErrorAction SilentlyContinue) { pip install -q -U torch --index-url https://download.pytorch.org/whl/cu124 pip install -q -U transformers accelerate bitsandbytes } else { pip install -q -U torch transformers accelerate } python demo.py