|
7 | 7 |
|
8 | 8 | import copy |
9 | 9 | import json |
10 | | -from itertools import starmap |
11 | 10 | from pathlib import Path |
12 | 11 | from typing import TYPE_CHECKING |
13 | 12 |
|
@@ -251,21 +250,21 @@ def get_multilabel_predictions(self, logits: np.ndarray) -> list[Label]: |
251 | 250 | labels_list = self.params.labels |
252 | 251 | labels = [labels_list[i] if labels_list else "" for i in indices] |
253 | 252 |
|
254 | | - return list(starmap(Label, zip(indices, labels, scores))) |
| 253 | + return list(map(Label, indices, labels, scores)) |
255 | 254 |
|
256 | 255 | def get_multiclass_predictions(self, outputs: dict) -> list[Label]: |
257 | 256 | axis = 1 |
258 | 257 | logits = outputs[self.out_layer_names[0]] |
259 | 258 | if not is_softmaxed(logits, axis=axis): |
260 | 259 | logits = softmax(logits, axis=axis) |
261 | 260 | top_k_result = top_k(logits, self.params.topk, axis=axis) |
262 | | - scores = top_k_result.values[0] # noqa: PD011 # silencing false positive - it's not pandas code |
| 261 | + scores = top_k_result.values[0] |
263 | 262 | indices = top_k_result.indices[0] |
264 | 263 |
|
265 | 264 | labels_list = self.params.labels |
266 | 265 | labels = [labels_list[i] if labels_list else "" for i in indices] |
267 | 266 |
|
268 | | - return list(starmap(Label, zip(indices, labels, scores))) |
| 267 | + return list(map(Label, indices, labels, scores)) |
269 | 268 |
|
270 | 269 |
|
271 | 270 | def sigmoid_numpy(x: np.ndarray) -> np.ndarray: |
|
0 commit comments