Feature Extraction
sentence-transformers
PyTorch
Safetensors
Transformers
English
mistral
mteb
Eval Results (legacy)
Eval Results
text-embeddings-inference
Instructions to use intfloat/e5-mistral-7b-instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use intfloat/e5-mistral-7b-instruct with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("intfloat/e5-mistral-7b-instruct") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Transformers
How to use intfloat/e5-mistral-7b-instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="intfloat/e5-mistral-7b-instruct")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("intfloat/e5-mistral-7b-instruct") model = AutoModel.from_pretrained("intfloat/e5-mistral-7b-instruct", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files6875 unmodified lines687668776878687968806881688268836884688535 unmodified lines69216922692369246925692669271 unmodified line6929693069316932693369346875 unmodified lines# Each query must come with a one-sentence instruction that describes the tasktask = 'Given a web search query, retrieve relevant passages that answer the query'input_texts = [get_detailed_instruct(task, 'how much protein should a female eat'),get_detailed_instruct(task, 'summit define'),"As a general guideline, the CDC's average requirement of protein for women ages 19 to 70 is 46 grams per day. But, as you can see from this chart, you'll need to increase that if you're expecting or training for a marathon. Check out the chart below to see how much protein you should be eating each day.","Definition of summit for English Language Learners. : 1 the highest point of a mountain : the top of a mountain. : 2 the highest level. : 3 a meeting or series of meetings between the leaders of two or more governments."]tokenizer = AutoTokenizer.from_pretrained('intfloat/e5-mistral-7b-instruct')model = AutoModel.from_pretrained('intfloat/e5-mistral-7b-instruct')35 unmodified linesThe task definition should be a one-sentence instruction that describes the task.This is a way to customize text embeddings for different scenarios through natural language instructions.Please check out [unilm/e5/utils.py](https://github.com/microsoft/unilm/blob/16da2f193b9c1dab0a692c6e4380bd43e70a40cd/e5/utils.py#L93) for instructions we used for evaluation.On the other hand, there is no need to add instructions to the document side.1 unmodified lineDifferent versions of `transformers` and `pytorch` could cause negligible but non-zero performance differences.## CitationIf you find our paper or models helpful, please consider cite as follows:6875 unmodified lines687668776878687968806881688268836884688568866887688868896890689135 unmodified lines69276928692969306931693269331 unmodified line69356936693769386939694069416942694369446875 unmodified lines# Each query must come with a one-sentence instruction that describes the tasktask = 'Given a web search query, retrieve relevant passages that answer the query'queries = [get_detailed_instruct(task, 'how much protein should a female eat'),get_detailed_instruct(task, 'summit define')]# No need to add instruction for retrieval documentsdocuments = ["As a general guideline, the CDC's average requirement of protein for women ages 19 to 70 is 46 grams per day. But, as you can see from this chart, you'll need to increase that if you're expecting or training for a marathon. Check out the chart below to see how much protein you should be eating each day.","Definition of summit for English Language Learners. : 1 the highest point of a mountain : the top of a mountain. : 2 the highest level. : 3 a meeting or series of meetings between the leaders of two or more governments."]input_texts = queries + documentstokenizer = AutoTokenizer.from_pretrained('intfloat/e5-mistral-7b-instruct')model = AutoModel.from_pretrained('intfloat/e5-mistral-7b-instruct')35 unmodified linesThe task definition should be a one-sentence instruction that describes the task.This is a way to customize text embeddings for different scenarios through natural language instructions.Please check out [unilm/e5/utils.py](https://github.com/microsoft/unilm/blob/9c0f1ff7ca53431fe47d2637dfe253643d94185b/e5/utils.py#L106) for instructions we used for evaluation.On the other hand, there is no need to add instructions to the document side.1 unmodified lineDifferent versions of `transformers` and `pytorch` could cause negligible but non-zero performance differences.**3. Where are the LoRA-only weights?**You can find the LoRA-only weights at [https://huggingface.co/intfloat/e5-mistral-7b-instruct/tree/main/lora](https://huggingface.co/intfloat/e5-mistral-7b-instruct/tree/main/lora).## CitationIf you find our paper or models helpful, please consider cite as follows:
README.md+15-5