Text Ranking
sentence-transformers
Safetensors
Transformers
new
text-classification
text-embeddings-inference
custom_code
Instructions to use Alibaba-NLP/gte-multilingual-reranker-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use Alibaba-NLP/gte-multilingual-reranker-base with sentence-transformers:
from sentence_transformers import CrossEncoder model = CrossEncoder("Alibaba-NLP/gte-multilingual-reranker-base", trust_remote_code=True) query = "Which planet is known as the Red Planet?" passages = [ "Venus is often called Earth's twin because of its similar size and proximity.", "Mars, known for its reddish appearance, is often referred to as the Red Planet.", "Jupiter, the largest planet in our solar system, has a prominent red spot.", "Saturn, famous for its rings, is sometimes mistaken for the Red Planet." ] scores = model.predict([(query, passage) for passage in passages]) print(scores) - Transformers
How to use Alibaba-NLP/gte-multilingual-reranker-base with Transformers:
# Load model directly from transformers import AutoModelForSequenceClassification model = AutoModelForSequenceClassification.from_pretrained("Alibaba-NLP/gte-multilingual-reranker-base", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
unable to load the model
#1
by Ratar37003 - opened
OSError: Unable to load vocabulary from file. Please check that the provided vocabulary is accessible and not corrupted.
The provided dictionary file is fine.
>>>import transformers
>>> from transformers import AutoTokenizer
>>> model_name_or_path = "gte-multilingual-reranker-base"
>>> tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
>>> tokenizer("hello world")
{'input_ids': [0, 33600, 31, 8999, 2], 'attention_mask': [1, 1, 1, 1, 1]}
>>> transformers.__version__
'4.39.2'