Skip to content

Commit 5573317

Browse files
committed
fix(ci): mypy narrowing for distilled_scorer (attr-defined + no-any-return)
Co-Authored-By: Arcane Sapience <protoscience@anulum.li>
1 parent a66351c commit 5573317

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/director_ai/core/scoring/distilled_scorer.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ def _load_pytorch(self) -> None:
148148
self._model_path,
149149
revision=DEFAULT_DISTILLED_REVISION,
150150
)
151+
assert self._model is not None
151152
self._model.to(self._device).eval()
152153
self._torch = torch
153154
logger.info("Distilled NLI loaded (PyTorch): %s", self._model_path)
@@ -197,5 +198,6 @@ def score_batch(self, pairs: list[tuple[str, str]]) -> list[float]:
197198

198199
def _softmax(logits: np.ndarray) -> np.ndarray:
199200
"""Numerically stable softmax."""
200-
e = np.exp(logits - np.max(logits))
201-
return e / e.sum()
201+
e: np.ndarray = np.exp(logits - np.max(logits))
202+
result: np.ndarray = e / e.sum()
203+
return result

0 commit comments

Comments
 (0)