Downloads · 30 days
53
13% of all-time downloads
OpenVINO/bge-reranker-base-fp16-ov
bge-reranker-base-fp16-ov is a machine learning model from OpenVINO. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
Model creator: BAAI Original model: bge-reranker-base
Downloads · 30 days
53
13% of all-time downloads
All-time downloads
404
Public
Repo size
2.3 GB
Likes
0
Public
Click a slice to open those files.
.bin1.1 GB · 98%
From the Hugging Face model README
This is bge-reranker-base model converted to the OpenVINO™ IR (Intermediate Representation) format with weights compressed to FP16.
The provided OpenVINO™ IR model is compatible with:
pip install optimum[openvino]
from transformers import AutoTokenizer
from optimum.intel import OVModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained('OpenVINO/bge-reranker-base-fp16-ov')
model = OVModelForSequenceClassification.from_pretrained('OpenVINO/bge-reranker-base-fp16-ov')
pairs = [['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.']]
inputs = tokenizer(pairs, padding=True, truncation=True, return_tensors='pt', max_length=512)
scores = model(**inputs, return_dict=True).logits.view(-1, ).float()
print(scores)
For more examples and possible optimizations, refer to the Inference with Optimum Intel.
You can find more detailed usage examples in OpenVINO Notebooks:
1a. Deploy model on Windows using binary package:
mkdir C:\models
ovms.exe --rest_port 8000 --source_model OpenVINO/bge-reranker-base-fp16-ov --model_repository_path C:\models
1b. Deploy model in a Docker container:
mkdir -p ${HOME}/models
export GPU_ARGS=$(if ls /dev/dri/render* >/dev/null 2>&1; then echo "--device /dev/dri --group-add $(stat -c '%g' /dev/dri/render* | head -n1)"; fi)
docker run -d ${GPU_ARGS} --rm --user $(id -u):$(id -g) -p 8000:8000 -v ${HOME}/models:/models openvino/model_server:latest-gpu --rest_port 8000 --model_repository_path /models --source_model OpenVINO/bge-reranker-base-fp16-ov
pip install cohere
import cohere
client = cohere.Client(base_url="http://localhost:8000/v1", api_key="not_used")
query = "What is the capital of France?"
documents = [
"Paris is the capital city of France.",
"Berlin is the capital city of Germany.",
]
response = client.rerank(
model="OpenVINO/bge-reranker-base-fp16-ov",
query=query,
documents=documents,
)
for result in response.results:
print(result.index, result.relevance_score)
Check the original model card for limitations.
The original model is distributed under MIT license. More details can be found in bge-reranker-base.
Intel is committed to respecting human rights and avoiding causing or contributing to adverse impacts on human rights. See Intel’s Global Human Rights Principles. Intel’s products and software are intended only to be used in applications that do not cause or contribute to adverse impacts on human rights.