speech_asr
2023-04-17 0bae33f99be41b1a7cf9353298efea53ffb375f7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import torch
from funasr.datasets.small_datasets.dataset import ESPnetDataset
from funasr.datasets.small_datasets.build_preprocess import build_preprocess
 
def build_dataloader(args):
    if args.frontend_conf is not None:
        dest_sample_rate = args.frontend_conf["fs"] if (args.frontend_conf is not None and "fs" in args.frontend_conf) else 16000
    preprocess_fn = build_preprocess()
    dataset = ESPnetDataset(
        iter_options.data_path_and_name_and_type,
        float_dtype=args.train_dtype,
        preprocess=preprocess_fn,
        max_cache_size=iter_options.max_cache_size,
        max_cache_fd=iter_options.max_cache_fd,
        dest_sample_rate=dest_sample_rate,
    )