]> git.djapps.eu Git - pkg/ggml/sources/ggml/commitdiff
scripts : add sync-llama-am.sh
authorGeorgi Gerganov <redacted>
Sat, 23 Dec 2023 15:49:08 +0000 (17:49 +0200)
committerGeorgi Gerganov <redacted>
Sat, 23 Dec 2023 15:49:08 +0000 (17:49 +0200)
scripts/sync-llama-am.sh [new file with mode: 0755]
scripts/sync-llama.last [new file with mode: 0644]

diff --git a/scripts/sync-llama-am.sh b/scripts/sync-llama-am.sh
new file mode 100755 (executable)
index 0000000..28a7c99
--- /dev/null
@@ -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 (file)
index 0000000..5813bd9
--- /dev/null
@@ -0,0 +1 @@
+ba661751322a7c201fd3bef71af077c5aebfaa2a