File size: 1,813 Bytes
5d5e38b 7585b58 5d5e38b 7585b58 5d5e38b 7585b58 5d5e38b 7585b58 5d5e38b 39317ca 7585b58 5d5e38b 7585b58 707f408 5d5e38b 7585b58 5d5e38b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
#!/bin/bash
###############################################################################
echo == Prep Enviroment ==
# Pull both the model folder and llama.cpp (for the conversion script)
#git submodule update --init
###############################################################################
echo == Build and prep the llamafile engine execuable ==
pushd llamafile
make -j8
make
# This is where each executables is located for reference purpose for now as of 2024-04-05
# and was determined by running `sudo make install PREFIX=/usr/local`
# ./o/llamafile/zipalign --> /usr/local/bin/zipalign
# ./o/llama.cpp/main/main --> /usr/local/bin/llamafile
# ./o/llama.cpp/imatrix/imatrix --> /usr/local/bin/llamafile-imatrix
# ./o/llama.cpp/quantize/quantize --> /usr/local/bin/llamafile-quantize
# ./build/llamafile-convert --> /usr/local/bin/llamafile-convert
# ./o/llama.cpp/perplexity/perplexity --> /usr/local/bin/llamafile-perplexity
# ./o/llama.cpp/llava/llava-quantize --> /usr/local/bin/llava-quantize
popd
###############################################################################
echo == Convert from safetensor to gguf ==
./llama.cpp/convert.py maykeye_tinyllama --outtype f16 --metadata maykeye_tinyllama-metadata.json
mv maykeye_tinyllama/TinyLLama-v0-5M-F16.gguf TinyLLama-v0-5M-F16.gguf
echo == Generating Llamafile ==
cp ./llamafile/o/llama.cpp/main/main TinyLLama-v0-5M-F16.llamafile
# Create an .args file with settings defaults
cat >.args <<EOF
-m
TinyLLama-v0-5M-F16.gguf
EOF
# zip align engine, gguf and default args
zipalign -j0 \
TinyLLama-v0-5M-F16.llamafile \
TinyLLama-v0-5M-F16.gguf \
.args
###############################################################################
echo == Test Output ==
./TinyLLama-v0-5M-F16.llamafile --cli -p "hello world the gruff man said"
|