Skip to content

Commit

Permalink
Upgrade transformers to 4.47 (#752)
Browse files Browse the repository at this point in the history
The upgrade fixes a crash tracing the baai/bge-m3 model

(cherry picked from commit ee4d701)
  • Loading branch information
davidkyle authored and github-actions[bot] committed Feb 12, 2025
1 parent 6759b1d commit c498f6f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions eland/ml/pytorch/transformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ class _TraceableTextEmbeddingModel(_TransformerTraceableModel):
def _prepare_inputs(self) -> transformers.BatchEncoding:
return self._tokenizer(
"This is an example sentence.",
padding="max_length",
padding="longest",
return_tensors="pt",
)

Expand Down Expand Up @@ -759,7 +759,7 @@ def _find_max_sequence_length(self) -> int:
# a random or very large value.
REASONABLE_MAX_LENGTH = 8192
max_len = getattr(self._tokenizer, "model_max_length", None)
if max_len is not None and max_len < REASONABLE_MAX_LENGTH:
if max_len is not None and max_len <= REASONABLE_MAX_LENGTH:
return int(max_len)

max_sizes = getattr(self._tokenizer, "max_model_input_sizes", dict())
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"sentence-transformers>=2.1.0,<=2.7.0",
# sentencepiece is a required dependency for the slow tokenizers
# https://huggingface.co/transformers/v4.4.2/migration.html#sentencepiece-is-removed-from-the-required-dependencies
"transformers[sentencepiece]>=4.31.0,<4.44.0",
"transformers[sentencepiece]>=4.47.0",
],
}
extras["all"] = list({dep for deps in extras.values() for dep in deps})
Expand Down

0 comments on commit c498f6f

Please sign in to comment.