Skip to content

Commit

Permalink
fix UKPLab#3185: convert_to_numpy should be supported for token_embed…
Browse files Browse the repository at this point in the history
…dings
  • Loading branch information
bhavnicksm committed Jan 22, 2025
1 parent b1f1d03 commit 42c2234
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sentence_transformers/SentenceTransformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,9 +539,11 @@ def encode(
if convert_to_tensor:
convert_to_numpy = False

if output_value != "sentence_embedding":
convert_to_tensor = False
convert_to_numpy = False
# NOTE: Results in issue #3185, where the output is always a torch.Tensor,
# even when output_value is set to "token_embeddings"
# if output_value != "sentence_embedding":
# convert_to_tensor = False
# convert_to_numpy = False

input_was_string = False
if isinstance(sentences, str) or not hasattr(
Expand Down

0 comments on commit 42c2234

Please sign in to comment.