Files
hermes-portable-rescue/build/output/start-llama-server.bat
T
shawn 6623d4d1fd fix: correct ISO rebuild paths and update GPU detection for USB structure
- Fixed quick-rebuild-iso.sh paths from /hermes/ to /opt/hermes/
- Fixed ISO boot structure (uses GRUB eltorito/efi, not isolinux)
- Added MBR extraction fallback for xorriso
- Updated start-llama-server.bat to reference existing USB paths
  (bin/ollama/, Llama-3.2-1B model, llama-server-vulkan.exe)
- Works with existing USB structure — no restructure needed
- All bat files: ASCII text, CRLF line terminators
2026-07-10 01:41:26 -04:00

245 lines
4.2 KiB
Batchfile

@echo off
title Hermes Portable - Offline LLM Server with GPU Detection
:: ==============================================================================
:: Hermes Portable Rescue - llama-server launcher with multi-brand GPU detection
:: ==============================================================================
:: Detects GPU brand (NVIDIA, AMD, Intel, integrated) and launches the
:: appropriate llama-server build (Vulkan for GPU, CPU-only fallback).
:: ==============================================================================
setlocal enabledelayedexpansion
cd /d "%~dp0"
set LLAMA_DIR=%~dp0bin\ollama
set MODEL=%LLAMA_DIR%\Llama-3.2-1B-Instruct-Q4_K_M.gguf
set PORT=11434
set GPU_FOUND=0
echo.
echo ============================================
echo Hermes LLM Server - GPU Detection
echo ============================================
echo.
:: --- Detection 1: nvidia-smi (NVIDIA) --------------------------------------
nvidia-smi >nul 2>&1
if !errorlevel! equ 0 (
for /f "tokens=*" %%a in ('nvidia-smi --query-gpu=name --format=csv,noheader 2^>nul') do (
set GPU_NAME=%%a
)
echo [OK] NVIDIA GPU detected: !GPU_NAME!
set GPU_FOUND=1
)
:: --- Detection 2: WMIC - check for AMD/Intel GPUs ---------------------------
if !GPU_FOUND! equ 0 (
wmic path win32_videocontroller get name 2>nul | findstr /i "nvidia" >nul
if !errorlevel! equ 0 (
echo [OK] NVIDIA GPU detected via WMI
set GPU_FOUND=1
) else (
wmic path win32_videocontroller get name 2>nul | findstr /i "amd radeon" >nul
if !errorlevel! equ 0 (
echo [OK] AMD GPU detected via WMI
set GPU_FOUND=1
) else (
wmic path win32_videocontroller get name 2>nul | findstr /i "intel arc" >nul
if !errorlevel! equ 0 (
echo [OK] Intel GPU detected via WMI
set GPU_FOUND=1
) else (
wmic path win32_videocontroller get name 2>nul | findstr /i "intel hd intel iris intel uhd" >nul
if !errorlevel! equ 0 (
echo [OK] Intel integrated graphics detected via WMI
set GPU_FOUND=1
)
)
)
)
)
:: --- Detection 3: vulkaninfo (direct Vulkan probe) ---------------------------
if !GPU_FOUND! equ 0 (
where vulkaninfo >nul 2>&1
if !errorlevel! equ 0 (
vulkaninfo --summary 2>nul | findstr /c:"Vulkan Instance" >nul
if !errorlevel! equ 0 (
echo [OK] Vulkan-capable device detected
set GPU_FOUND=1
)
)
)
:: --- Check model exists ----------------------------------------------------
if not exist "!MODEL!" (
echo [ERROR] Model not found: !MODEL!
echo.
echo Please download a GGUF model and place it at:
echo !MODEL!
echo.
pause
exit /b 1
)
:: --- Launch ----------------------------------------------------------------
if !GPU_FOUND! equ 1 (
echo.
echo [*] Starting llama-server with GPU acceleration (Vulkan)...
echo [*] Model: Llama-3.2-1B (Q4_K_M)
echo [*] Server: http://127.0.0.1:!PORT!/v1
echo [*] Flags: --n-gpu-layers 99 --mlock --cont-batching -c 4096
echo.
echo [*] Press Ctrl+C to stop the server.
echo.
"!LLAMA_DIR!\llama-server-vulkan.exe" ^
--host 127.0.0.1 --port !PORT! ^
-m "!MODEL!" ^
--n-gpu-layers 99 ^
--mlock ^
--cont-batching ^
-c 4096
) else (
echo.
echo [*] No compatible GPU found. Starting CPU-only mode.
echo [*] Model: Llama-3.2-1B (Q4_K_M)
echo [*] Server: http://127.0.0.1:!PORT!/v1
echo [*] Flags: --mlock --cont-batching -c 4096
echo.
echo [*] Press Ctrl+C to stop the server.
echo.
"!LLAMA_DIR!\llama-server.exe" ^
--host 127.0.0.1 --port !PORT! ^
-m "!MODEL!" ^
--mlock ^
--cont-batching ^
-c 4096
)
echo.
echo [*] Server exited with code !errorlevel!
pause