initial release
This commit is contained in:
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
printf "# date: $(date)\n" > AUTHORS
|
||||
printf "# this file is auto-generated by scripts/gen-authors.sh\n\n" >> AUTHORS
|
||||
|
||||
git log --format='%an <%ae>' --reverse --date=short master | awk '!seen[$0]++' | sort >> AUTHORS
|
||||
|
||||
# if necessary, update your name here. for example: jdoe -> John Doe
|
||||
sed -i '' 's/^jdoe/John Doe/g' AUTHORS
|
||||
Executable
+296
@@ -0,0 +1,296 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Automated release script for ggml.
|
||||
#
|
||||
# Note: Sync from llama.cpp should be done separately via PR process
|
||||
# prior to running this script.
|
||||
#
|
||||
# Usage:
|
||||
# ./scripts/release.sh prepare [major|minor|patch] [--dry-run]
|
||||
# ./scripts/release.sh finalize [--dry-run]
|
||||
#
|
||||
# Two-stage release process:
|
||||
#
|
||||
# Stage 1 - Prepare:
|
||||
# $ ./scripts/release.sh prepare minor
|
||||
# This creates a release candidate branch with version bump and removes -dev suffix.
|
||||
# The branch should then be manually pushed and a PR created, reviewed, and merged.
|
||||
#
|
||||
# Stage 2 - Finalize:
|
||||
# $ ./scripts/release.sh finalize
|
||||
# After the RC PR is merged, this reads the current version from CMakeLists.txt,
|
||||
# creates the release tag, and prepares the next development cycle.
|
||||
#
|
||||
# Prepare stage:
|
||||
# 1. Creates release candidate branch
|
||||
# 2. Updates version and removes -dev suffix
|
||||
# 3. Commits the version bump
|
||||
#
|
||||
# Finalize stage:
|
||||
# 1. Reads current release version from CMakeLists.txt
|
||||
# 2. Creates signed git tag on master
|
||||
# 3. Adds -dev suffix back for next development cycle
|
||||
# 4. Creates branch and commit for development version
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
if [ ! -f "CMakeLists.txt" ] || [ ! -d "scripts" ]; then
|
||||
echo "Error: Must be run from ggml root directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Parse command line arguments
|
||||
COMMAND=""
|
||||
VERSION_TYPE=""
|
||||
DRY_RUN=false
|
||||
|
||||
# First argument should be the command
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Error: Missing command"
|
||||
echo "Usage: $0 prepare [major|minor|patch] [--dry-run]"
|
||||
echo " $0 finalize [--dry-run]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
COMMAND="$1"
|
||||
shift
|
||||
|
||||
# Parse remaining arguments
|
||||
for arg in "$@"; do
|
||||
case $arg in
|
||||
--dry-run)
|
||||
DRY_RUN=true
|
||||
;;
|
||||
major|minor|patch)
|
||||
if [ "$COMMAND" = "prepare" ]; then
|
||||
VERSION_TYPE="$arg"
|
||||
else
|
||||
echo "Error: Version type only valid for 'prepare' command"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Error: Unknown argument '$arg'"
|
||||
echo "Usage: $0 prepare [major|minor|patch] [--dry-run]"
|
||||
echo " $0 finalize [--dry-run]"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Validate command
|
||||
if [[ ! "$COMMAND" =~ ^(prepare|finalize)$ ]]; then
|
||||
echo "Error: Command must be 'prepare' or 'finalize'"
|
||||
echo "Usage: $0 prepare [major|minor|patch] [--dry-run]"
|
||||
echo " $0 finalize [--dry-run]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For prepare command, default to patch if no version type specified
|
||||
if [ "$COMMAND" = "prepare" ]; then
|
||||
VERSION_TYPE="${VERSION_TYPE:-patch}"
|
||||
if [[ ! "$VERSION_TYPE" =~ ^(major|minor|patch)$ ]]; then
|
||||
echo "Error: Version type must be 'major', 'minor', or 'patch'"
|
||||
echo "Usage: $0 prepare [major|minor|patch] [--dry-run]"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Common validation functions
|
||||
check_git_status() {
|
||||
# Check for uncommitted changes (skip in dry-run)
|
||||
if [ "$DRY_RUN" = false ] && ! git diff-index --quiet HEAD --; then
|
||||
echo "Error: You have uncommitted changes. Please commit or stash them first."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_master_branch() {
|
||||
# Ensure we're on master branch
|
||||
CURRENT_BRANCH=$(git branch --show-current)
|
||||
if [ "$CURRENT_BRANCH" != "master" ]; then
|
||||
if [ "$DRY_RUN" = true ]; then
|
||||
echo "[dry run] Warning: Not on master branch (currently on: $CURRENT_BRANCH). Continuing with dry-run..."
|
||||
echo ""
|
||||
else
|
||||
echo "Error: Must be on master branch. Currently on: $CURRENT_BRANCH"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
check_master_up_to_date() {
|
||||
# Check if we have the latest from master (skip in dry-run)
|
||||
if [ "$DRY_RUN" = false ]; then
|
||||
echo "Checking if local master is up-to-date with remote..."
|
||||
git fetch origin master
|
||||
LOCAL=$(git rev-parse HEAD)
|
||||
REMOTE=$(git rev-parse origin/master)
|
||||
|
||||
if [ "$LOCAL" != "$REMOTE" ]; then
|
||||
echo "Error: Your local master branch is not up-to-date with origin/master."
|
||||
echo "Please run 'git pull origin master' first."
|
||||
exit 1
|
||||
fi
|
||||
echo "✓ Local master is up-to-date with remote"
|
||||
echo ""
|
||||
elif [ "$(git branch --show-current)" = "master" ]; then
|
||||
echo "[dry run] Warning: Dry-run mode - not checking if master is up-to-date with remote"
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
prepare_release() {
|
||||
if [ "$DRY_RUN" = true ]; then
|
||||
echo "[dry-run] Preparing release (no changes will be made)"
|
||||
else
|
||||
echo "Starting release preparation..."
|
||||
fi
|
||||
echo ""
|
||||
|
||||
check_git_status
|
||||
check_master_branch
|
||||
check_master_up_to_date
|
||||
|
||||
# Extract current version from CMakeLists.txt
|
||||
echo "Step 1: Reading current version..."
|
||||
MAJOR=$(grep "set(GGML_VERSION_MAJOR" CMakeLists.txt | sed 's/.*MAJOR \([0-9]*\).*/\1/')
|
||||
MINOR=$(grep "set(GGML_VERSION_MINOR" CMakeLists.txt | sed 's/.*MINOR \([0-9]*\).*/\1/')
|
||||
PATCH=$(grep "set(GGML_VERSION_PATCH" CMakeLists.txt | sed 's/.*PATCH \([0-9]*\).*/\1/')
|
||||
|
||||
echo "Current version: $MAJOR.$MINOR.$PATCH"
|
||||
|
||||
# Calculate new version
|
||||
case $VERSION_TYPE in
|
||||
major)
|
||||
NEW_MAJOR=$((MAJOR + 1))
|
||||
NEW_MINOR=0
|
||||
NEW_PATCH=0
|
||||
;;
|
||||
minor)
|
||||
NEW_MAJOR=$MAJOR
|
||||
NEW_MINOR=$((MINOR + 1))
|
||||
NEW_PATCH=0
|
||||
;;
|
||||
patch)
|
||||
NEW_MAJOR=$MAJOR
|
||||
NEW_MINOR=$MINOR
|
||||
NEW_PATCH=$((PATCH + 1))
|
||||
;;
|
||||
esac
|
||||
|
||||
NEW_VERSION="$NEW_MAJOR.$NEW_MINOR.$NEW_PATCH"
|
||||
RC_BRANCH="ggml-rc-v$NEW_VERSION"
|
||||
echo "New release version: $NEW_VERSION"
|
||||
echo "Release candidate branch: $RC_BRANCH"
|
||||
echo ""
|
||||
|
||||
# Create release candidate branch
|
||||
echo "Step 2: Creating release candidate branch..."
|
||||
if [ "$DRY_RUN" = true ]; then
|
||||
echo " [dry-run] Would create branch: $RC_BRANCH"
|
||||
else
|
||||
git checkout -b "$RC_BRANCH"
|
||||
echo "✓ Created and switched to branch: $RC_BRANCH"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Update CMakeLists.txt for release
|
||||
echo "Step 3: Updating version in CMakeLists.txt..."
|
||||
if [ "$DRY_RUN" = true ]; then
|
||||
echo " [dry-run] Would update GGML_VERSION_MAJOR to $NEW_MAJOR"
|
||||
echo " [dry-run] Would update GGML_VERSION_MINOR to $NEW_MINOR"
|
||||
echo " [dry-run] Would update GGML_VERSION_PATCH to $NEW_PATCH"
|
||||
else
|
||||
sed -i '' -e "s/set(GGML_VERSION_MAJOR [0-9]*)/set(GGML_VERSION_MAJOR $NEW_MAJOR)/" CMakeLists.txt
|
||||
sed -i '' -e "s/set(GGML_VERSION_MINOR [0-9]*)/set(GGML_VERSION_MINOR $NEW_MINOR)/" CMakeLists.txt
|
||||
sed -i '' -e "s/set(GGML_VERSION_PATCH [0-9]*)/set(GGML_VERSION_PATCH $NEW_PATCH)/" CMakeLists.txt
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Commit version bump
|
||||
echo "Step 4: Committing version bump..."
|
||||
if [ "$DRY_RUN" = true ]; then
|
||||
echo " [dry-run] Would commit: 'ggml : bump version to $NEW_VERSION'"
|
||||
else
|
||||
git add CMakeLists.txt
|
||||
git commit -m "ggml : bump version to $NEW_VERSION"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
echo ""
|
||||
if [ "$DRY_RUN" = true ]; then
|
||||
echo "[dry-run] Summary (no changes were made):"
|
||||
echo " • Would have created branch: $RC_BRANCH"
|
||||
echo " • Would have updated version to: $NEW_VERSION"
|
||||
else
|
||||
echo "Release preparation completed!"
|
||||
echo "Summary:"
|
||||
echo " • Created branch: $RC_BRANCH"
|
||||
echo " • Updated version to: $NEW_VERSION"
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo " • Push branch to remote: git push origin $RC_BRANCH"
|
||||
echo " • Create a Pull Request from $RC_BRANCH to master"
|
||||
echo " • After PR is merged, run: ./scripts/release.sh finalize"
|
||||
fi
|
||||
}
|
||||
|
||||
finalize_release() {
|
||||
if [ "$DRY_RUN" = true ]; then
|
||||
echo "[dry-run] Finalizing release (no changes will be made)"
|
||||
else
|
||||
echo "Starting release finalization..."
|
||||
fi
|
||||
echo ""
|
||||
|
||||
check_git_status
|
||||
check_master_branch
|
||||
check_master_up_to_date
|
||||
|
||||
# Read current version from CMakeLists.txt
|
||||
echo "Step 1: Reading current release version..."
|
||||
MAJOR=$(grep "set(GGML_VERSION_MAJOR" CMakeLists.txt | sed 's/.*MAJOR \([0-9]*\).*/\1/')
|
||||
MINOR=$(grep "set(GGML_VERSION_MINOR" CMakeLists.txt | sed 's/.*MINOR \([0-9]*\).*/\1/')
|
||||
PATCH=$(grep "set(GGML_VERSION_PATCH" CMakeLists.txt | sed 's/.*PATCH \([0-9]*\).*/\1/')
|
||||
|
||||
RELEASE_VERSION="$MAJOR.$MINOR.$PATCH"
|
||||
echo "Release version: $RELEASE_VERSION"
|
||||
echo ""
|
||||
|
||||
# Create git tag
|
||||
echo "Step 2: Creating signed git tag..."
|
||||
if [ "$DRY_RUN" = true ]; then
|
||||
echo " [dry-run] Would create signed tag: v$RELEASE_VERSION with message 'Release version $RELEASE_VERSION'"
|
||||
else
|
||||
git tag -s "v$RELEASE_VERSION" -m "Release version $RELEASE_VERSION"
|
||||
echo "✓ Created signed tag: v$RELEASE_VERSION"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
|
||||
echo ""
|
||||
if [ "$DRY_RUN" = true ]; then
|
||||
echo "[dry-run] Summary (no changes were made):"
|
||||
echo " • Would have created tag: v$RELEASE_VERSION"
|
||||
else
|
||||
echo "Release finalization completed!"
|
||||
echo "Summary:"
|
||||
echo " • Created signed tag: v$RELEASE_VERSION"
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo " • Push tag to remote: git push origin v$RELEASE_VERSION"
|
||||
echo " • The release is now complete!"
|
||||
fi
|
||||
}
|
||||
|
||||
# Execute the appropriate command
|
||||
case $COMMAND in
|
||||
prepare)
|
||||
prepare_release
|
||||
;;
|
||||
finalize)
|
||||
finalize_release
|
||||
;;
|
||||
esac
|
||||
Executable
+167
@@ -0,0 +1,167 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Synchronize llama.cpp changes to ggml
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# $ cd /path/to/ggml
|
||||
# $ ./scripts/sync-llama-am.sh -skip hash0,hash1,hash2... -C 3
|
||||
#
|
||||
|
||||
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"
|
||||
|
||||
to_skip=""
|
||||
|
||||
# context for git patches in number of lines
|
||||
ctx="8"
|
||||
|
||||
while [ "$1" != "" ]; do
|
||||
case $1 in
|
||||
-skip )
|
||||
shift
|
||||
to_skip=$1
|
||||
;;
|
||||
-C )
|
||||
shift
|
||||
ctx=$1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
cd $SRC_LLAMA
|
||||
|
||||
git log --oneline $lc..HEAD
|
||||
git log --oneline $lc..HEAD --reverse | grep -v "(ggml/[0-9]*)" | grep -v "(whisper/[0-9]*)" | cut -d' ' -f1 > $SRC_GGML/llama-commits
|
||||
|
||||
if [ ! -s $SRC_GGML/llama-commits ]; then
|
||||
rm -v $SRC_GGML/llama-commits
|
||||
echo "No new commits"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -f $SRC_GGML/llama-src.patch ]; then
|
||||
rm -v $SRC_GGML/llama-src.patch
|
||||
fi
|
||||
|
||||
while read c; do
|
||||
if [ -n "$to_skip" ]; then
|
||||
if [[ $to_skip == *"$c"* ]]; then
|
||||
echo "Skipping $c"
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
git format-patch -U${ctx} -k $c~1..$c --stdout -- \
|
||||
ggml/CMakeLists.txt \
|
||||
ggml/src/CMakeLists.txt \
|
||||
ggml/cmake/BuildTypes.cmake \
|
||||
ggml/cmake/GitVars.cmake \
|
||||
ggml/cmake/common.cmake \
|
||||
ggml/cmake/ggml-config.cmake.in \
|
||||
ggml/src/ggml-cpu/cmake/FindSIMD.cmake \
|
||||
ggml/src/ggml* \
|
||||
ggml/src/gguf* \
|
||||
ggml/include/ggml*.h \
|
||||
ggml/include/gguf*.h \
|
||||
tests/test-opt.cpp \
|
||||
tests/test-quantize-fns.cpp \
|
||||
tests/test-quantize-perf.cpp \
|
||||
tests/test-backend-ops.cpp \
|
||||
LICENSE \
|
||||
scripts/gen-authors.sh \
|
||||
>> $SRC_GGML/llama-src.patch
|
||||
done < $SRC_GGML/llama-commits
|
||||
|
||||
rm -v $SRC_GGML/llama-commits
|
||||
|
||||
# delete files if empty
|
||||
if [ ! -s $SRC_GGML/llama-src.patch ]; then
|
||||
rm -v $SRC_GGML/llama-src.patch
|
||||
fi
|
||||
|
||||
cd $SRC_GGML
|
||||
|
||||
if [ -f $SRC_GGML/llama-src.patch ]; then
|
||||
# replace PR numbers
|
||||
#
|
||||
# Subject: some text (#1234)
|
||||
# Subject: some text (llama/1234)
|
||||
cat llama-src.patch | sed -e 's/^Subject: \(.*\) (#\([0-9]*\))/Subject: \1 (llama\/\2)/' > llama-src.patch.tmp
|
||||
mv llama-src.patch.tmp llama-src.patch
|
||||
|
||||
cat llama-src.patch | sed -e 's/^\(.*\) (#\([0-9]*\))$/\1 (llama\/\2)/' > llama-src.patch.tmp
|
||||
mv llama-src.patch.tmp llama-src.patch
|
||||
|
||||
# replace filenames:
|
||||
#
|
||||
# ggml/CMakelists.txt -> CMakeLists.txt
|
||||
# ggml/src/CMakelists.txt -> src/CMakeLists.txt
|
||||
#
|
||||
# ggml/cmake/BuildTypes.cmake -> cmake/BuildTypes.cmake
|
||||
# ggml/cmake/GitVars.cmake -> cmake/GitVars.cmake
|
||||
# ggml/cmake/common.cmake -> cmake/common.cmake
|
||||
# ggml/cmake/ggml-config.cmake.in -> cmake/ggml-config.cmake.in
|
||||
# ggml/src/ggml-cpu/cmake/FindSIMD.cmake -> src/ggml-cpu/cmake/FindSIMD.cmake
|
||||
#
|
||||
# ggml/src/ggml* -> src/ggml*
|
||||
# ggml/src/gguf* -> src/gguf*
|
||||
#
|
||||
# ggml/include/ggml*.h -> include/ggml*.h
|
||||
# ggml/include/gguf*.h -> include/gguf*.h
|
||||
#
|
||||
# tests/test-opt.cpp -> tests/test-opt.cpp
|
||||
# tests/test-quantize-fns.cpp -> tests/test-quantize-fns.cpp
|
||||
# tests/test-quantize-perf.cpp -> tests/test-quantize-perf.cpp
|
||||
# tests/test-backend-ops.cpp -> tests/test-backend-ops.cpp
|
||||
#
|
||||
# LICENSE -> LICENSE
|
||||
# scripts/gen-authors.sh -> scripts/gen-authors.sh
|
||||
|
||||
cat llama-src.patch | sed -E \
|
||||
-e 's/(^[[:space:]]| [ab]\/)ggml\/CMakeLists\.txt/\1CMakeLists.txt/g' \
|
||||
-e 's/(^[[:space:]]| [ab]\/)ggml\/src\/CMakeLists\.txt/\1src\/CMakeLists.txt/g' \
|
||||
-e 's/(^[[:space:]]| [ab]\/)ggml\/cmake\/BuildTypes\.cmake/\1cmake\/BuildTypes\.cmake/g' \
|
||||
-e 's/(^[[:space:]]| [ab]\/)ggml\/cmake\/GitVars\.cmake/\1cmake\/GitVars\.cmake/g' \
|
||||
-e 's/(^[[:space:]]| [ab]\/)ggml\/cmake\/common\.cmake/\1cmake\/common\.cmake/g' \
|
||||
-e 's/(^[[:space:]]| [ab]\/)ggml\/cmake\/ggml-config\.cmake\.in/\1cmake\/ggml-config\.cmake\.in/g' \
|
||||
-e 's/(^[[:space:]]| [ab]\/)ggml\/src\/ggml-cpu\/cmake\/FindSIMD\.cmake/\1src\/ggml-cpu\/cmake\/FindSIMD\.cmake/g' \
|
||||
-e 's/(^[[:space:]]| [ab]\/)ggml\/src\/ggml(.*)/\1src\/ggml\2/g' \
|
||||
-e 's/(^[[:space:]]| [ab]\/)ggml\/src\/gguf(.*)/\1src\/gguf\2/g' \
|
||||
-e 's/(^[[:space:]]| [ab]\/)ggml\/include\/ggml(.*)\.h/\1include\/ggml\2.h/g' \
|
||||
-e 's/(^[[:space:]]| [ab]\/)ggml\/include\/gguf(.*)\.h/\1include\/gguf\2.h/g' \
|
||||
-e 's/(^[[:space:]]| [ab]\/)tests\/test-opt\.cpp/\1tests\/test-opt.cpp/g' \
|
||||
-e 's/(^[[:space:]]| [ab]\/)tests\/test-quantize-fns\.cpp/\1tests\/test-quantize-fns.cpp/g' \
|
||||
-e 's/(^[[:space:]]| [ab]\/)tests\/test-quantize-perf\.cpp/\1tests\/test-quantize-perf.cpp/g' \
|
||||
-e 's/(^[[:space:]]| [ab]\/)tests\/test-backend-ops\.cpp/\1tests\/test-backend-ops.cpp/g' \
|
||||
-e 's/(^[[:space:]]| [ab]\/)LICENSE/\1LICENSE/g' \
|
||||
-e 's/(^[[:space:]]| [ab]\/)scripts\/gen-authors\.sh/\1scripts\/gen-authors.sh/g' \
|
||||
> llama-src.patch.tmp
|
||||
mv llama-src.patch.tmp llama-src.patch
|
||||
|
||||
git am -C${ctx} llama-src.patch
|
||||
|
||||
rm -v $SRC_GGML/llama-src.patch
|
||||
fi
|
||||
|
||||
# update last commit
|
||||
cd $SRC_LLAMA
|
||||
git log -1 --format=%H > $SRC_GGML/scripts/sync-llama.last
|
||||
|
||||
echo "Done"
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1 @@
|
||||
8141e730f1598780c19b153e0e212ed70a672c53
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
cp -rpv ../llama.cpp/ggml/CMakeLists.txt CMakeLists.txt
|
||||
cp -rpv ../llama.cpp/ggml/src/CMakeLists.txt src/CMakeLists.txt
|
||||
|
||||
cp -rpv ../llama.cpp/ggml/cmake/* cmake/
|
||||
cp -rpv ../llama.cpp/ggml/src/ggml-cpu/cmake/* src/ggml-cpu/cmake/
|
||||
|
||||
cp -rpv ../llama.cpp/ggml/src/ggml* src/
|
||||
cp -rpv ../llama.cpp/ggml/src/gguf* src/
|
||||
|
||||
cp -rpv ../llama.cpp/ggml/include/ggml*.h include/
|
||||
cp -rpv ../llama.cpp/ggml/include/gguf*.h include/
|
||||
|
||||
cp -rpv ../llama.cpp/tests/test-opt.cpp tests/test-opt.cpp
|
||||
cp -rpv ../llama.cpp/tests/test-quantize-fns.cpp tests/test-quantize-fns.cpp
|
||||
cp -rpv ../llama.cpp/tests/test-quantize-perf.cpp tests/test-quantize-perf.cpp
|
||||
cp -rpv ../llama.cpp/tests/test-backend-ops.cpp tests/test-backend-ops.cpp
|
||||
|
||||
cp -rpv ../llama.cpp/LICENSE ./LICENSE
|
||||
cp -rpv ../llama.cpp/scripts/gen-authors.sh ./scripts/gen-authors.sh
|
||||
Executable
+138
@@ -0,0 +1,138 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Synchronize whisper.cpp changes to ggml
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# $ cd /path/to/ggml
|
||||
# $ ./scripts/sync-whisper-am.sh -skip hash0,hash1,hash2...
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
sd=$(dirname $0)
|
||||
cd $sd/../
|
||||
|
||||
SRC_GGML=$(pwd)
|
||||
SRC_WHISPER=$(cd ../whisper.cpp; pwd)
|
||||
|
||||
if [ ! -d $SRC_WHISPER ]; then
|
||||
echo "whisper.cpp not found at $SRC_WHISPER"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
lc=$(cat $SRC_GGML/scripts/sync-whisper.last)
|
||||
echo "Syncing whisper.cpp changes since commit $lc"
|
||||
|
||||
to_skip=""
|
||||
if [ "$1" == "-skip" ]; then
|
||||
to_skip=$2
|
||||
fi
|
||||
|
||||
cd $SRC_WHISPER
|
||||
|
||||
git log --oneline $lc..HEAD
|
||||
git log --oneline $lc..HEAD --reverse | grep -v "(ggml/[0-9]*)" | grep -v "(llama/[0-9]*)" | cut -d' ' -f1 > $SRC_GGML/whisper-commits
|
||||
|
||||
if [ ! -s $SRC_GGML/whisper-commits ]; then
|
||||
rm -v $SRC_GGML/whisper-commits
|
||||
echo "No new commits"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -f $SRC_GGML/whisper-src.patch ]; then
|
||||
rm -v $SRC_GGML/whisper-src.patch
|
||||
fi
|
||||
|
||||
while read c; do
|
||||
if [ -n "$to_skip" ]; then
|
||||
if [[ $to_skip == *"$c"* ]]; then
|
||||
echo "Skipping $c"
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
git format-patch -k $c~1..$c --stdout -- \
|
||||
ggml/CMakeLists.txt \
|
||||
ggml/src/CMakeLists.txt \
|
||||
ggml/cmake/FindSIMD.cmake \
|
||||
ggml/src/ggml* \
|
||||
ggml/src/gguf* \
|
||||
ggml/include/ggml*.h \
|
||||
ggml/include/gguf*.h \
|
||||
examples/common-ggml.h \
|
||||
examples/common-ggml.cpp \
|
||||
LICENSE \
|
||||
scripts/gen-authors.sh \
|
||||
>> $SRC_GGML/whisper-src.patch
|
||||
done < $SRC_GGML/whisper-commits
|
||||
|
||||
rm -v $SRC_GGML/whisper-commits
|
||||
|
||||
# delete files if empty
|
||||
if [ ! -s $SRC_GGML/whisper-src.patch ]; then
|
||||
rm -v $SRC_GGML/whisper-src.patch
|
||||
fi
|
||||
|
||||
cd $SRC_GGML
|
||||
|
||||
if [ -f $SRC_GGML/whisper-src.patch ]; then
|
||||
# replace PR numbers
|
||||
#
|
||||
# Subject: some text (#1234)
|
||||
# Subject: some text (whisper/1234)
|
||||
cat whisper-src.patch | sed -e 's/^Subject: \(.*\) (#\([0-9]*\))/Subject: \1 (whisper\/\2)/' > whisper-src.patch.tmp
|
||||
mv whisper-src.patch.tmp whisper-src.patch
|
||||
|
||||
cat whisper-src.patch | sed -e 's/^\(.*\) (#\([0-9]*\))$/\1 (whisper\/\2)/' > whisper-src.patch.tmp
|
||||
mv whisper-src.patch.tmp whisper-src.patch
|
||||
|
||||
# replace filenames:
|
||||
#
|
||||
# ggml/CMakelists.txt -> CMakeLists.txt
|
||||
# ggml/src/CMakelists.txt -> src/CMakeLists.txt
|
||||
# ggml/cmake/FindSIMD.cmake -> cmake/FindSIMD.cmake
|
||||
#
|
||||
# ggml/src/ggml* -> src/ggml*
|
||||
# ggml/src/gguf* -> src/gguf*
|
||||
#
|
||||
# ggml/include/ggml*.h -> include/ggml*.h
|
||||
# ggml/include/gguf*.h -> include/gguf*.h
|
||||
#
|
||||
# examples/common.h -> examples/common.h
|
||||
# examples/common.cpp -> examples/common.cpp
|
||||
# examples/common-ggml.h -> examples/common-ggml.h
|
||||
# examples/common-ggml.cpp -> examples/common-ggml.cpp
|
||||
#
|
||||
# LICENSE -> LICENSE
|
||||
# scripts/gen-authors.sh -> scripts/gen-authors.sh
|
||||
|
||||
cat whisper-src.patch | sed -E \
|
||||
-e 's/\/ggml\/CMakeLists\.txt/\/CMakeLists.txt/g' \
|
||||
-e 's/\/ggml\/src\/CMakeLists\.txt/\/src\/CMakeLists.txt/g' \
|
||||
-e 's/\/ggml\/cmake\/FindSIMD\.cmake/\/cmake\/FindSIMD.cmake/g' \
|
||||
-e 's/\/ggml\/src\/ggml(.*)/\/src\/ggml\1/g' \
|
||||
-e 's/\/ggml\/src\/gguf(.*)/\/src\/gguf\1/g' \
|
||||
-e 's/\/ggml\/include\/ggml(.*)\.h/\/include\/ggml\1.h/g' \
|
||||
-e 's/\/ggml\/include\/gguf(.*)\.h/\/include\/gguf\1.h/g' \
|
||||
-e 's/\/examples\/common\.h/\/examples\/common.h/g' \
|
||||
-e 's/\/examples\/common\.cpp/\/examples\/common.cpp/g' \
|
||||
-e 's/\/examples\/common-ggml\.h/\/examples\/common-ggml.h/g' \
|
||||
-e 's/\/examples\/common-ggml\.cpp/\/examples\/common-ggml.cpp/g' \
|
||||
-e 's/\/LICENSE/\/LICENSE/g' \
|
||||
-e 's/\/scripts\/gen-authors\.sh/\/scripts\/gen-authors.sh/g' \
|
||||
> whisper-src.patch.tmp
|
||||
mv whisper-src.patch.tmp whisper-src.patch
|
||||
|
||||
git am whisper-src.patch
|
||||
|
||||
rm -v $SRC_GGML/whisper-src.patch
|
||||
fi
|
||||
|
||||
# update last commit
|
||||
cd $SRC_WHISPER
|
||||
git log -1 --format=%H > $SRC_GGML/scripts/sync-whisper.last
|
||||
|
||||
echo "Done"
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1 @@
|
||||
865ec171aa83625a388bce0b43f091bb3054f56b
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
cp -rpv ../whisper.cpp/ggml/CMakeLists.txt CMakeLists.txt
|
||||
cp -rpv ../whisper.cpp/ggml/src/CMakeLists.txt src/CMakeLists.txt
|
||||
cp -rpv ../whisper.cpp/ggml/cmake/FindSIMD.cmake cmake/FindSIMD.cmake
|
||||
|
||||
cp -rpv ../whisper.cpp/ggml/src/ggml* src/
|
||||
cp -rpv ../whisper.cpp/ggml/src/gguf* src/
|
||||
|
||||
cp -rpv ../whisper.cpp/ggml/include/ggml*.h include/
|
||||
cp -rpv ../whisper.cpp/ggml/include/gguf*.h include/
|
||||
|
||||
cp -rpv ../whisper.cpp/examples/common-ggml.h examples/common-ggml.h
|
||||
cp -rpv ../whisper.cpp/examples/common-ggml.cpp examples/common-ggml.cpp
|
||||
|
||||
cp -rpv ../whisper.cpp/LICENSE ./LICENSE
|
||||
cp -rpv ../whisper.cpp/scripts/gen-authors.sh ./scripts/gen-authors.sh
|
||||
Reference in New Issue
Block a user