Skip to content

Commit

Permalink
query_max_length
Browse files Browse the repository at this point in the history
  • Loading branch information
I8dNLo committed Jan 13, 2025
1 parent 939a1c0 commit 78dcc33
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fastembed/late_interaction_multimodal/colpali.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class ColPali(LateInteractionMultimodalEmbeddingBase, OnnxMultimodalModel[np.nda
IMAGE_PLACEHOLDER_SIZE = (3, 448, 448)
EMPTY_TEXT_PLACEHOLDER = np.array([257152] * 1024 + [2, 50721, 573, 2416, 235265, 108])
EVEN_ATTENTION_MASK = np.array([1] * 1030)
QUERY_MAX_LENGTH = 50

def __init__(
self,
Expand Down Expand Up @@ -165,7 +166,7 @@ def tokenize(self, documents: list[str], **_) -> list[Encoding]:
query += "\n"

texts_query.append(query)
encoded = self.tokenizer.encode_batch(texts_query)
encoded = self.tokenizer.encode_batch(texts_query, max_length=self.QUERY_MAX_LENGTH)
return encoded

def _preprocess_onnx_text_input(
Expand Down

0 comments on commit 78dcc33

Please sign in to comment.