Merge pull request #211 from alibaba-damo-academy/dev_lhn

Update iterable_dataset.py
This commit is contained in:
hnluo 2023-03-10 20:12:37 +08:00 committed by GitHub
commit 2932379d99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -244,10 +244,14 @@ class IterableESPnetDataset(IterableDataset):
array = torchaudio.transforms.Resample(orig_freq=audio_fs,
new_freq=model_fs)(array)
array = array.numpy()
if self.mc:
data[name] = array.transpose(0, 1)
if _type == "sound":
if self.mc:
data[name] = array.transpose(0, 1)
else:
data[name] = array[0]
else:
data[name] = array[0]
data[name] = array
if self.preprocess is not None:
data = self.preprocess(uid, data)