Instructions to use Alibaba-NLP/gte-large-en-v1.5 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Alibaba-NLP/gte-large-en-v1.5 with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Alibaba-NLP/gte-large-en-v1.5", trust_remote_code=True, device_map="auto") - sentence-transformers
How to use Alibaba-NLP/gte-large-en-v1.5 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("Alibaba-NLP/gte-large-en-v1.5", trust_remote_code=True) sentences = [ "That is a happy person", "That is a happy dog", "That is a very happy person", "Today is a sunny day" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Transformers.js
How to use Alibaba-NLP/gte-large-en-v1.5 with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('sentence-similarity', 'Alibaba-NLP/gte-large-en-v1.5'); - 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 4.1e-07), and the slow integration tests in the Transformers PR run against this revision.