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

Method encode

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

Source from the content-addressed store, hash-verified

116
117 @torch.inference_mode()
118 def encode(self, query_list: Union[List[str], str], batch_size=64, is_query=True) -> np.ndarray:
119 query_list = parse_query(self.model_name, query_list, self.instruction, is_query)
120 query_emb = self.model.encode(
121 query_list, batch_size=batch_size, convert_to_numpy=True, normalize_embeddings=True, show_progress_bar=True
122 )
123 query_emb = query_emb.astype(np.float32, order="C")
124
125 return query_emb
126
127 @torch.inference_mode()
128 def multi_gpu_encode(self, query_list: Union[List[str], str], batch_size=None, is_query=True) -> np.ndarray:

Callers

nothing calls this directly

Calls 2

parse_queryFunction · 0.90
encodeMethod · 0.45

Tested by

no test coverage detected