diff --git a/examples/talk-llama/CMakeLists.txt b/examples/talk-llama/CMakeLists.txt index fbb9b008a..82b34781b 100644 --- a/examples/talk-llama/CMakeLists.txt +++ b/examples/talk-llama/CMakeLists.txt @@ -4,11 +4,11 @@ if (WHISPER_SDL2) if (WHISPER_USE_SYSTEM_LLAMA) message(STATUS "Using system-provided llama.cpp, skipping llama.cpp fetch") - find_package(llama 0.1.2 REQUIRED) + find_package(llama 0.3.0 REQUIRED) else() include(FetchContent) - set(LLAMA_TAG "v0.1.2") + set(LLAMA_TAG "v0.3.0") set(LLAMA_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) set(LLAMA_BUILD_TESTS OFF CACHE BOOL "" FORCE) diff --git a/scripts/sync-llama.sh b/scripts/sync-llama.sh index b54280308..59ed697a0 100755 --- a/scripts/sync-llama.sh +++ b/scripts/sync-llama.sh @@ -1,11 +1,20 @@ #!/bin/bash +# note: run from the whisper.cpp root directory +set -euo pipefail -cp -rpv ../llama.cpp/include/llama.h ./examples/talk-llama/llama.h +# read the current llama.cpp version from the neighboring repo +LLAMA_VERSION=$(sed -nE 's/^set\(LLAMA_VERSION_(MAJOR|MINOR|PATCH) ([0-9]+)\)$/\2/p' ../llama.cpp/CMakeLists.txt | paste -sd. -) -cp -rpv ../llama.cpp/src/llama*.cpp ./examples/talk-llama/ -cp -rpv ../llama.cpp/src/llama*.h ./examples/talk-llama/ -cp -rpv ../llama.cpp/src/models/* ./examples/talk-llama/models/ -cp -rpv ../llama.cpp/src/unicode.h ./examples/talk-llama/unicode.h -cp -rpv ../llama.cpp/src/unicode.cpp ./examples/talk-llama/unicode.cpp -cp -rpv ../llama.cpp/src/unicode-data.h ./examples/talk-llama/unicode-data.h -cp -rpv ../llama.cpp/src/unicode-data.cpp ./examples/talk-llama/unicode-data.cpp +if [ -z "${LLAMA_VERSION}" ]; then + echo "error: could not read llama.cpp version from ../llama.cpp/CMakeLists.txt" >&2 + exit 1 +fi + +# update the version number in examples/talk-llama/CMakeLists.txt +sed -i.bak \ + -E -e "s/(find_package[(]llama )[0-9]+\.[0-9]+\.[0-9]+/\1${LLAMA_VERSION}/" \ + -e "s/(set[(]LLAMA_TAG \"v)[0-9]+\.[0-9]+\.[0-9]+/\1${LLAMA_VERSION}/" \ + examples/talk-llama/CMakeLists.txt +rm examples/talk-llama/CMakeLists.txt.bak + +echo "synced llama.cpp version: ${LLAMA_VERSION}"