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