Skip to content

Commit 12e45d5

Browse files
committed
Convert and quantize script
1 parent 82b0ef6 commit 12e45d5

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

convert_and_quantize.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
echo "💪🏼 Download and compile Llama.cpp"
2+
if [ ! -f "./llama.cpp/main" ]
3+
then
4+
if [ ! -d "./llama.cpp/" ]
5+
then
6+
git clone https://github.com/StrikingLoo/llama.cpp
7+
fi
8+
cd llama.cpp && \
9+
make && \
10+
mv main ../api/llama
11+
cd ..
12+
else
13+
echo "✅ Repository already cloned and compiled"
14+
fi
15+
16+
echo "💬 Convert weights"
17+
if ls models/*/*.bin 1> /dev/null 2>&1; then
18+
echo "✅ Weights already converted"
19+
else
20+
if ls models/*/*.pth 1> /dev/null 2>&1; then
21+
# Convert model to ggml FP16 format
22+
python3 llama.cpp/convert-pth-to-ggml.py weights/7B/ 1
23+
# Quantize the model to 4-bits
24+
python3 llama.cpp/quantize.py weights/7B
25+
else
26+
echo "⚠️ Weight files do not exist. Please download them and place them inside the models folder"
27+
fi
28+
fi

0 commit comments

Comments
 (0)