musicaiz.models.transformer_composers.build_torch_loaders¶
- musicaiz.models.transformer_composers.build_torch_loaders(dataset_path: Union[str, pathlib.Path], sequence_length: int, batch_size: int, train_split: float = 0.9, is_splitted: bool = False) Tuple[torch.utils.data.dataloader.DataLoader, torch.utils.data.dataloader.DataLoader] [source]¶
Builds the train a validation dataloaders.
- Parameters
- dataset_path: Path
- sequence_length: int
- batch_size: int
- dest_path: Union[str, Path]
The destination path if save=True.
- train_split: float. Between 0 and 1.
The training…
- save: bool
If we want to save in disk the splitted tokens seqs.
- is_splitted: bool.
Default is False. If the dataset is already splitted in train and validation (and test) sets, and there’s one token-sequences.txt file in each directory, it reads the token sequences and builds the loaders with them and it won’t split the files automatically.
- Returns
- train_dataloader: torch.utils.data.Dataloader
The train loader.
- val_dataloader: torch.utils.data.Dataloader
The validation loader.