(self, output_index: int = 0, *, seq_id: int = 0)
| 1372 | return 1.0 / total >= self.p_min |
| 1373 | |
| 1374 | def _sample_token(self, output_index: int = 0, *, seq_id: int = 0) -> Optional[int]: |
| 1375 | if seq_id < 0 or seq_id >= len(self._samplers): |
| 1376 | return None |
| 1377 | if not self._passes_p_min(output_index): |
| 1378 | return None |
| 1379 | sampler = self._samplers[seq_id] |
| 1380 | token = int(llama_cpp.llama_sampler_sample(sampler, self.ctx, output_index)) |
| 1381 | if token == llama_cpp.LLAMA_TOKEN_NULL: |
| 1382 | return None |
| 1383 | return token |
| 1384 | |
| 1385 | def _reset_sampler(self, seq_id: int) -> None: |
| 1386 | if 0 <= seq_id < len(self._samplers): |
no test coverage detected