Skip to content

Commit

Permalink
fix: Fix colbert model shape mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
hh-space-invader committed Nov 25, 2024
1 parent adfc03e commit 0f0c4f4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fastembed/late_interaction/colbert.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ def _tokenize_query(self, query: str) -> list[Encoding]:
return encoded

def _tokenize_documents(self, documents: list[str]) -> list[Encoding]:
current_max_length = self.tokenizer.truncation["max_length"]
# ensure not to overflow after adding document-marker
self.tokenizer.enable_truncation(max_length=current_max_length - 1)
encoded = self.tokenizer.encode_batch(documents)
return encoded

Expand Down

0 comments on commit 0f0c4f4

Please sign in to comment.