This repository hosts a vLLM-compatible version of
jina-embeddings-v4
with the
code
adapter merged into the base
Qwen2.5-VL
weights. This architecture modification enables native compatibility with vLLM without requiring custom adapter-handling code.
Usage
import torch
from PIL import Image
from vllm import LLM
from vllm.config import PoolerConfig
from vllm.inputs.data import TextPrompt
# Initialize model
model = LLM(
model="jinaai/jina-embeddings-v4-vllm-code",
task="embed",
override_pooler_config=PoolerConfig(pooling_type="ALL", normalize=False),
dtype="float16",
)
# Create text prompts
query =query = "Find a function that prints a greeting message to the console"
query_prompt = TextPrompt(
prompt=f"Query: {query}"
)
passage = "def hello_world():\n print('Hello, World!')"
passage_prompt = TextPrompt(
prompt=f"Passage: {passage}"
)
# Create image prompt
image = Image.open("<path_to_image>")
image_prompt = TextPrompt(
prompt="<|im_start|>user\n<|vision_start|><|image_pad|><|vision_end|>Describe the image.<|im_end|>\n",
multi_modal_data={"image": image},
)
# Encode all prompts
prompts = [query_prompt, passage_prompt, image_prompt]
outputs = model.encode(prompts)
defget_embeddings(outputs):
VISION_START_TOKEN_ID, VISION_END_TOKEN_ID = 151652, 151653
embeddings = []
for output in outputs:
if VISION_START_TOKEN_ID in output.prompt_token_ids:
# Gather only vision tokens
img_start_pos = torch.where(
torch.tensor(output.prompt_token_ids) == VISION_START_TOKEN_ID
)[0][0]
img_end_pos = torch.where(
torch.tensor(output.prompt_token_ids) == VISION_END_TOKEN_ID
)[0][0]
embeddings_tensor = output.outputs.data.detach().clone()[
img_start_pos : img_end_pos + 1
]
else:
# Use all tokens for text-only prompts
embeddings_tensor = output.outputs.data.detach().clone()
# Pool and normalize embeddings
pooled_output = (
embeddings_tensor.sum(dim=0, dtype=torch.float32)
/ embeddings_tensor.shape[0]
)
embeddings.append(torch.nn.functional.normalize(pooled_output, dim=-1))
return embeddings
embeddings = get_embeddings(outputs)
Runs of jinaai jina-embeddings-v4-vllm-code on huggingface.co
54
Total runs
0
24-hour runs
5
3-day runs
6
7-day runs
29
30-day runs
More Information About jina-embeddings-v4-vllm-code huggingface.co Model
More jina-embeddings-v4-vllm-code license Visit here:
jina-embeddings-v4-vllm-code huggingface.co is an AI model on huggingface.co that provides jina-embeddings-v4-vllm-code's model effect (), which can be used instantly with this jinaai jina-embeddings-v4-vllm-code model. huggingface.co supports a free trial of the jina-embeddings-v4-vllm-code model, and also provides paid use of the jina-embeddings-v4-vllm-code. Support call jina-embeddings-v4-vllm-code model through api, including Node.js, Python, http.
jina-embeddings-v4-vllm-code huggingface.co is an online trial and call api platform, which integrates jina-embeddings-v4-vllm-code's modeling effects, including api services, and provides a free online trial of jina-embeddings-v4-vllm-code, you can try jina-embeddings-v4-vllm-code online for free by clicking the link below.
jinaai jina-embeddings-v4-vllm-code online free url in huggingface.co:
jina-embeddings-v4-vllm-code is an open source model from GitHub that offers a free installation service, and any user can find jina-embeddings-v4-vllm-code on GitHub to install. At the same time, huggingface.co provides the effect of jina-embeddings-v4-vllm-code install, users can directly use jina-embeddings-v4-vllm-code installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
jina-embeddings-v4-vllm-code install url in huggingface.co: