jina-embeddings-v3-hf

2.3K
3
license:cc-by-nc-4.0
by
jinaai
Embedding Model
OTHER
New
2K downloads
Early-stage
Edge AI:
Mobile
Laptop
Server
Unknown
Mobile
Laptop
Server
Quick Summary

AI model with specialized capabilities.

Code Examples

Load and activate the retrieval_query LoRA adapterpythontransformers
import torch
import torch.nn.functional as F
from transformers import AutoModel, AutoTokenizer

model = AutoModel.from_pretrained("jinaai/jina-embeddings-v3-hf", dtype=torch.float32)

# Load and activate the retrieval_query LoRA adapter
# Available tasks: retrieval_query, retrieval_passage, separation, classification, text_matching
task = "retrieval_query"
model.load_adapter("jinaai/jina-embeddings-v3-hf", adapter_name=task, adapter_kwargs={"subfolder": task})
model.set_adapter(task)
model.eval()

tokenizer = AutoTokenizer.from_pretrained("jinaai/jina-embeddings-v3-hf")
texts = ["How is the weather today?", "What is the current weather like today?"]
encoded = tokenizer(texts, padding=True, truncation=True, return_tensors="pt")

with torch.no_grad():
    outputs = model(**encoded)

# Mean pooling
attention_mask = encoded["attention_mask"].unsqueeze(-1)
embeddings = (outputs.last_hidden_state * attention_mask).sum(dim=1) / attention_mask.sum(dim=1)
embeddings = F.normalize(embeddings, p=2, dim=1)

print(embeddings.shape)
# Cosine similarity
print(embeddings @ embeddings.T)
Citationbibtex
@misc{sturua2024jinaembeddingsv3multilingualembeddingstask,
      title={jina-embeddings-v3: Multilingual Embeddings With Task LoRA}, 
      author={Saba Sturua and Isabelle Mohr and Mohammad Kalim Akram and Michael Günther and Bo Wang and Markus Krimmel and Feng Wang and Georgios Mastrapas and Andreas Koukounas and Andreas Koukounas and Nan Wang and Han Xiao},
      year={2024},
      eprint={2409.10173},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2409.10173}, 
}

Deploy This Model

Production-ready deployment in minutes

Together.ai

Instant API access to this model

Fastest API

Production-ready inference API. Start free, scale to millions.

Try Free API

Replicate

One-click model deployment

Easiest Setup

Run models in the cloud with simple API. No DevOps required.

Deploy Now

Disclosure: We may earn a commission from these partners. This helps keep LLMYourWay free.