Visual Document Retrieval
Transformers
Safetensors
ColPali
sentence-transformers
multilingual
feature-extraction
vidore
multimodal-embedding
multilingual-embedding
Text-to-Visual Document (T→VD) retrieval
sentence-similarity
mteb
vllm
custom_code
🇪🇺 Region: EU
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, dtype="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
how do i adjust the output dimension when using vllm ?
#48
by vikyw89 - opened
how do i adjust the output dimension when using vllm ?
Hi @vikyw89 ,
you can modify the pooling function to truncate the pooled output before normalization:
# Pool and normalize embeddings
pooled_output = (
embeddings_tensor.sum(dim=0, dtype=torch.float32)
/ embeddings_tensor.shape[0]
)
pooled_output = pooled_output[:N] # added this line. N is your target dimension.
embeddings.append(torch.nn.functional.normalize(pooled_output, dim=-1))
Code snippet from: https://huggingface.co/jinaai/jina-embeddings-v4-vllm-retrieval
We trained on the following dimensions: [128, 256, 512, 1024, 2048]