Visual Document Retrieval
Transformers
Safetensors
ColPali
sentence-transformers
multilingual
image-feature-extraction
vidore
multimodal-embedding
multilingual-embedding
Text-to-Visual Document (T→VD) retrieval
feature-extraction
sentence-similarity
mteb
custom_code
Instructions to use ashrielbrian/jina-embeddings-v4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ashrielbrian/jina-embeddings-v4 with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("ashrielbrian/jina-embeddings-v4", trust_remote_code=True, dtype="auto") - ColPali
How to use ashrielbrian/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 ashrielbrian/jina-embeddings-v4 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("ashrielbrian/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
Brian Tang commited on
Commit ·
8f0a794
1
Parent(s): 49ebb9c
Adds flash attention check with the device type
Browse files
modeling_jina_embeddings_v4.py
CHANGED
|
@@ -569,7 +569,8 @@ class JinaEmbeddingsV4Model(Qwen2_5_VLForConditionalGeneration):
|
|
| 569 |
kwargs["torch_dtype"] = "auto"
|
| 570 |
|
| 571 |
kwargs["key_mapping"] = super()._checkpoint_conversion_mapping
|
| 572 |
-
|
|
|
|
| 573 |
kwargs["attn_implementation"] = "sdpa"
|
| 574 |
|
| 575 |
base_model = super().from_pretrained(
|
|
|
|
| 569 |
kwargs["torch_dtype"] = "auto"
|
| 570 |
|
| 571 |
kwargs["key_mapping"] = super()._checkpoint_conversion_mapping
|
| 572 |
+
device = kwargs.get("device", "auto")
|
| 573 |
+
if not is_flash_attn_2_available() or device == "cpu":
|
| 574 |
kwargs["attn_implementation"] = "sdpa"
|
| 575 |
|
| 576 |
base_model = super().from_pretrained(
|