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