(self, query_list: Union[List[str], str], batch_size=None, is_query=True)
| 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: |
| 129 | query_list = parse_query(self.model_name, query_list, self.instruction, is_query) |
| 130 | pool = self.model.start_multi_process_pool() |
| 131 | query_emb = self.model.encode_multi_process( |
| 132 | query_list, |
| 133 | pool, |
| 134 | convert_to_numpy=True, |
| 135 | normalize_embeddings=True, |
| 136 | batch_size=batch_size, |
| 137 | show_progress_bar=True, |
| 138 | ) |
| 139 | self.model.stop_multi_process_pool(pool) |
| 140 | query_emb = query_emb.astype(np.float32, order="C") |
| 141 | |
| 142 | return query_emb |
| 143 | |
| 144 | |
| 145 | class ClipEncoder: |
nothing calls this directly
no test coverage detected