Upload 3 files
Browse filesAdded one-click-installer scripts for ease of use
- install.bat +4 -0
- install.ps1 +115 -0
- install.sh +132 -0
install.bat
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
cd /d "%~dp0"
|
| 3 |
+
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0install.ps1" %*
|
| 4 |
+
pause
|
install.ps1
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Lambda Mindlink Memotron β Windows installer
|
| 2 |
+
# Run:
|
| 3 |
+
# powershell -NoProfile -ExecutionPolicy Bypass -File install.ps1
|
| 4 |
+
# .\install.ps1 -Backend cpu # non-interactive: cuda | cpu
|
| 5 |
+
[CmdletBinding()]
|
| 6 |
+
param(
|
| 7 |
+
[ValidateSet("cuda", "cpu", "")]
|
| 8 |
+
[string]$Backend = ""
|
| 9 |
+
)
|
| 10 |
+
$ErrorActionPreference = "Stop"
|
| 11 |
+
|
| 12 |
+
function Info($msg) { Write-Host "[INFO] $msg" -ForegroundColor Green }
|
| 13 |
+
function Warn($msg) { Write-Host "[WARN] $msg" -ForegroundColor Yellow }
|
| 14 |
+
function Die($msg) { Write-Host "[ERROR] $msg" -ForegroundColor Red; exit 1 }
|
| 15 |
+
|
| 16 |
+
$RepoUrl = "https://huggingface.co/AIMindLink/lambda-mindlink-memotron"
|
| 17 |
+
|
| 18 |
+
# ββ 1. Choose backend ββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 19 |
+
if (-not $Backend) {
|
| 20 |
+
$suggest = 2
|
| 21 |
+
if (Get-Command nvidia-smi -ErrorAction SilentlyContinue) { $suggest = 1 }
|
| 22 |
+
Write-Host ""
|
| 23 |
+
Write-Host "Select llama-cpp-python backend:"
|
| 24 |
+
Write-Host " 1) CUDA - NVIDIA GPU"
|
| 25 |
+
Write-Host " 2) CPU - no GPU (slow)"
|
| 26 |
+
$choice = Read-Host "Choice [1-2, default $suggest]"
|
| 27 |
+
if (-not $choice) { $choice = "$suggest" }
|
| 28 |
+
if ($choice -in "1","cuda") { $Backend = "cuda" }
|
| 29 |
+
elseif ($choice -in "2","cpu") { $Backend = "cpu" }
|
| 30 |
+
else { Die "Unknown choice '$choice'" }
|
| 31 |
+
}
|
| 32 |
+
Info "Backend: $Backend"
|
| 33 |
+
|
| 34 |
+
# ββ 2. Python check ββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 35 |
+
if (-not (Get-Command python -ErrorAction SilentlyContinue)) {
|
| 36 |
+
Die "Python not found on PATH. Install 3.11/3.12 from python.org and tick 'Add Python to PATH'."
|
| 37 |
+
}
|
| 38 |
+
$pyver = ((python --version) 2>&1 | Out-String).Trim()
|
| 39 |
+
if ($pyver -notmatch '^Python 3\.\d+') {
|
| 40 |
+
Die "Could not read Python version (got '$pyver'). Is the Windows Store python alias interfering?"
|
| 41 |
+
}
|
| 42 |
+
if ($pyver -notmatch '^Python 3\.(11|12)\.') {
|
| 43 |
+
Warn "Found $pyver β the project targets 3.11/3.12. Continuing anyway."
|
| 44 |
+
}
|
| 45 |
+
Info "Found $pyver"
|
| 46 |
+
|
| 47 |
+
# ββ 3. Get the repo (skip clone if run from inside the repo) βββββββββ
|
| 48 |
+
if (-not (Test-Path "main.py")) {
|
| 49 |
+
if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
|
| 50 |
+
Die "git not found. Install from git-scm.com, or download the project ZIP and re-run from inside the folder."
|
| 51 |
+
}
|
| 52 |
+
Info "Cloning repository..."
|
| 53 |
+
git clone $RepoUrl
|
| 54 |
+
Set-Location "lambda-mindlink-memotron"
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
# ββ 4. Virtual environment βββββββββββββββββββββββββββββββββββββββββββ
|
| 58 |
+
if (-not (Test-Path ".venv")) {
|
| 59 |
+
Info "Creating virtual environment..."
|
| 60 |
+
python -m venv .venv
|
| 61 |
+
}
|
| 62 |
+
# Use the venv's python.exe directly β sidesteps Activate.ps1 execution-policy issues
|
| 63 |
+
$py = Join-Path (Get-Location) ".venv\Scripts\python.exe"
|
| 64 |
+
Info "Upgrading pip..."
|
| 65 |
+
& $py -m pip install --upgrade pip
|
| 66 |
+
|
| 67 |
+
# ββ 5. llama-cpp-python ββββββββββββββββββββββββββββββββββββββββββββββ
|
| 68 |
+
if ($Backend -eq "cuda") {
|
| 69 |
+
# Detect CUDA tag: nvcc (toolkit) first, then nvidia-smi (driver)
|
| 70 |
+
$detected = ""
|
| 71 |
+
if (Get-Command nvcc -ErrorAction SilentlyContinue) {
|
| 72 |
+
if ((nvcc --version | Out-String) -match 'release (\d+)\.(\d+)') { $detected = "cu$($Matches[1])$($Matches[2])" }
|
| 73 |
+
}
|
| 74 |
+
if (-not $detected -and (Get-Command nvidia-smi -ErrorAction SilentlyContinue)) {
|
| 75 |
+
if ((nvidia-smi | Out-String) -match 'CUDA Version:\s*(\d+)\.(\d+)') { $detected = "cu$($Matches[1])$($Matches[2])" }
|
| 76 |
+
}
|
| 77 |
+
if (-not $detected -or $detected -notin "cu118","cu121","cu122","cu123","cu124") {
|
| 78 |
+
if (-not $detected) { $detected = "cu121" }
|
| 79 |
+
else { Warn "Detected $detected has no prebuilt wheel β defaulting to cu121."; $detected = "cu121" }
|
| 80 |
+
}
|
| 81 |
+
$tag = Read-Host "CUDA wheel tag [default: $detected] (cu118, cu121, cu122, cu123, cu124)"
|
| 82 |
+
if (-not $tag) { $tag = $detected }
|
| 83 |
+
Info "Installing llama-cpp-python (CUDA wheel: $tag)..."
|
| 84 |
+
& $py -m pip install llama-cpp-python --extra-index-url "https://abetlen.github.io/llama-cpp-python/whl/$tag"
|
| 85 |
+
Warn "If pip says 'Building wheel for llama-cpp-python', no wheel matched β re-run with another tag."
|
| 86 |
+
}
|
| 87 |
+
else {
|
| 88 |
+
Info "Installing llama-cpp-python (CPU only)..."
|
| 89 |
+
& $py -m pip install llama-cpp-python
|
| 90 |
+
Warn "If pip compiles from source, install 'Visual Studio Build Tools' with the C++ workload."
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
# ββ 6. Remaining dependencies + ai folder βββββββββββββββββββββββββββββ
|
| 94 |
+
Info "Installing requirements.txt..."
|
| 95 |
+
& $py -m pip install -r requirements.txt
|
| 96 |
+
New-Item -ItemType Directory -Force -Path "ai" | Out-Null
|
| 97 |
+
|
| 98 |
+
# ββ 7. Done ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 99 |
+
Write-Host ""
|
| 100 |
+
Info "Installation complete."
|
| 101 |
+
Write-Host "Next steps:"
|
| 102 |
+
Write-Host " 1. Copy your .gguf files into: $(Get-Location)\ai\"
|
| 103 |
+
Write-Host " 2. Edit config.py (_ALPHA_INTELLIGENCE_TO_LOAD, _MODEL_TYPE)"
|
| 104 |
+
Write-Host " 3. Start the app:"
|
| 105 |
+
Write-Host " .\.venv\Scripts\Activate.ps1"
|
| 106 |
+
Write-Host " python main.py"
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
Optionally add a tiny `install.bat` so Windows users can just double-click:
|
| 110 |
+
|
| 111 |
+
```bat
|
| 112 |
+
@echo off
|
| 113 |
+
rem Double-click-friendly wrapper for install.ps1
|
| 114 |
+
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0install.ps1" %*
|
| 115 |
+
pause
|
install.sh
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# Lambda Mindlink Memotron β Linux installer
|
| 3 |
+
# Supports: Debian/Ubuntu/Mint (apt) and Fedora/RHEL (dnf/yum)
|
| 4 |
+
#
|
| 5 |
+
# Usage:
|
| 6 |
+
# ./install.sh # interactive menu
|
| 7 |
+
# ./install.sh cuda # non-interactive: cuda | rocm | cpu
|
| 8 |
+
set -euo pipefail
|
| 9 |
+
|
| 10 |
+
GREEN='\033[0;32m'; YELLOW='\033[1;33m'; RED='\033[0;31m'; NC='\033[0m'
|
| 11 |
+
info() { printf "${GREEN}[INFO]${NC} %s\n" "$*"; }
|
| 12 |
+
warn() { printf "${YELLOW}[WARN]${NC} %s\n" "$*"; }
|
| 13 |
+
die() { printf "${RED}[ERROR]${NC} %s\n" "$*" >&2; exit 1; }
|
| 14 |
+
|
| 15 |
+
REPO_URL="https://huggingface.co/AIMindLink/lambda-mindlink-memotron"
|
| 16 |
+
|
| 17 |
+
# ββ 1. Detect package manager ββββββββββββββββββββββββββββββββββββββββββ
|
| 18 |
+
if command -v apt-get >/dev/null 2>&1; then
|
| 19 |
+
PKGMGR="apt"
|
| 20 |
+
elif command -v dnf >/dev/null 2>&1; then
|
| 21 |
+
PKGMGR="dnf"
|
| 22 |
+
elif command -v yum >/dev/null 2>&1; then
|
| 23 |
+
PKGMGR="yum"
|
| 24 |
+
else
|
| 25 |
+
die "Neither apt nor dnf/yum found β this installer supports Debian/Ubuntu/Mint and Fedora/RHEL."
|
| 26 |
+
fi
|
| 27 |
+
info "Detected package manager: $PKGMGR"
|
| 28 |
+
|
| 29 |
+
# ββ 2. Choose backend ββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 30 |
+
if [[ $# -ge 1 ]]; then
|
| 31 |
+
BACKEND="${1,,}"
|
| 32 |
+
else
|
| 33 |
+
# Suggest a default from detected hardware
|
| 34 |
+
SUGGEST=3
|
| 35 |
+
if command -v nvidia-smi >/dev/null 2>&1; then
|
| 36 |
+
SUGGEST=1
|
| 37 |
+
elif command -v rocminfo >/dev/null 2>&1; then
|
| 38 |
+
SUGGEST=2
|
| 39 |
+
elif command -v lspci >/dev/null 2>&1 && lspci | grep -iE 'vga|3d|display' | grep -qi amd; then
|
| 40 |
+
SUGGEST=2
|
| 41 |
+
fi
|
| 42 |
+
echo
|
| 43 |
+
echo "Select llama-cpp-python backend:"
|
| 44 |
+
echo " 1) CUDA β NVIDIA GPU"
|
| 45 |
+
echo " 2) ROCm β AMD Ryzen iGPU / AMD dGPU"
|
| 46 |
+
echo " 3) CPU β no GPU (slow)"
|
| 47 |
+
read -rp "Choice [1-3, default $SUGGEST]: " BACKEND
|
| 48 |
+
BACKEND="${BACKEND:-$SUGGEST}"
|
| 49 |
+
fi
|
| 50 |
+
BACKEND="${BACKEND,,}"
|
| 51 |
+
case "$BACKEND" in
|
| 52 |
+
1|cuda) BACKEND="cuda" ;;
|
| 53 |
+
2|rocm) BACKEND="rocm" ;;
|
| 54 |
+
3|cpu) BACKEND="cpu" ;;
|
| 55 |
+
*) die "Unknown backend '$BACKEND' (use: cuda, rocm or cpu)" ;;
|
| 56 |
+
esac
|
| 57 |
+
info "Backend: $BACKEND"
|
| 58 |
+
|
| 59 |
+
# ββ 3. System build tools ββββββββββββββββββββββββββββββββββββββββββββββ
|
| 60 |
+
case "$PKGMGR" in
|
| 61 |
+
apt)
|
| 62 |
+
info "Installing build tools (build-essential, cmake, python3-dev, python3-venv, git)..."
|
| 63 |
+
sudo apt-get update
|
| 64 |
+
sudo apt-get install -y build-essential cmake python3-dev python3-venv git
|
| 65 |
+
;;
|
| 66 |
+
dnf|yum)
|
| 67 |
+
info "Installing build tools (gcc-c++, cmake, python3-devel, git)..."
|
| 68 |
+
sudo "$PKGMGR" install -y gcc-c++ cmake python3 python3-devel git
|
| 69 |
+
;;
|
| 70 |
+
esac
|
| 71 |
+
|
| 72 |
+
# ββ 4. Python version check (project targets 3.11 / 3.12) βββββββββββββ
|
| 73 |
+
if ! python3 -c 'import sys; sys.exit(0 if sys.version_info[:2] in ((3, 11), (3, 12)) else 1)'; then
|
| 74 |
+
warn "Found $(python3 --version 2>&1) β the project targets 3.11/3.12. Continuing anyway."
|
| 75 |
+
fi
|
| 76 |
+
|
| 77 |
+
# ββ 5. Get the repo (skip clone if script is run from inside the repo) β
|
| 78 |
+
if [[ ! -f main.py ]]; then
|
| 79 |
+
info "main.py not found here β cloning repository..."
|
| 80 |
+
git clone "$REPO_URL"
|
| 81 |
+
cd lambda-mindlink-memotron
|
| 82 |
+
fi
|
| 83 |
+
|
| 84 |
+
# ββ 6. Virtual environment ββββββββββββββββββββββββββββββββββββββββββββ
|
| 85 |
+
if [[ ! -d .venv ]]; then
|
| 86 |
+
info "Creating virtual environment..."
|
| 87 |
+
python3 -m venv .venv
|
| 88 |
+
fi
|
| 89 |
+
source .venv/bin/activate
|
| 90 |
+
info "Upgrading pip..."
|
| 91 |
+
pip install --upgrade pip
|
| 92 |
+
|
| 93 |
+
# ββ 7. llama-cpp-python for the chosen backend βββββββββββββββββββββββββ
|
| 94 |
+
case "$BACKEND" in
|
| 95 |
+
cuda)
|
| 96 |
+
command -v nvcc >/dev/null 2>&1 || \
|
| 97 |
+
warn "nvcc not found β install the NVIDIA CUDA Toolkit 12.x first, or this build will fail."
|
| 98 |
+
info "Installing llama-cpp-python with CUDA support..."
|
| 99 |
+
CMAKE_ARGS="-DGGML_CUDA=on" pip install llama-cpp-python \
|
| 100 |
+
--upgrade --force-reinstall --no-cache-dir
|
| 101 |
+
;;
|
| 102 |
+
rocm)
|
| 103 |
+
if [[ "$PKGMGR" == "apt" ]]; then
|
| 104 |
+
read -rp "Also install ROCm dev packages via apt (hipblas-dev rocblas-dev)? [y/N] " yn
|
| 105 |
+
if [[ "${yn,,}" == "y" || "${yn,,}" == "yes" ]]; then
|
| 106 |
+
sudo apt-get install -y hipblas-dev rocblas-dev
|
| 107 |
+
fi
|
| 108 |
+
fi
|
| 109 |
+
info "Installing llama-cpp-python with ROCm support..."
|
| 110 |
+
CMAKE_ARGS="-DGGML_HIPBLAS=on" pip install llama-cpp-python \
|
| 111 |
+
--upgrade --force-reinstall --no-cache-dir
|
| 112 |
+
;;
|
| 113 |
+
cpu)
|
| 114 |
+
info "Installing llama-cpp-python (CPU only)..."
|
| 115 |
+
pip install llama-cpp-python --upgrade --force-reinstall --no-cache-dir
|
| 116 |
+
;;
|
| 117 |
+
esac
|
| 118 |
+
|
| 119 |
+
# ββ 8. Remaining dependencies + ai folder ββββββββββββββββββββββββββββββ
|
| 120 |
+
info "Installing requirements.txt..."
|
| 121 |
+
pip install -r requirements.txt
|
| 122 |
+
mkdir -p ai
|
| 123 |
+
|
| 124 |
+
# ββ 9. Done ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 125 |
+
echo
|
| 126 |
+
info "Installation complete."
|
| 127 |
+
echo "Next steps:"
|
| 128 |
+
echo " 1. Copy your .gguf files into: $(pwd)/ai/"
|
| 129 |
+
echo " 2. Edit config.py (_ALPHA_INTELLIGENCE_TO_LOAD, _MODEL_TYPE)"
|
| 130 |
+
echo " 3. Start the app:"
|
| 131 |
+
echo " source .venv/bin/activate"
|
| 132 |
+
echo " python main.py"
|