char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
b7f5f46e0
char/aliceai-t5-moe
1#!/usr/bin/env bash 2set -e 3 4# Read the first argument into a variable 5arg1 =" $ 1 " 6 7# Shift the arguments to remove the first one 8shift 9 10if [[" $ arg1 " =='--convert' ||" $ arg1 " =='-c' ]];then 11exec python3 ./convert_hf_to_gguf.py" $ @" 12elif [[" $ arg1 " =='--quantize' ||" $ arg1 " =='-q' ]];then 13exec ./llama-quantize" $ @" 14elif [[" $ arg1 " =='--run' ||" $ arg1 " =='-r' ]];then 15exec ./llama-cli" $ @" 16elif [[" $ arg1 " =='--run-legacy' ||" $ arg1 " =='-l' ]];then 17exec ./llama-completion" $ @" 18elif [[" $ arg1 " =='--bench' ||" $ arg1 " =='-b' ]];then 19exec ./llama-bench" $ @" 20elif [[" $ arg1 " =='--perplexity' ||" $ arg1 " =='-p' ]];then 21exec ./llama-perplexity" $ @" 22elif [[" $ arg1 " =='--all-in-one' ||" $ arg1 " =='-a' ]];then 23echo "Converting PTH to GGML..." 24for i in $( ls $ 1 / $ 2/ggml-model-f16.bin*) ;do 25if [ -f" ${ i /f16/q4_0} " ];then 26echo "Skip model quantization, it already exists: ${ i /f16/q4_0} " 27else 28echo "Converting PTH to GGML: $ i into ${ i /f16/q4_0} ..." 29exec ./llama-quantize" $ i " " ${ i /f16/q4_0} " q4_0 30fi 31done 32elif [[" $ arg1 " =='--server' ||" $ arg1 " =='-s' ]];then 33exec ./llama-server" $ @" 34else 35echo "Unknown command: $ arg1 " 36echo "Available commands: " 37echo " --run (-r): Run a model (chat) previously converted into ggml" 38echo " ex: -m /models/7B/ggml-model-q4_0.bin" 39echo " --run-legacy (-l): Run a model (legacy completion) previously converted into ggml" 40echo " ex: -m /models/7B/ggml-model-q4_0.bin -no-cnv -p \"Building a website can be done in 10 simple steps:\" -n 512" 41echo " --bench (-b): Benchmark the performance of the inference for various parameters." 42echo " ex: -m model.gguf" 43echo " --perplexity (-p): Measure the perplexity of a model over a given text." 44echo " ex: -m model.gguf -f file.txt" 45echo " --convert (-c): Convert a llama model into ggml" 46echo " ex: --outtype f16 \"/models/7B/\" " 47echo " --quantize (-q): Optimize with quantization process ggml" 48echo " ex: \"/models/7B/ggml-model-f16.bin\" \"/models/7B/ggml-model-q4_0.bin\" 2" 49echo " --all-in-one (-a): Execute --convert & --quantize" 50echo " ex: \"/models/\" 7B" 51echo " --server (-s): Run a model on the server" 52echo " ex: -m /models/7B/ggml-model-q4_0.bin -c 2048 -ngl 43 -mg 1 --port 8080" 53fi