CoolFace
Modelpublic

Felipe97/llama-cpp-compiled

sourceHugging Faceupdated 3d agoView on Hugging Face
0likes1.1kdownloads
win-test.bat220 linesDownload Raw Back to sycl
1::  MIT license2::  Copyright (C) 2024 Intel Corporation3::  SPDX-License-Identifier: MIT4 5 6@echo off7setlocal EnableExtensions EnableDelayedExpansion8 9REM MIT license10REM Copyright (C) 2024 Intel Corporation11REM SPDX-License-Identifier: MIT12 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_args27 28:parse_args29if "%~1"=="" goto after_args30 31if /I "%~1"=="-c" (32  if "%~2"=="" goto missing_value33  set "CONTEXT=%~2"34  shift35  shift36  goto parse_args37)38if /I "%~1"=="--context" (39  if "%~2"=="" goto missing_value40  set "CONTEXT=%~2"41  shift42  shift43  goto parse_args44)45 46if /I "%~1"=="-d" (47  if "%~2"=="" goto missing_value48  set "SYCL_DEVICES=%~2"49  shift50  shift51  goto parse_args52)53if /I "%~1"=="--device" (54  if "%~2"=="" goto missing_value55  set "SYCL_DEVICES=%~2"56  shift57  shift58  goto parse_args59)60 61if /I "%~1"=="-p" (62  if "%~2"=="" goto missing_value63  set "INPUT_PROMPT=%~2"64  shift65  shift66  goto parse_args67)68if /I "%~1"=="--promote" (69  if "%~2"=="" goto missing_value70  set "INPUT_PROMPT=%~2"71  shift72  shift73  goto parse_args74)75 76if /I "%~1"=="-m" (77  if "%~2"=="" goto missing_value78  set "MODEL_FILE=%~2"79  shift80  shift81  goto parse_args82)83if /I "%~1"=="--model" (84  if "%~2"=="" goto missing_value85  set "MODEL_FILE=%~2"86  shift87  shift88  goto parse_args89)90 91if /I "%~1"=="-mg" (92  if "%~2"=="" goto missing_value93  set "GGML_SYCL_DEVICE=%~2"94  set "SPLIT_MODE=none"95  shift96  shift97  goto parse_args98)99if /I "%~1"=="--main-gpu" (100  if "%~2"=="" goto missing_value101  set "GGML_SYCL_DEVICE=%~2"102  set "SPLIT_MODE=none"103  shift104  shift105  goto parse_args106)107 108if /I "%~1"=="-sm" (109  if "%~2"=="" goto missing_value110  set "SPLIT_MODE=%~2"111  shift112  shift113  goto parse_args114)115if /I "%~1"=="--split-mode" (116  if "%~2"=="" goto missing_value117  set "SPLIT_MODE=%~2"118  shift119  shift120  goto parse_args121)122 123if /I "%~1"=="-ngl" (124  if "%~2"=="" goto missing_value125  set "NGL=%~2"126  shift127  shift128  goto parse_args129)130if /I "%~1"=="--n-gpu-layers" (131  if "%~2"=="" goto missing_value132  set "NGL=%~2"133  shift134  shift135  goto parse_args136)137 138if /I "%~1"=="-lv" (139  if "%~2"=="" goto missing_value140  set "LOG_VERBOSE=%~2"141  shift142  shift143  goto parse_args144)145if /I "%~1"=="--log-verbosity" (146  if "%~2"=="" goto missing_value147  set "LOG_VERBOSE=%~2"148  shift149  shift150  goto parse_args151)152 153if /I "%~1"=="-h" goto help154if /I "%~1"=="--help" goto help155 156echo Invalid option: %~1157exit /b 1158 159:missing_value160echo Missing value for option: %~1161exit /b 1162 163:help164echo 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 only177echo                             - layer (default): split layers and KV across GPUs178echo                             - row: split rows across GPUs179echo   -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 be181echo                                ignored. Values:182echo                                 - 0: generic output183echo                                 - 1: error184echo                                 - 2: warning185echo                                 - 3: info186echo                                 - 4: debug187exit /b 0188 189:after_args190 191REM In Windows CMD, source is not available; call oneAPI setvars if present.192if exist "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" (193  call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" >nul194) else (195  echo Warning: oneAPI setvars.bat not found. Continuing without environment setup.196)197 198REM Support malloc device memory more than 4GB.199set "UR_L0_ENABLE_RELAXED_ALLOCATION_LIMITS=1"200echo UR_L0_ENABLE_RELAXED_ALLOCATION_LIMITS=%UR_L0_ENABLE_RELAXED_ALLOCATION_LIMITS%201 202echo ONEAPI_DEVICE_SELECTOR=%ONEAPI_DEVICE_SELECTOR%203 204if not "%GGML_SYCL_DEVICE%"=="-1" (205  echo Use %GGML_SYCL_DEVICE% as main GPU206  REM Use single GPU only.207  set "GPUS_SETTING=-mg %GGML_SYCL_DEVICE% -sm %SPLIT_MODE%"208  )209else (210  echo Use Intel GPUs: %SYCL_DEVICES%211  set "GPUS_SETTING=-sm %SPLIT_MODE%"212)213 214echo run 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 auto215set "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 auto217 218endlocal219 220