From: Georgi Gerganov Date: Sat, 23 Dec 2023 15:49:08 +0000 (+0200) Subject: scripts : add sync-llama-am.sh X-Git-Tag: upstream/0.0.1642~1169 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=d27f36bb6964d9f623f67a7289e17a1579bea561;p=pkg%2Fggml%2Fsources%2Fggml scripts : add sync-llama-am.sh --- diff --git a/scripts/sync-llama-am.sh b/scripts/sync-llama-am.sh new file mode 100755 index 00000000..28a7c992 --- /dev/null +++ b/scripts/sync-llama-am.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# +# Synchronize llama.cpp changes to ggml +# +# Usage: +# +# $ cd /path/to/ggml +# $ ./scripts/sync-llama-am.sh +# + +set -e + +sd=$(dirname $0) +cd $sd/../ + +SRC_GGML=$(pwd) +SRC_LLAMA=$(cd ../llama.cpp; pwd) + +if [ ! -d $SRC_LLAMA ]; then + echo "llama.cpp not found at $SRC_LLAMA" + exit 1 +fi + +lc=$(cat $SRC_GGML/scripts/sync-llama.last) +echo "Syncing llama.cpp changes since commit $lc" + +cd $SRC_LLAMA + +git log --oneline $lc..HEAD +git format-patch $lc --stdout -- ggml* > $SRC_GGML/llama-am.patch + +cd $SRC_GGML + +# replace PR numbers +# Subject: [PATCH] some text (#1234) +# Subject: [PATCH] some text (llama/1234) +cat llama-am.patch | sed -e 's/^Subject: \[PATCH\] \(.*\) (#\([0-9]*\))/Subject: [PATCH] \1 (llama\/\2)/' > llama-am.patch.tmp +mv llama-am.patch.tmp llama-am.patch + +git am -p1 --directory src llama-am.patch + +# update last commit +cd ../llama.cpp +git log -1 --format=%H > $SRC_GGML/scripts/sync-llama.last + +# clean up +rm -v $SRC_GGML/llama-am.patch + +echo "Done" + +exit 0 diff --git a/scripts/sync-llama.last b/scripts/sync-llama.last new file mode 100644 index 00000000..5813bd9f --- /dev/null +++ b/scripts/sync-llama.last @@ -0,0 +1 @@ +ba661751322a7c201fd3bef71af077c5aebfaa2a