diff --git a/src/User_Manual/SentenceTransformer.py b/src/User_Manual/SentenceTransformer.py index 91bd3a26..1213e9a3 100644 --- a/src/User_Manual/SentenceTransformer.py +++ b/src/User_Manual/SentenceTransformer.py @@ -313,6 +313,16 @@ def __init__( super().__init__(modules) + # Ensure all tensors in the model are of the same dtype as the first tensor + # This is necessary if the first module has been given a lower precision via + # model_kwargs["torch_dtype"]. The rest of the model should be loaded in the same dtype + # See #2887 for more details + try: + dtype = next(self.parameters()).dtype + self.to(dtype) + except StopIteration: + pass + self.to(device) self.is_hpu_graph_enabled = False diff --git a/src/User_Manual/chart_chat.png b/src/User_Manual/chart_chat.png index 49092311..c8bf7f54 100644 Binary files a/src/User_Manual/chart_chat.png and b/src/User_Manual/chart_chat.png differ