bench-models.sh 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #!/usr/bin/env bash
  2. RESULTS="bench-models-results.txt"
  3. : > "$RESULTS"
  4. ARGS_BB="-c 270336 -npp 512,4096,8192 -npl 1,2,4,8,16,32 -ntg 32"
  5. ARGS_B="-d 0,4096,8192,16384,32768 -p 2048 -n 32"
  6. QUICK=0
  7. while (( "$#" )); do
  8. case "$1" in
  9. --quick) QUICK=1; shift ;;
  10. *) shift ;;
  11. esac
  12. done
  13. if (( QUICK )); then
  14. ARGS_BB="-c 20480 -npp 512,4096 -npl 1,2,4 -ntg 32"
  15. ARGS_B="-d 0 -p 2048 -n 32"
  16. fi
  17. run_model() {
  18. local HFR=$1
  19. local HFF=$2
  20. printf "## ${HFR}\n" | tee -a "$RESULTS"
  21. printf "\n" | tee -a "$RESULTS"
  22. printf "Model: https://huggingface.co/${HFR}\n" | tee -a "$RESULTS"
  23. printf "\n" | tee -a "$RESULTS"
  24. printf -- "- \`llama-batched-bench\`\n" | tee -a "$RESULTS"
  25. printf "\n" | tee -a "$RESULTS"
  26. ./bin/llama-batched-bench \
  27. -hfr "${HFR}" -hff "${HFF}" \
  28. -m "${HFF}" -fa 1 -ub 2048 --no-mmap \
  29. ${ARGS_BB} | tee -a "$RESULTS"
  30. printf "\n" | tee -a "$RESULTS"
  31. printf -- "- \`llama-bench\`\n" | tee -a "$RESULTS"
  32. printf "\n" | tee -a "$RESULTS"
  33. ./bin/llama-bench \
  34. -m "${HFF}" -fa 1 -ub 2048 -mmp 0 \
  35. ${ARGS_B} | tee -a "$RESULTS"
  36. printf "\n" | tee -a "$RESULTS"
  37. printf "\n"
  38. }
  39. run_model "ggml-org/gpt-oss-20b-GGUF" "gpt-oss-20b-mxfp4.gguf"
  40. run_model "ggml-org/gpt-oss-120b-GGUF" "gpt-oss-120b-mxfp4-00001-of-00003.gguf"
  41. run_model "ggml-org/Qwen3-Coder-30B-A3B-Instruct-Q8_0-GGUF" "qwen3-coder-30b-a3b-instruct-q8_0.gguf"
  42. run_model "ggml-org/Qwen2.5-Coder-7B-Q8_0-GGUF" "qwen2.5-coder-7b-q8_0.gguf"
  43. run_model "ggml-org/gemma-3-4b-it-qat-GGUF" "gemma-3-4b-it-qat-Q4_0.gguf"
  44. if [[ -f models-extra.txt ]]; then
  45. while read -r HFR HFF; do
  46. [[ -z "$HFR" ]] && continue
  47. run_model "$HFR" "$HFF"
  48. done < models-extra.txt
  49. fi
  50. printf "\n=====================================\n"
  51. printf "\n"
  52. cat "$RESULTS"
  53. printf "\n"
  54. printf "Done! Results are written to $RESULTS\n"
  55. printf "\n"