MCPcopy Create free account
hub / github.com/Yuan-Li-FNLP/R3-RAG / multi_gpu_encode

Method multi_gpu_encode

tool/FlashRAG/flashrag/retriever/encoder.py:76–80  ·  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

74
75 @torch.inference_mode()
76 def multi_gpu_encode(self, query_list: Union[List[str], str], batch_size=64, is_query=True) -> np.ndarray:
77 if self.gpu_num > 1:
78 self.model = torch.nn.DataParallel(self.model)
79 query_emb = self.encode(query_list, batch_size, is_query)
80 return query_emb
81
82
83class STEncoder:

Callers 2

encode_allMethod · 0.45
encode_all_clipMethod · 0.45

Calls 1

encodeMethod · 0.95

Tested by

no test coverage detected