| 51 | |
| 52 | |
| 53 | class InvalidScoreLogitsProcessor(LogitsProcessor): |
| 54 | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor) -> torch.FloatTensor: |
| 55 | if torch.isnan(scores).any() or torch.isinf(scores).any(): |
| 56 | scores.zero_() |
| 57 | scores[..., 5] = 5e4 |
| 58 | return scores |
| 59 | |
| 60 | |
| 61 | class PrefixEncoder(torch.nn.Module): |
no outgoing calls
no test coverage detected