| 7 | |
| 8 | |
| 9 | class InvalidScoreLogitsProcessor(LogitsProcessor): |
| 10 | def __call__( |
| 11 | self, input_ids: torch.LongTensor, scores: torch.FloatTensor |
| 12 | ) -> torch.FloatTensor: |
| 13 | if torch.isnan(scores).any() or torch.isinf(scores).any(): |
| 14 | scores.zero_() |
| 15 | scores[..., 5] = 5e4 |
| 16 | return scores |
| 17 | |
| 18 | |
| 19 | def process_response(output: str, use_tool: bool = False) -> Union[str, dict]: |
no outgoing calls
no test coverage detected