54 lines
1.9 KiB
CMake
54 lines
1.9 KiB
CMake
function(expect output required)
|
|
string(FIND "${output}" "${required}" match)
|
|
if(match EQUAL -1)
|
|
message(FATAL_ERROR "missing '${required}' in: ${output}")
|
|
endif()
|
|
endfunction()
|
|
|
|
execute_process(
|
|
COMMAND "${GEM}" serve --dry-run --model /tmp/model.gguf --mmproj /tmp/mmproj.gguf --port 9090 --flash-attn on
|
|
RESULT_VARIABLE result
|
|
OUTPUT_VARIABLE output
|
|
ERROR_VARIABLE error)
|
|
if(NOT result EQUAL 0)
|
|
message(FATAL_ERROR "serve dry run failed: ${error}")
|
|
endif()
|
|
expect("${output}" "--gpu-layers all")
|
|
expect("${output}" "--threads 12 --threads-batch 12")
|
|
expect("${output}" "--ctx-size 32768")
|
|
expect("${output}" "--flash-attn on")
|
|
expect("${output}" "--mmproj /tmp/mmproj.gguf --mmproj-offload")
|
|
expect("${output}" "--host 127.0.0.1 --port 9090")
|
|
|
|
execute_process(
|
|
COMMAND "${GEM}" bench --dry-run --model /tmp/model.gguf --mmproj /tmp/mmproj.gguf
|
|
RESULT_VARIABLE result
|
|
ERROR_VARIABLE error)
|
|
if(result EQUAL 0)
|
|
message(FATAL_ERROR "bench accepted unsupported --mmproj")
|
|
endif()
|
|
expect("${error}" "--mmproj is only valid with serve")
|
|
|
|
execute_process(
|
|
COMMAND "${GEM}" hax --dry-run --port 9090 --model gemma-4-31b
|
|
RESULT_VARIABLE result
|
|
OUTPUT_VARIABLE output
|
|
ERROR_VARIABLE error)
|
|
if(NOT result EQUAL 0)
|
|
message(FATAL_ERROR "hax dry run failed: ${error}")
|
|
endif()
|
|
expect("${output}" "HAX_LLAMACPP_BASE_URL=http://127.0.0.1:9090/v1")
|
|
expect("${output}" "hax --provider=llama.cpp --model gemma-4-31b")
|
|
|
|
execute_process(
|
|
COMMAND "${GEM}" agent --dry-run --model /tmp/model.gguf --port 9090
|
|
RESULT_VARIABLE result
|
|
OUTPUT_VARIABLE output
|
|
ERROR_VARIABLE error)
|
|
if(NOT result EQUAL 0)
|
|
message(FATAL_ERROR "agent dry run failed: ${error}")
|
|
endif()
|
|
expect("${output}" "--model /tmp/model.gguf")
|
|
expect("${output}" "--host 127.0.0.1 --port 9090")
|
|
expect("${output}" "HAX_LLAMACPP_BASE_URL=http://127.0.0.1:9090/v1")
|
|
expect("${output}" "hax --provider=llama.cpp --model gemma-4-31b")
|