This calls `create_dataloader` twice, one for train, another for validation.
(
break_into_chunks: int,
batch_size: int,
block_size: int,
fabric,
data_dir: Path,
seed: int = 12345,
)
| 739 | |
| 740 | |
| 741 | def create_dataloaders( |
| 742 | break_into_chunks: int, |
| 743 | batch_size: int, |
| 744 | block_size: int, |
| 745 | fabric, |
| 746 | data_dir: Path, |
| 747 | seed: int = 12345, |
| 748 | ) -> Tuple[DataLoader, DataLoader]: |
| 749 | """This calls `create_dataloader` twice, one for train, another for validation.""" |
| 750 | |
| 751 | # Increase by one because we need the next word as well |
| 752 | effective_block_size = block_size + 1 |
| 753 | train_dataloader = create_dataloader( |
| 754 | break_into_chunks=break_into_chunks, |
| 755 | batch_size=batch_size, |
| 756 | block_size=effective_block_size, |
| 757 | fabric=fabric, |
| 758 | data_dir=data_dir, |
| 759 | shuffle=True, |
| 760 | seed=seed, |
| 761 | split='train', |
| 762 | ) |
| 763 | |
| 764 | val_dataloader = create_dataloader( |
| 765 | break_into_chunks=break_into_chunks, |
| 766 | batch_size=batch_size, |
| 767 | block_size=effective_block_size, |
| 768 | fabric=fabric, |
| 769 | data_dir=data_dir, |
| 770 | shuffle=False, |
| 771 | seed=seed, |
| 772 | split='validation', |
| 773 | ) |
| 774 | |
| 775 | return train_dataloader, val_dataloader |
| 776 | |
| 777 | |
| 778 | # learning rate decay scheduler (cosine with warmup) |
no test coverage detected