(batch, pad_token_id)
| 120 | |
| 121 | @staticmethod |
| 122 | def trim_seq2seq_batch(batch, pad_token_id): |
| 123 | y = trim_batch(batch["decoder_input_ids"], pad_token_id) |
| 124 | source_ids, source_mask = trim_batch(batch["input_ids"], pad_token_id, attention_mask=batch["attention_mask"]) |
| 125 | return source_ids, source_mask, y |
| 126 | |
| 127 | def collate_fn(self, batch) -> dict: |
| 128 | input_ids = torch.stack([x["input_ids"] for x in batch]) |
no test coverage detected