Instructions to use jinaai/jina-embeddings-v4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use jinaai/jina-embeddings-v4 with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("jinaai/jina-embeddings-v4", trust_remote_code=True, device_map="auto") - ColPali
How to use jinaai/jina-embeddings-v4 with ColPali:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- sentence-transformers
How to use jinaai/jina-embeddings-v4 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("jinaai/jina-embeddings-v4", trust_remote_code=True) 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] - Notebooks
- Google Colab
- Kaggle
Retrieval using images
Hi,
I'm interested in the possibility of using images as both documents to embed and as query against these stored documents, is this a possibility with this model?
I note in the 'modeling_jina_embeddings_v4.py' file the public interface for 'encode_text' there is a the 'prompt_name: Type of text being encoded ('query' or 'passage')' which applies to the 'retrieval' task, and there does not appear to be this for the 'encode_image' method. Is the above case not possible or is it that the retrieval task is does not differentiate between images as passages or as queries?
Thanks for any help.
We only trained the model for text-to-image search (for pictures and screenshots of documents). Therefore, we also did not consider different prompts for images. So it might not be ideal for image-to-image search. Nevertheless, you can still try this. I wouldn't use any specific prompts for queries and documents in this case.