char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
0177dcc73
char/aliceai-t5-moe
1:: MIT license 2:: Copyright (C) 2024 Intel Corporation 3:: SPDX-License-Identifier: MIT 4 5@echo off 6set local EnableExtensions EnableDelayedExpansion 7 8set "BIN_FILE=.\build\bin\llama-server.exe" 9set "SEED=0" 10set "GPUS_SETTING=" 11 12set "MODEL_FILE=..\models\Qwen3.5-4B-Q4_0.gguf" 13set "NGL=99" 14set "CONTEXT=4096" 15set "GGML_SYCL_DEVICE=-1" 16set "SYCL_DEVICES=SYCL0" 17set "SPLIT_MODE=layer" 18set "LOG_VERBOSE=3" 19 20if "%~1" ==""goto after_args 21 22:parse_args 23if "%~1" ==""goto after_args 24 25if / I "%~1" =="-c " ( 26if "%~2" ==""goto missing_value 27set "CONTEXT=%~2" 28shift 29shift 30goto parse_args 31) 32if / I "%~1" =="--context " ( 33if "%~2" ==""goto missing_value 34set "CONTEXT=%~2" 35shift 36shift 37goto parse_args 38) 39 40if / I "%~1" =="-d " ( 41if "%~2" ==""goto missing_value 42set "SYCL_DEVICES=%~2" 43shift 44shift 45goto parse_args 46) 47if / I "%~1" =="--device " ( 48if "%~2" ==""goto missing_value 49set "SYCL_DEVICES=%~2" 50shift 51shift 52goto parse_args 53) 54 55if / I "%~1" =="-m " ( 56if "%~2" ==""goto missing_value 57set "MODEL_FILE=%~2" 58shift 59shift 60goto parse_args 61) 62if / I "%~1" =="--model " ( 63if "%~2" ==""goto missing_value 64set "MODEL_FILE=%~2" 65shift 66shift 67goto parse_args 68) 69 70if / I "%~1" =="-mg " ( 71if "%~2" ==""goto missing_value 72set "GGML_SYCL_DEVICE=%~2" 73set "SPLIT_MODE=none" 74shift 75shift 76goto parse_args 77) 78if / I "%~1" =="--main -gpu " ( 79if "%~2" ==""goto missing_value 80set "GGML_SYCL_DEVICE=%~2" 81set "SPLIT_MODE=none" 82shift 83shift 84goto parse_args 85) 86 87if / I "%~1" =="-sm " ( 88if "%~2" ==""goto missing_value 89set "SPLIT_MODE=%~2" 90shift 91shift 92goto parse_args 93) 94if / I "%~1" =="--split -mode " ( 95if "%~2" ==""goto missing_value 96set "SPLIT_MODE=%~2" 97shift 98shift 99goto parse_args 100) 101 102if / I "%~1" =="-ngl " ( 103if "%~2" ==""goto missing_value 104set "NGL=%~2" 105shift 106shift 107goto parse_args 108) 109if / I "%~1" =="--n -gpu -layers " ( 110if "%~2" ==""goto missing_value 111set "NGL=%~2" 112shift 113shift 114goto parse_args 115) 116 117if / I "%~1" =="-lv " ( 118if "%~2" ==""goto missing_value 119set "LOG_VERBOSE=%~2" 120shift 121shift 122goto parse_args 123) 124if / I "%~1" =="--log -verbosity " ( 125if "%~2" ==""goto missing_value 126set "LOG_VERBOSE=%~2" 127shift 128shift 129goto parse_args 130) 131 132if / I "%~1" =="-h "goto help 133if / I "%~1" =="--help " goto help 134 135echo Invalid option: %~1 136exit /b 1 137 138:missing_value 139echo Missing value for option: %~1 140exit /b 1 141 142:help 143echo Usage: %~n0 [OPTIONS] 144echo. 145echo This script processes files with specified options. 146echo. 147echo Options: 148echo -h, --help Display this help message and exit. 149echo -d, --device ^<value^> Set SYCL devices (default: SYCL0). 150echo -c, --context ^<value^> Set context length. Bigger need more memory. 151echo -m, --model ^<value^> Full model file path. 152echo -mg,--main-gpu ^<value^> Set main GPU ID (0 - n) for single GPU mode. 153echo -sm,--split-mode ^<value^> How to split the model across multiple GPUs, one of: 154echo - none: use one GPU only 155echo - layer (default): split layers and KV across GPUs 156echo - row: split rows across GPUs 157echo -ngl,--n-gpu-layers ^<value^> Max. number of layers to store in VRAM (default: -1) 158echo -lv,--log-verbosity ^<value^> Set the verbosity threshold. Messages with a higher verbosity will be 159echo ignored. Values: 160echo - 0: generic output 161echo - 1: error 162echo - 2: warning 163echo - 3: info 164echo - 4: debug 165exit /b 0 166 167:after_args 168 169REM In Windows CMD, source is not available; call oneAPI setvars if present. 170if exist " C :\Program Files (x86 )\Intel \oneAPI \setvars .bat " ( 171call "C :\Program Files (x86 )\Intel \oneAPI \setvars .bat " >nul 172)else ( 173 echoWarning :oneAPI setvars .bat not found .Continuing without environment setup . 174) 175 176REMSupport malloc device memory more than 4 GB . 177set "UR_L0_ENABLE_RELAXED_ALLOCATION_LIMITS =1 " 178echoUR_L0_ENABLE_RELAXED_ALLOCATION_LIMITS =%UR_L0_ENABLE_RELAXED_ALLOCATION_LIMITS % 179 180echoONEAPI_DEVICE_SELECTOR =%ONEAPI_DEVICE_SELECTOR % 181 182ifnot "%GGML_SYCL_DEVICE %"=="-1 " ( 183 echoUse %GGML_SYCL_DEVICE %as main GPU 184 REMUse single GPU only . 185 set "GPUS_SETTING =-mg %GGML_SYCL_DEVICE % -sm %SPLIT_MODE %" 186 )else ( 187 echoUse Intel GPUs : %SYCL_DEVICES % 188 set "GPUS_SETTING =-sm %SPLIT_MODE %" 189) 190 191echorun cmd:ZES_ENABLE_SYSMAN =1 %BIN_FILE % -m "%MODEL_FILE %" -ngl %NGL % -s %SEED % -c %CONTEXT % %GPUS_SETTING % -lv %LOG_VERBOSE % --device %SYCL_DEVICES % --load -mode auto --host 0 .0 .0 .0 --port 8000 192set "ZES_ENABLE_SYSMAN =1 " 193%BIN_FILE % -m "%MODEL_FILE %" -ngl %NGL % -s %SEED % -c %CONTEXT % %GPUS_SETTING % -lv %LOG_VERBOSE % --device "%SYCL_DEVICES %" --load -mode auto --host 0 .0 .0 .0 --port 8000 194 195endlocal 196