Skip to content

Commit

Permalink
SentenceTransformer encode with torch
Browse files Browse the repository at this point in the history
  • Loading branch information
Kh4L committed Aug 27, 2024
1 parent 56fe85e commit 89c91de
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/text_embedder.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ def __init__(self, device: Optional[torch.device] = None):
)

def __call__(self, sentences: List[str]) -> Tensor:
return torch.from_numpy(self.model.encode(sentences))
return self.model.encode(sentences, convert_to_tensor=True)

0 comments on commit 89c91de

Please sign in to comment.