| | |
| | | import numpy as np |
| | | from torch.utils.data import DataLoader |
| | | from typeguard import check_argument_types |
| | | |
| | | from funasr.datasets.iterable_dataset import IterableESPnetDataset |
| | | from funasr.datasets.small_datasets.collate_fn import CommonCollateFn |
| | |
| | | dtype: str = np.float32, |
| | | num_workers: int = 1, |
| | | use_collate_fn: bool = True, |
| | | preprocess_fn=None, |
| | | ngpu: int = 0, |
| | | train: bool=False, |
| | | train: bool = False, |
| | | ) -> DataLoader: |
| | | """Build DataLoader using iterable dataset""" |
| | | assert check_argument_types() |
| | | |
| | | # preprocess |
| | | if preprocess_args is not None: |
| | | if preprocess_fn is not None: |
| | | preprocess_fn = preprocess_fn |
| | | elif preprocess_args is not None: |
| | | preprocess_args.task_name = task_name |
| | | preprocess_fn = build_preprocess(preprocess_args, train) |
| | | else: |
| | | preprocess_fn = None |