You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"""encode the queries using the instruction if provided.
143
139
@@ -166,12 +162,12 @@ def encode_queries(
166
162
)
167
163
168
164
defencode_corpus(
169
-
self,
170
-
corpus: Union[List[str], str],
171
-
batch_size: Optional[int] =None,
172
-
max_length: Optional[int] =None,
173
-
convert_to_numpy: Optional[bool] =None,
174
-
**kwargs: Any
165
+
self,
166
+
corpus: Union[List[str], str],
167
+
batch_size: Optional[int] =None,
168
+
max_length: Optional[int] =None,
169
+
convert_to_numpy: Optional[bool] =None,
170
+
**kwargs: Any
175
171
):
176
172
"""encode the corpus using the instruction if provided.
177
173
@@ -203,14 +199,14 @@ def encode_corpus(
203
199
)
204
200
205
201
defencode(
206
-
self,
207
-
sentences: Union[List[str], str],
208
-
batch_size: Optional[int] =None,
209
-
max_length: Optional[int] =None,
210
-
convert_to_numpy: Optional[bool] =None,
211
-
instruction: Optional[str] =None,
212
-
instruction_format: Optional[str] =None,
213
-
**kwargs: Any
202
+
self,
203
+
sentences: Union[List[str], str],
204
+
batch_size: Optional[int] =None,
205
+
max_length: Optional[int] =None,
206
+
convert_to_numpy: Optional[bool] =None,
207
+
instruction: Optional[str] =None,
208
+
instruction_format: Optional[str] =None,
209
+
**kwargs: Any
214
210
):
215
211
"""encode the input sentences with the embedding model.
216
212
@@ -265,13 +261,13 @@ def __del__(self):
265
261
266
262
@abstractmethod
267
263
defencode_single_device(
268
-
self,
269
-
sentences: Union[List[str], str],
270
-
batch_size: int=256,
271
-
max_length: int=512,
272
-
convert_to_numpy: bool=True,
273
-
device: Optional[str] =None,
274
-
**kwargs: Any,
264
+
self,
265
+
sentences: Union[List[str], str],
266
+
batch_size: int=256,
267
+
max_length: int=512,
268
+
convert_to_numpy: bool=True,
269
+
device: Optional[str] =None,
270
+
**kwargs: Any,
275
271
):
276
272
"""
277
273
This method should encode sentences and return embeddings on a single device.
@@ -280,8 +276,8 @@ def encode_single_device(
280
276
281
277
# adapted from https://github.com/UKPLab/sentence-transformers/blob/1802076d4eae42ff0a5629e1b04e75785d4e193b/sentence_transformers/SentenceTransformer.py#L807
Starts a multi-process pool to process the encoding with several independent processes
@@ -320,7 +316,7 @@ def start_multi_process_pool(
320
316
# adapted from https://github.com/UKPLab/sentence-transformers/blob/1802076d4eae42ff0a5629e1b04e75785d4e193b/sentence_transformers/SentenceTransformer.py#L976
# adapted from https://github.com/UKPLab/sentence-transformers/blob/1802076d4eae42ff0a5629e1b04e75785d4e193b/sentence_transformers/SentenceTransformer.py#L877
0 commit comments