Update README.md
Browse files
README.md
CHANGED
@@ -63,21 +63,6 @@ class CustomDataset(torch.utils.data.Dataset):
|
|
63 |
"""
|
64 |
return len(self.dataset)
|
65 |
|
66 |
-
def _cutorpad(self, audio: np.ndarray) -> np.ndarray:
|
67 |
-
"""
|
68 |
-
Cut or pad audio to the wished length
|
69 |
-
"""
|
70 |
-
effective_length = self.sampling_rate * self.max_audio_len
|
71 |
-
len_audio = len(audio)
|
72 |
-
|
73 |
-
# If audio length is bigger than wished audio length
|
74 |
-
if len_audio > effective_length:
|
75 |
-
audio = audio[:effective_length]
|
76 |
-
|
77 |
-
# Expand one dimension related to the channel dimension
|
78 |
-
return audio
|
79 |
-
|
80 |
-
|
81 |
def __getitem__(self, index):
|
82 |
if self.basedir is None:
|
83 |
filepath = self.dataset[index]
|
@@ -177,7 +162,7 @@ def get_gender(model_name_or_path: str, audio_paths: List[str], label2id: Dict,
|
|
177 |
id2label=id2label,
|
178 |
)
|
179 |
|
180 |
-
test_dataset = CustomDataset(audio_paths, max_audio_len=
|
181 |
|
182 |
data_collator = CollateFunc(
|
183 |
processor=feature_extractor,
|
|
|
63 |
"""
|
64 |
return len(self.dataset)
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
def __getitem__(self, index):
|
67 |
if self.basedir is None:
|
68 |
filepath = self.dataset[index]
|
|
|
162 |
id2label=id2label,
|
163 |
)
|
164 |
|
165 |
+
test_dataset = CustomDataset(audio_paths, max_audio_len=5) # for 5-second audio
|
166 |
|
167 |
data_collator = CollateFunc(
|
168 |
processor=feature_extractor,
|