MCPcopy Create free account
hub / github.com/Agent-RL/ReCall / encode

Method encode

src/flashrag/retriever/encoder.py:68–76  ·  view source on GitHub ↗
(self, query_list: List[str], batch_size=64, is_query=True)

Source from the content-addressed store, hash-verified

66
67 @torch.inference_mode()
68 def encode(self, query_list: List[str], batch_size=64, is_query=True) -> np.ndarray:
69 print('-------------encode----------------')
70 print(query_list)
71 print('--------------------------------')
72 query_emb = []
73 for i in tqdm(range(0, len(query_list), batch_size), desc="Encoding process: "):
74 query_emb.append(self.single_batch_encode(query_list[i : i + batch_size], is_query))
75 query_emb = np.concatenate(query_emb, axis=0)
76 return query_emb
77
78 @torch.inference_mode()
79 def multi_gpu_encode(self, query_list: Union[List[str], str], batch_size=64, is_query=True) -> np.ndarray:

Callers 15

multi_gpu_encodeMethod · 0.95
encode_allMethod · 0.45
encode_all_clipMethod · 0.45
_searchMethod · 0.45
_batch_searchMethod · 0.45
_searchMethod · 0.45
_batch_searchMethod · 0.45
encodeMethod · 0.45
get_rerank_scoresMethod · 0.45
compress_promptMethod · 0.45
get_token_lengthMethod · 0.45
get_scoreMethod · 0.45

Calls 1

single_batch_encodeMethod · 0.95

Tested by

no test coverage detected