Update sep28k.py
Browse files
sep28k.py
CHANGED
|
@@ -43,12 +43,61 @@ class SEP28K(datasets.GeneratorBasedBuilder):
|
|
| 43 |
"label": datasets.Sequence(datasets.features.ClassLabel(names=CLASSES)),
|
| 44 |
}
|
| 45 |
),
|
| 46 |
-
name="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
description="",
|
| 48 |
),
|
| 49 |
]
|
| 50 |
|
| 51 |
-
DEFAULT_CONFIG_NAME = "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
def _info(self):
|
| 54 |
return datasets.DatasetInfo(
|
|
@@ -78,9 +127,13 @@ class SEP28K(datasets.GeneratorBasedBuilder):
|
|
| 78 |
]
|
| 79 |
|
| 80 |
def _generate_examples(self, data_dir):
|
| 81 |
-
"""Generate examples from
|
| 82 |
-
|
|
|
|
|
|
|
|
|
|
| 83 |
metadata_df = metadata_df[metadata_df['Unsure'] == 0].reset_index(drop=True)
|
|
|
|
| 84 |
|
| 85 |
threshold = 2 # https://arxiv.org/pdf/2102.12394
|
| 86 |
_mapping = {}
|
|
|
|
| 43 |
"label": datasets.Sequence(datasets.features.ClassLabel(names=CLASSES)),
|
| 44 |
}
|
| 45 |
),
|
| 46 |
+
name="sep28k",
|
| 47 |
+
description="",
|
| 48 |
+
),
|
| 49 |
+
SEP28KConfig(
|
| 50 |
+
features=datasets.Features(
|
| 51 |
+
{
|
| 52 |
+
"audio": datasets.Audio(sampling_rate=SAMPLING_RATE),
|
| 53 |
+
# "speaker": datasets.Value("string"),
|
| 54 |
+
# "duration": datasets.Value("int32"),
|
| 55 |
+
"start": datasets.Value("int32"),
|
| 56 |
+
"end": datasets.Value("int32"),
|
| 57 |
+
"stutter": datasets.Sequence(datasets.Value("string")),
|
| 58 |
+
"label": datasets.Sequence(datasets.features.ClassLabel(names=CLASSES)),
|
| 59 |
+
}
|
| 60 |
+
),
|
| 61 |
+
name="fluencybank",
|
| 62 |
description="",
|
| 63 |
),
|
| 64 |
]
|
| 65 |
|
| 66 |
+
DEFAULT_CONFIG_NAME = "sep28k"
|
| 67 |
+
|
| 68 |
+
def __init__(
|
| 69 |
+
self,
|
| 70 |
+
cache_dir = None,
|
| 71 |
+
dataset_name = None,
|
| 72 |
+
config_name = None,
|
| 73 |
+
hash = None,
|
| 74 |
+
base_path = None,
|
| 75 |
+
info = None,
|
| 76 |
+
features = None,
|
| 77 |
+
token = None,
|
| 78 |
+
repo_id = None,
|
| 79 |
+
data_files = None,
|
| 80 |
+
data_dir = None,
|
| 81 |
+
storage_options = None,
|
| 82 |
+
writer_batch_size = None,
|
| 83 |
+
**config_kwargs
|
| 84 |
+
):
|
| 85 |
+
super().__init__(
|
| 86 |
+
cache_dir,
|
| 87 |
+
dataset_name,
|
| 88 |
+
config_name,
|
| 89 |
+
hash,
|
| 90 |
+
base_path,
|
| 91 |
+
info,
|
| 92 |
+
features,
|
| 93 |
+
token,
|
| 94 |
+
repo_id,
|
| 95 |
+
data_files,
|
| 96 |
+
data_dir,
|
| 97 |
+
storage_options,
|
| 98 |
+
writer_batch_size,
|
| 99 |
+
**config_kwargs
|
| 100 |
+
)
|
| 101 |
|
| 102 |
def _info(self):
|
| 103 |
return datasets.DatasetInfo(
|
|
|
|
| 127 |
]
|
| 128 |
|
| 129 |
def _generate_examples(self, data_dir):
|
| 130 |
+
"""Generate examples from SEP-28K"""
|
| 131 |
+
if self.config.name == 'sep28k':
|
| 132 |
+
metadata_df = pd.read_csv(os.path.join(data_dir, 'SEP-28k_labels.csv'))
|
| 133 |
+
elif self.config.name == 'fluencybank':
|
| 134 |
+
metadata_df = pd.read_csv(os.path.join(data_dir, 'fluencybank_labels.csv'))
|
| 135 |
metadata_df = metadata_df[metadata_df['Unsure'] == 0].reset_index(drop=True)
|
| 136 |
+
print(metadata_df)
|
| 137 |
|
| 138 |
threshold = 2 # https://arxiv.org/pdf/2102.12394
|
| 139 |
_mapping = {}
|