Skip to content

Commit da30f93

Browse files
fix: Fix colbert model shape mismatch (#413)
* fix: Fix colbert model shape mismatch * refactor: Added the truncation after tokenizer init
1 parent adfc03e commit da30f93

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fastembed/late_interaction/colbert.py

+3
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@ def load_onnx_model(self) -> None:
191191
self.tokenizer.encode(symbol, add_special_tokens=False).ids[0]
192192
for symbol in string.punctuation
193193
}
194+
current_max_length = self.tokenizer.truncation["max_length"]
195+
# ensure not to overflow after adding document-marker
196+
self.tokenizer.enable_truncation(max_length=current_max_length - 1)
194197

195198
def embed(
196199
self,

0 commit comments

Comments
 (0)