fix: fix the bug
Browse files
modeling_jina_embeddings_v4.py
CHANGED
@@ -346,13 +346,13 @@ class JinaEmbeddingsV4Model(Qwen2_5_VLForConditionalGeneration):
|
|
346 |
):
|
347 |
embeddings = self(**batch, task_label=task_label)
|
348 |
attention_mask = embeddings.attention_mask
|
349 |
-
if
|
350 |
embeddings = embeddings.single_vec_emb
|
351 |
if truncate_dim is not None:
|
352 |
embeddings = embeddings[:, :truncate_dim]
|
353 |
else:
|
354 |
embeddings = embeddings.multi_vec_emb
|
355 |
-
if return_multivector:
|
356 |
valid_tokens = attention_mask.bool()
|
357 |
embeddings = [emb[mask] for emb, mask in zip(embeddings, valid_tokens)]
|
358 |
results.append(embeddings)
|
|
|
346 |
):
|
347 |
embeddings = self(**batch, task_label=task_label)
|
348 |
attention_mask = embeddings.attention_mask
|
349 |
+
if not return_multivector:
|
350 |
embeddings = embeddings.single_vec_emb
|
351 |
if truncate_dim is not None:
|
352 |
embeddings = embeddings[:, :truncate_dim]
|
353 |
else:
|
354 |
embeddings = embeddings.multi_vec_emb
|
355 |
+
if return_multivector and not return_numpy:
|
356 |
valid_tokens = attention_mask.bool()
|
357 |
embeddings = [emb[mask] for emb, mask in zip(embeddings, valid_tokens)]
|
358 |
results.append(embeddings)
|