@@ -712,6 +712,81 @@ function gg_run_embd_bge_small {
712
712
set +e
713
713
}
714
714
715
+ function gg_sum_embd_bge_small {
716
+ gg_printf ' ### %s\n\n' " ${ci} "
717
+
718
+ gg_printf ' BGE Small (BERT):\n'
719
+ gg_printf ' - status: %s\n' " $( cat $OUT /${ci} .exit) "
720
+ gg_printf ' - f16: \n```\n%s\n```\n' " $( cat $OUT /${ci} -tg-f16.log) "
721
+ gg_printf ' - q8_0:\n```\n%s\n```\n' " $( cat $OUT /${ci} -tg-q8_0.log) "
722
+ }
723
+
724
+ # rerank_tiny
725
+
726
+ function gg_run_rerank_tiny {
727
+ cd ${SRC}
728
+
729
+ gg_wget models-mnt/rerank-tiny/ https://huggingface.co/jinaai/jina-reranker-v1-tiny-en/raw/main/config.json
730
+ gg_wget models-mnt/rerank-tiny/ https://huggingface.co/jinaai/jina-reranker-v1-tiny-en/raw/main/tokenizer.json
731
+ gg_wget models-mnt/rerank-tiny/ https://huggingface.co/jinaai/jina-reranker-v1-tiny-en/raw/main/tokenizer_config.json
732
+ gg_wget models-mnt/rerank-tiny/ https://huggingface.co/jinaai/jina-reranker-v1-tiny-en/raw/main/special_tokens_map.json
733
+ gg_wget models-mnt/rerank-tiny/ https://huggingface.co/jinaai/jina-reranker-v1-tiny-en/resolve/main/pytorch_model.bin
734
+ gg_wget models-mnt/rerank-tiny/ https://huggingface.co/jinaai/jina-reranker-v1-tiny-en/raw/main/sentence_bert_config.json
735
+ gg_wget models-mnt/rerank-tiny/ https://huggingface.co/jinaai/jina-reranker-v1-tiny-en/raw/main/vocab.txt
736
+ gg_wget models-mnt/rerank-tiny/ https://huggingface.co/jinaai/jina-reranker-v1-tiny-en/raw/main/modules.json
737
+ gg_wget models-mnt/rerank-tiny/ https://huggingface.co/jinaai/jina-reranker-v1-tiny-en/raw/main/config.json
738
+
739
+ gg_wget models-mnt/rerank-tiny/1_Pooling https://huggingface.co/jinaai/jina-reranker-v1-tiny-en/raw/main/1_Pooling/config.json
740
+
741
+ path_models=" ../models-mnt/rerank-tiny"
742
+
743
+ rm -rf build-ci-release && mkdir build-ci-release && cd build-ci-release
744
+
745
+ set -e
746
+
747
+ (time cmake -DCMAKE_BUILD_TYPE=Release ${CMAKE_EXTRA} .. ) 2>&1 | tee -a $OUT /${ci} -cmake.log
748
+ (time make -j$( nproc) ) 2>&1 | tee -a $OUT /${ci} -make.log
749
+
750
+ python3 ../convert_hf_to_gguf.py ${path_models} --outfile ${path_models} /ggml-model-f16.gguf
751
+
752
+ model_f16=" ${path_models} /ggml-model-f16.gguf"
753
+
754
+ (time ./bin/llama-embedding --model ${model_f16} -p " what is panda?</s><s>hi\nwhat is panda?</s><s>it's a bear\nwhat is panda?</s><s>The giant panda (Ailuropoda melanoleuca), sometimes called a panda bear or simply panda, is a bear species endemic to China." --pooling rank --embd-normalize -1 --verbose-prompt) 2>&1 | tee -a $OUT /${ci} -rk-f16.log
755
+
756
+ # sample output
757
+ # rerank score 0: 0.029
758
+ # rerank score 1: 0.029
759
+ # rerank score 2: 0.135
760
+
761
+ # check that the score is in the range [$3, $4]
762
+ function check_score {
763
+ qnt=" $1 "
764
+ score=$( echo " $2 " | grep -oE " [0-9]+\.[0-9]+" | tail -n 1)
765
+
766
+ if [ $( echo " $score < $3 " | bc) -eq 1 ] || [ $( echo " $score > $4 " | bc) -eq 1 ]; then
767
+ printf ' - %s @ %s (FAIL: score not in range [%s, %s])\n' " $qnt " " $score " " $3 " " $4 "
768
+ return 20
769
+ fi
770
+
771
+ printf ' - %s @ %s OK\n' " $qnt " " $score "
772
+ return 0
773
+ }
774
+
775
+ check_score " rerank score 0" " $( cat $OUT /${ci} -rk-f16.log | grep " rerank score 0" ) " " 0.00" " 0.05" | tee -a $OUT /${ci} -rk-f16.log
776
+ check_score " rerank score 1" " $( cat $OUT /${ci} -rk-f16.log | grep " rerank score 1" ) " " 0.00" " 0.05" | tee -a $OUT /${ci} -rk-f16.log
777
+ check_score " rerank score 2" " $( cat $OUT /${ci} -rk-f16.log | grep " rerank score 2" ) " " 0.10" " 0.15" | tee -a $OUT /${ci} -rk-f16.log
778
+
779
+ set +e
780
+ }
781
+
782
+ function gg_sum_rerank_tiny {
783
+ gg_printf ' ### %s\n\n' " ${ci} "
784
+
785
+ gg_printf ' Rerank Tiny (Jina):\n'
786
+ gg_printf ' - status: %s\n' " $( cat $OUT /${ci} .exit) "
787
+ gg_printf ' - f16: \n```\n%s\n```\n' " $( cat $OUT /${ci} -rk-f16.log) "
788
+ }
789
+
715
790
function gg_check_build_requirements {
716
791
if ! command -v cmake & > /dev/null; then
717
792
gg_printf ' cmake not found, please install'
@@ -726,15 +801,6 @@ function gg_check_build_requirements {
726
801
fi
727
802
}
728
803
729
- function gg_sum_embd_bge_small {
730
- gg_printf ' ### %s\n\n' " ${ci} "
731
-
732
- gg_printf ' BGE Small (BERT):\n'
733
- gg_printf ' - status: %s\n' " $( cat $OUT /${ci} .exit) "
734
- gg_printf ' - f16: \n```\n%s\n```\n' " $( cat $OUT /${ci} -tg-f16.log) "
735
- gg_printf ' - q8_0:\n```\n%s\n```\n' " $( cat $OUT /${ci} -tg-q8_0.log) "
736
- }
737
-
738
804
# # main
739
805
740
806
export LLAMA_LOG_PREFIX=1
@@ -762,6 +828,7 @@ test $ret -eq 0 && gg_run ctest_release
762
828
763
829
if [ -z ${GG_BUILD_LOW_PERF} ]; then
764
830
test $ret -eq 0 && gg_run embd_bge_small
831
+ test $ret -eq 0 && gg_run rerank_tiny
765
832
766
833
if [ -z ${GG_BUILD_CLOUD} ] || [ ${GG_BUILD_EXTRA_TESTS_0} ]; then
767
834
test $ret -eq 0 && gg_run test_scripts_debug
0 commit comments