Instructions to use Alibaba-NLP/gte-Qwen2-1.5B-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-1.5B-instruct with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("Alibaba-NLP/gte-Qwen2-1.5B-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-1.5B-instruct with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Alibaba-NLP/gte-Qwen2-1.5B-instruct", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("Alibaba-NLP/gte-Qwen2-1.5B-instruct", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Best way to apply to some specific language?
Hi, first of all, thanks for contribute good model to the community. I want to ask for some recommendation or some suggestion about apply or continue finetune or pretrain this on specific language such as vietnamese,...Which is the best way to improve the quality? Thanks
One idea I think could work, but haven't tried yet, is to modify the prompt. The default prompt can be found here: https://huggingface.co/Alibaba-NLP/gte-Qwen2-1.5B-instruct/blob/main/config_sentence_transformers.json. You could for instance edit this into: "Instruct: Given a Vietnamese web search query, retrieve relevant Vietnamese passages that answer the query\nQuery: "
Thanks, i will try it.