Spaces:
Configuration error
Configuration error
add sanity check ensuring mono audio input for training
Browse files- 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))
|