how do i adjust the output dimension when using vllm ?

#48
by vikyw89 - opened

how do i adjust the output dimension when using vllm ?

Jina AI org

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]

Sign up or log in to comment