| 309 | |
| 310 | |
| 311 | class InvalidScoreLogitsProcessor(LogitsProcessor): |
| 312 | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor) -> torch.FloatTensor: |
| 313 | if torch.isnan(scores).any() or torch.isinf(scores).any(): |
| 314 | scores.zero_() |
| 315 | scores[..., 5] = 5e4 |
| 316 | return scores |
| 317 | |
| 318 | |
| 319 | class PrefixEncoder(torch.nn.Module): |
no outgoing calls
no test coverage detected