generated from me/template-mit
ollama-benchmark, fixes after doing a few more tests.
This commit is contained in:
1 parent
ffbf55c1ed
commit
c6a309ec82
1 file changed
+20
-10
+20
-10
@@ -1579,7 +1579,7 @@ function ollama_benchmark_usage() {
|
||||
IGPUS
|
||||
Values to set OLLAMA_IGPU_ENABLE to. Defaults to 1.
|
||||
MODELS
|
||||
Model names to test. Defaults to all of `ollama ls`.
|
||||
Model names to test. Defaults to all of 'ollama ls'.
|
||||
|
||||
EXAMPLES:
|
||||
|
||||
@@ -1608,9 +1608,11 @@ function ollama_benchmark_usage() {
|
||||
}
|
||||
|
||||
function ollama_benchmark() {
|
||||
#############################################################################
|
||||
# Parameters
|
||||
#############################################################################
|
||||
|
||||
if [[ "$@" == *"-h"* || "$@" == *"--help"* ]]; then
|
||||
if [[ "$@" == *"-h"* || "$@" == *"help"* ]]; then
|
||||
ollama_benchmark_usage
|
||||
return 0
|
||||
fi
|
||||
@@ -1643,14 +1645,16 @@ function ollama_benchmark() {
|
||||
[[ -z "$QUIET" ]] && cat <<- EOF
|
||||
DEBUG=$DEBUG
|
||||
QUIET=$QUIET
|
||||
context=$context
|
||||
contexts=$contexts
|
||||
threads=$threads
|
||||
igpu=$igpu
|
||||
model=$model
|
||||
igpus=$igpus
|
||||
models=$models
|
||||
EOF
|
||||
[[ -z "$QUIET" ]] && echo " Done!"
|
||||
|
||||
#############################################################################
|
||||
# Variables
|
||||
#############################################################################
|
||||
|
||||
col_mdl=25
|
||||
col_hdd=6
|
||||
@@ -1667,7 +1671,9 @@ function ollama_benchmark() {
|
||||
|
||||
declare champ_{s,t}_{mdl,num,ctx,thr}
|
||||
|
||||
#############################################################################
|
||||
# Functions
|
||||
#############################################################################
|
||||
|
||||
function wait_for_ollama() {
|
||||
while ! ollama ps >/dev/null 2>&1; do
|
||||
@@ -1675,7 +1681,9 @@ function ollama_benchmark() {
|
||||
done
|
||||
}
|
||||
|
||||
#############################################################################
|
||||
# Main
|
||||
#############################################################################
|
||||
|
||||
if [[ ! -d /sdcard && -d /etc/sv ]]; then
|
||||
[[ -z "$QUIET" ]] && echo -e "\n Stopping ollama runit service..."
|
||||
@@ -1696,8 +1704,8 @@ function ollama_benchmark() {
|
||||
":------------------------" "-----:" "-------:" "-----:" "------:" "---:" "--------:" "----------:" "-------:"
|
||||
|
||||
|
||||
last_igpu=""
|
||||
count=0
|
||||
declare last_igpu="" count=0
|
||||
unset model context thread igpu
|
||||
for model in $models; do
|
||||
for context in $contexts; do
|
||||
for thread in $threads; do
|
||||
@@ -1777,7 +1785,7 @@ function ollama_benchmark() {
|
||||
champ_s_num="$speed"
|
||||
champ_s_mdl="$model"
|
||||
champ_s_ctx="$ctx"
|
||||
champ_s_thr="$thr"
|
||||
champ_s_thr="$thread"
|
||||
fi
|
||||
|
||||
[[ -n "$DEBUG" ]] && echo "DEBUG: champ_t_num=$champ_t_num, time=$time"
|
||||
@@ -1788,7 +1796,7 @@ function ollama_benchmark() {
|
||||
champ_t_num="$time"
|
||||
champ_t_mdl="$model"
|
||||
champ_t_ctx="$ctx"
|
||||
champ_t_thr="$thr"
|
||||
champ_t_thr="$thread"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -1807,11 +1815,13 @@ function ollama_benchmark() {
|
||||
|
||||
echo -e "\n Done!! :D \n"
|
||||
cat <<- EOF
|
||||
Speed Champion: $champ_s_mdl at ${champ_s_thr}-$champ_s_ctx with a tokens/seconds of ${champ_s_num}!
|
||||
Speed Champion: $champ_s_mdl at ${champ_s_thr}-$champ_s_ctx with a tokens/second of ${champ_s_num}!
|
||||
Time Champion: $champ_t_mdl at ${champ_t_thr}-$champ_t_ctx with a time of ${champ_t_num}!
|
||||
EOF
|
||||
|
||||
#############################################################################
|
||||
# Finish
|
||||
#############################################################################
|
||||
|
||||
[[ -z "$QUIET" ]] && echo -e "\n Killing local ollama serve..."
|
||||
killall ollama
|
||||
|
||||
Reference in new issue
Block a user