Instructions to use Alibaba-NLP/gte-en-mlm-large with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Alibaba-NLP/gte-en-mlm-large with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="Alibaba-NLP/gte-en-mlm-large")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("Alibaba-NLP/gte-en-mlm-large") model = AutoModelForMaskedLM.from_pretrained("Alibaba-NLP/gte-en-mlm-large", 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, rope_theta and auto_map are left untouched, so nothing changes for anyone on an older version.
Produced by?
β rope_parameters is the standardised form of the existing rope_theta. This checkpoint leaves rope_scaling at null, so the standardised form is a plain default rope with the same base.
β Outputs are reproduced against the original implementation on this checkpoint (max relative difference 3.6e-06), and the checkpoint is covered by the parity harness in the Transformers PR.
Thanks @harshaljanjani for implementing native GTE support in transformers (huggingface/transformers#48416) and opening this PR, and thanks @tomaarsen for the clean native configuration and README updates in tomaarsen/gte-en-mlm-large-native!
Building on commit 6e6f6d2, I pushed a follow-up commit merging the clean native config and README updates from tomaarsen/gte-en-mlm-large-native:
- Updated
config.json: setarchitecturesto["GteForMaskedLM"],dtype: "bfloat16",tie_word_embeddings: true, and removedauto_mapand legacynew-implfields sotransformers>=5.18.0loads natively even whentrust_remote_code=Trueis passed, and Hub metadata (transformersInfo,endpoints_compatible) is detected cleanly. - Updated
README.md: addedlibrary_name: transformers, nativetransformers>=5.18.0usage instructions, and credits linking to both @harshaljanjani and @tomaarsen (tomaarsen/gte-en-mlm-large-native).
Weights (model.safetensors) and tokenizer files remain unchanged. Keeping this PR open for final review before merging.