SWivid commited on
Commit
2c09243
·
1 Parent(s): 5600d90

add sanity check ensuring mono audio input for training

Browse files
Files changed (1) hide show
  1. model/dataset.py +2 -0
model/dataset.py CHANGED
@@ -103,6 +103,8 @@ class CustomDataset(Dataset):
103
 
104
  else:
105
  audio, source_sample_rate = torchaudio.load(audio_path)
 
 
106
 
107
  if duration > 30 or duration < 0.3:
108
  return self.__getitem__((index + 1) % len(self.data))
 
103
 
104
  else:
105
  audio, source_sample_rate = torchaudio.load(audio_path)
106
+ if audio.shape[0] > 1:
107
+ audio = torch.mean(audio, dim=0, keepdim=True)
108
 
109
  if duration > 30 or duration < 0.3:
110
  return self.__getitem__((index + 1) % len(self.data))