Views
No views yet
👉For full documentation, see: https://github.com/GeoGPT-Research-Project/GeoGPT-RAG
1from FlagEmbedding import FlagReranker
2
3model_name_or_path = 'GeoGPT/GeoReranker'
4reranker = FlagReranker(model_name_or_path, use_fp16=True) # Setting use_fp16 to True speeds up computation with a slight performance degradation
5
6score = reranker.compute_score(['query', 'passage'])
7# You can map the scores into 0-1 by set "normalize=True", which will apply sigmoid function to the score
8score = reranker.compute_score(['query', 'passage'], normalize=True)
9scores = 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.']])
10# You can map the scores into 0-1 by set "normalize=True", which will apply sigmoid function to the score
11scores = 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.']], normalize=True)