swulling/bge-reranker-large-onnx-o4
By swulling · ↓ 9 · ♥ 18 · Updated 2023-11-21
What's in this repo
This page lists the files in swulling/bge-reranker-large-onnx-o4, including model.onnx.
- 1 ONNX models (.onnx files)
- 10 files, including 5 .json, 1 .md, 1 .onnx, 1 .data, 1 .model
- Last updated 2023-11-21
ONNX files
| File | Size | Download |
|---|---|---|
| model.onnx | — | Download |
How to use
These ONNX files can be loaded with ONNX Runtime. To inspect a model graph, upload the file to the Netron viewer. Download links point to the original files on Hugging Face.
README
ONNX GPU Runtime with O4 for BAAI/bge-reranker-large
benchmark: https://colab.research.google.com/drive/1HP9GQKdzYa6H9SJnAZoxJWq920gxwd2k
Convert
!optimum-cli export onnx -m BAAI/bge-reranker-large --optimize O4 bge-reranker-large-onnx-o4 --device cuda
Usage
# pip install "optimum[onnxruntime-gpu]" transformers
from optimum.onnxruntime import ORTModelForSequenceClassification
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained('swulling/bge-reranker-large-onnx-o4')
model = ORTModelForSequenceClassification.from_pretrained('swulling/bge-reranker-large-onnx-o4')
model.to("cuda")
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.']]
with torch.no_grad():
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)
Source model
https://huggingface.co/BAAI/bge-reranker-large
Model info
text-classification
transformers
transformers
onnx
xlm-roberta
text-classification
license:mit
text-embeddings-inference
endpoints_compatible
region:us
↓ 9
♥ 18
Created: 2023-11-21
Updated: 2023-11-21
View on Hugging FaceFiles (10)
.gitattributes
README.md
config.json
model.onnx
ONNX
model.onnx.data
ort_config.json
sentencepiece.bpe.model
special_tokens_map.json
tokenizer.json
tokenizer_config.json