From 98abc0e5ac1a1da0fe1802d9ffb623802fbf0b2f Mon Sep 17 00:00:00 2001
From: jmwang66 <wangjiaming.wjm@alibaba-inc.com>
Date: 星期四, 29 六月 2023 16:30:39 +0800
Subject: [PATCH] update setup (#686)
---
funasr/build_utils/build_streaming_iterator.py | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/funasr/build_utils/build_streaming_iterator.py b/funasr/build_utils/build_streaming_iterator.py
index 732fe09..02fc263 100644
--- a/funasr/build_utils/build_streaming_iterator.py
+++ b/funasr/build_utils/build_streaming_iterator.py
@@ -1,6 +1,5 @@
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
@@ -17,20 +16,26 @@
mc: bool = False,
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
# collate
- if task_name in ["punc", "lm"]:
+ if not use_collate_fn:
+ collate_fn = None
+ elif task_name in ["punc", "lm"]:
collate_fn = CommonCollateFn(int_pad_value=0)
else:
collate_fn = CommonCollateFn(float_pad_value=0.0, int_pad_value=-1)
--
Gitblit v1.9.1