Sentence Similarity
sentence-transformers
Safetensors
Transformers
qwen2
text-generation
mteb
Qwen2
custom_code
Eval Results (legacy)
text-embeddings-inference
Instructions to use Alibaba-NLP/gte-Qwen2-7B-instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use Alibaba-NLP/gte-Qwen2-7B-instruct with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("Alibaba-NLP/gte-Qwen2-7B-instruct", 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
How to use Alibaba-NLP/gte-Qwen2-7B-instruct with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Alibaba-NLP/gte-Qwen2-7B-instruct", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("Alibaba-NLP/gte-Qwen2-7B-instruct", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Query side instruction tuning
#5
by inkoon - opened
In the model card, it says "Instruction tuning, applied soley on the query side."
Does this mean that only the s(qi, dj) and s(qi, qj) terms are used in the contrastive loss?
If not, what does it mean?
Query side instruction tuning refers to using instructions only on the query side during both training and inference phases to indicate different tasks, domains, or other information, while no instructions are used on the document (doc) side. The input format for the query is {instruct} + Query, while the input for the doc remains the original document.
inkoon changed discussion status to closed