Skip to content

Fix scripts to support cross-platform execution #285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion quantize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,22 @@ if ! [[ "$1" =~ ^[0-9]{1,2}B$ ]]; then
exit 1
fi

# Determine the binary file extension based on the platform
case "$(uname -s)" in
Linux*)
if grep -qE "(Microsoft|WSL)" /proc/version &> /dev/null ; then
ext=".exe" # WSL environment
else
ext=""
fi
;;
Darwin*) ext="";;
CYGWIN*|MINGW32*|MSYS*|MINGW*) ext=".exe";;
*) echo "Unknown platform"; exit 1;;
esac

for i in `ls models/$1/ggml-model-f16.bin*`; do
./quantize "$i" "${i/f16/q4_0}" 2
./quantize${ext} "$i" "${i/f16/q4_0}" 2
if [[ "$2" == "--remove-f16" ]]; then
rm "$i"
fi
Expand Down