From 20d65a70df1b1d9afad7b90bc58854e7b662e1f4 Mon Sep 17 00:00:00 2001 From: Xiao Date: Sun, 17 Mar 2024 16:12:46 +0000 Subject: [PATCH] Upload README.md with huggingface_hub --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 20db983..e5f0e70 100644 --- a/README.md +++ b/README.md @@ -80,10 +80,10 @@ from FlagEmbedding import FlagLLMReranker reranker = FlagLLMReranker('BAAI/bge-reranker-v2-gemma', use_bf16=True) # Setting use_bf16 to True speeds up computation with a slight performance degradation score = reranker.compute_score(['query', 'passage']) -print(score) # 2.15625 +print(score) scores = reranker.compute_score([['what is panda?', 'hi'], ['what is panda?', 'The giant panda (Ailuropoda melanoleuca), sometimes called a panda bear or simply panda, is a bear species endemic to China.']]) -print(scores) # [-0.84765625, 10.625] +print(scores) ``` #### For LLM-based layerwise reranker @@ -93,10 +93,10 @@ from FlagEmbedding import LayerWiseFlagLLMReranker reranker = LayerWiseFlagLLMReranker('BAAI/bge-reranker-v2-minicpm-layerwise', use_bf16=True) # Setting use_bf16 to True speeds up computation with a slight performance degradation score = reranker.compute_score(['query', 'passage'], cutoff_layers=[28]) # Adjusting 'cutoff_layers' to pick which layers are used for computing the score. -print(score) # -7.03125 +print(score) scores = reranker.compute_score([['what is panda?', 'hi'], ['what is panda?', 'The giant panda (Ailuropoda melanoleuca), sometimes called a panda bear or simply panda, is a bear species endemic to China.']], cutoff_layers=[28]) -print(scores) # [-10.0, 1.8203125] +print(scores) ``` ### Using Huggingface transformers