Skip to content

Commit

Permalink
fix: Fix colbert model shape mismatch (#413)
Browse files Browse the repository at this point in the history
* fix: Fix colbert model shape mismatch

* refactor: Added the truncation after tokenizer init
  • Loading branch information
hh-space-invader authored Nov 28, 2024
1 parent adfc03e commit da30f93
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 @@ -191,6 +191,9 @@ def load_onnx_model(self) -> None:
self.tokenizer.encode(symbol, add_special_tokens=False).ids[0]
for symbol in string.punctuation
}
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)

def embed(
self,
Expand Down

0 comments on commit da30f93

Please sign in to comment.