MCPcopy Create free account
hub / github.com/Pints-AI/1.5-Pints / create_dataloaders

Function create_dataloaders

pretrain/main.py:741–775  ·  view source on GitHub ↗

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,
)

Source from the content-addressed store, hash-verified

739
740
741def 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)

Callers 1

mainFunction · 0.85

Calls 1

create_dataloaderFunction · 0.85

Tested by

no test coverage detected