(self, min_length: int, eos_token_id: int)
| 425 | """ |
| 426 | |
| 427 | def __init__(self, min_length: int, eos_token_id: int): |
| 428 | if not isinstance(min_length, int) or min_length < 0: |
| 429 | raise ValueError(f"`min_length` has to be a positive integer, but is {min_length}") |
| 430 | |
| 431 | if not isinstance(eos_token_id, int) or eos_token_id < 0: |
| 432 | raise ValueError(f"`eos_token_id` has to be a positive integer, but is {eos_token_id}") |
| 433 | |
| 434 | self.min_length = min_length |
| 435 | self.eos_token_id = eos_token_id |
| 436 | |
| 437 | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor) -> torch.FloatTensor: |
| 438 | cur_len = input_ids.shape[-1] |
nothing calls this directly
no outgoing calls
no test coverage detected