test_cache_stats.sh 929 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/bash
  2. # Test script for cache statistics functionality
  3. # This script demonstrates how to use the --dump-cache flag
  4. echo "Testing llama.cpp cache statistics functionality"
  5. echo "=============================================="
  6. # Check if a model path is provided
  7. if [ $# -eq 0 ]; then
  8. echo "Usage: $0 <path_to_model.gguf> [prompt]"
  9. echo "Example: $0 /path/to/qwen3-next.gguf \"Hello, my name is\""
  10. exit 1
  11. fi
  12. MODEL_PATH="$1"
  13. PROMPT="${2:-Hello, my name is}"
  14. echo "Model: $MODEL_PATH"
  15. echo "Prompt: $PROMPT"
  16. echo ""
  17. # Run llama.cpp with cache statistics enabled
  18. echo "Running: ./llama-cli -m $MODEL_PATH -p \"$PROMPT\" -n 5 --dump-cache"
  19. echo ""
  20. # Build the command
  21. CMD="./build/bin/llama-cli -m $MODEL_PATH -p \"$PROMPT\" -n 5 --dump-cache"
  22. # Execute the command
  23. echo "Executing: $CMD"
  24. echo ""
  25. eval $CMD
  26. echo ""
  27. echo "Cache statistics test completed."
  28. echo "=============================================="