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
training code supported
hello? there are errors in processing dataset, using the default dataset"sentence-transformers/stsb", caused by " def _check_messages(row: Dict[str, Any]) -> None:
if 'messages' not in row:
return
messages = row['messages']
assert len(messages) > 0, f'messages: {messages}'"
I cannot reproduce the error, can you share us detail logs? or record an issue to us: https://github.com/modelscope/ms-swift
I firstly download the "sentence-transformers/stsb" dataset locally, and get a sentence-transformers___stsb folder, and i changed the argument
--dataset '/local path/to/sentence-transformers___stsb' to my local directory, and such case happens. but when i use --dataset 'sentence-transformers/stsb' directly, and everything goes well. why would that happen?