Team Ai
Apppublic

KBaba7/llama.cpp

sourceHugging Faceapache-2.0updated 2y agoView on Hugging Face
0likes
test-tokenizer-0.sh42 linesDownload Raw Back to tests
1#!/bin/bash2#3# Usage:4#5#   test-tokenizer-0.sh <name> <input>6#7 8if [ $# -ne 2 ]; then9    printf "Usage: $0 <name> <input>\n"10    exit 111fi12 13name=$114input=$215 16make -j tests/test-tokenizer-017 18printf "Testing %s on %s ...\n" $name $input19 20set -e21 22printf "Tokenizing using (py)  Python AutoTokenizer ...\n"23python3 ./tests/test-tokenizer-0.py ./models/tokenizers/$name --fname-tok $input > /tmp/test-tokenizer-0-$name-py.log 2>&124 25printf "Tokenizing using (cpp) llama.cpp ...\n"26./tests/test-tokenizer-0 ./models/ggml-vocab-$name.gguf $input > /tmp/test-tokenizer-0-$name-cpp.log 2>&127 28cat /tmp/test-tokenizer-0-$name-py.log | grep "tokenized in"29cat /tmp/test-tokenizer-0-$name-cpp.log | grep "tokenized in"30 31set +e32 33diff $input.tok $input.tokcpp > /dev/null 2>&134 35if [ $? -eq 0 ]; then36    printf "Tokenization is correct!\n"37else38    diff $input.tok $input.tokcpp | head -n 3239 40    printf "Tokenization differs!\n"41fi42