    def get_train_dataloader(self) -> DataLoader:
        """
        Get the training dataloader.

        Returns:
            ('Optional[DataLoader]')
                The dataloader to fit data to train the model.
        """
        if self.train_dataloader is not None:
            return self.train_dataloader
        if self.train_dataset is None:
            raise ValueError("Trainer: training requires a train_dataset.")
        if isinstance(self.train_dataset, TorchDataSet):
            self.train_dataset = self.train_dataset.dataset
        num_workers = self._get_num_workers()
        return DataLoader(
            self.train_dataset,
            batch_size=self.configs.train_batch_size,
            shuffle=True,
            num_workers=num_workers,  # self.configs.dataloader_num_workers,
            pin_memory=self.configs.dataloader_pin_memory,
            drop_last=self.configs.dataloader_drop_last
        )
Get the training dataloader.

Returns:
('Optional[DataLoader]')
The dataloader to fit data to train the model.
towhee/trainer/trainer.py