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, device_map="auto") - Notebooks
- Google Colab
- Kaggle
feat(transformers): Add native Transformers config
What does this PR do?
β Sets model_type from new to gte and adds rope_parameters, so the checkpoint loads directly with AutoModel / AutoConfig in Transformers π€ without trust_remote_code.
β Transformers support is being added in https://github.com/huggingface/transformers/pull/48416
β β οΈ Please hold this until the Transformers PR above has landed π€
Compatibility
β rope_scaling and rope_theta are replaced by rope_parameters. rope_scaling cannot be kept alongside it, because Transformers reads that key first and ntk is not one of its rope types.
β auto_map is left in place, but on this revision a trust_remote_code=True load no longer finds rope_theta / rope_scaling and falls back to the remote defaults (rope_theta=10000.0, rope_scaling=None) instead of this checkpoint's values. That changes the embeddings, and the gap grows with sequence length, so anyone staying on an older Transformers version should pin a revision from before this PR.
Produced by?
β rope_parameters is the standardised form of the existing rope_scaling / rope_theta pair. GTE applies NTK scaling statically at construction by rescaling the base and dividing the inverse frequencies by factor ** (2 / head_dim), which is exactly a linear scaling with base rope_theta * factor, so the inverse frequencies are unchanged.
β Outputs are reproduced against the original implementation on this checkpoint (max relative difference 1.1e-06), and the slow integration tests in the Transformers PR run against this revision.