Skip to content

Commit

Permalink
Remove unrelated changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurCamara committed Sep 30, 2024
1 parent 4a82531 commit 8944de0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion sentence_transformers/SentenceTransformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ def encode(

return all_embeddings

def forward(self, input: dict[str, Tensor], **kwargs) -> dict[str, Tensor]:
def forward(self, input: dict[str, torch.Tensor], **kwargs) -> dict[str, torch.Tensor]:
if self.module_kwargs is None:
return super().forward(input)

Expand Down
2 changes: 1 addition & 1 deletion sentence_transformers/models/Pooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def __init__(
pooling_mode_mean_sqrt_len_tokens: bool = False,
pooling_mode_weightedmean_tokens: bool = False,
pooling_mode_lasttoken: bool = False,
include_prompt = True,
include_prompt=True,
) -> None:
super().__init__()

Expand Down
5 changes: 2 additions & 3 deletions sentence_transformers/models/Transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def forward(self, features: dict[str, torch.Tensor], **kwargs) -> dict[str, torc
trans_features = {"input_ids": features["input_ids"], "attention_mask": features["attention_mask"]}
if "token_type_ids" in features:
trans_features["token_type_ids"] = features["token_type_ids"]

output_states = self.auto_model(**trans_features, **kwargs, return_dict=False)
output_tokens = output_states[0]

Expand All @@ -135,9 +136,7 @@ def get_word_embedding_dimension(self) -> int:
return self.auto_model.config.hidden_size

def tokenize(
self,
texts: list[str] | list[dict] | list[tuple[str, str]],
padding: str | bool = True
self, texts: list[str] | list[dict] | list[tuple[str, str]], padding: str | bool = True
) -> dict[str, torch.Tensor]:
"""Tokenizes a text and maps tokens to token-ids"""
output = {}
Expand Down

0 comments on commit 8944de0

Please sign in to comment.