holylovenia commited on
Commit
08143b8
1 Parent(s): 94efbe5

Fix loading script

Browse files
Files changed (3) hide show
  1. ascend.py → ASCEND.py +27 -11
  2. ASCEND.py.lock +0 -0
  3. dataset_infos.json +1 -0
ascend.py → ASCEND.py RENAMED
@@ -14,11 +14,11 @@
14
  # limitations under the License.
15
  """ Common Voice Dataset"""
16
 
 
17
 
18
- import os
19
 
20
  import datasets
21
- from datasets.tasks import AutomaticSpeechRecognition
22
  import pandas as pd
23
 
24
 
@@ -39,6 +39,15 @@ ASCEND (A Spontaneous Chinese-English Dataset) introduces a high-quality resourc
39
 
40
  _HOMEPAGE = "https://huggingface.co/datasets/CAiRE/ASCEND"
41
 
 
 
 
 
 
 
 
 
 
42
 
43
  class ASCENDConfig(datasets.BuilderConfig):
44
  """BuilderConfig for ASCEND."""
@@ -75,6 +84,7 @@ class ASCEND(datasets.GeneratorBasedBuilder):
75
  def _info(self):
76
  features = datasets.Features(
77
  {
 
78
  "path": datasets.Value("string"),
79
  "audio": datasets.Audio(sampling_rate=16_000),
80
  "transcription": datasets.Value("string"),
@@ -95,37 +105,43 @@ class ASCEND(datasets.GeneratorBasedBuilder):
95
  )
96
 
97
  def _split_generators(self, dl_manager):
 
 
98
  return [
99
  datasets.SplitGenerator(
100
  name=datasets.Split.TRAIN,
101
  gen_kwargs={
102
- "metadata_path": "train_metadata.csv",
103
- "split": "train",
104
  },
105
  ),
106
  datasets.SplitGenerator(
107
  name=datasets.Split.TEST,
108
  gen_kwargs={
109
- "metadata_path": "test_metadata.csv",
110
- "split": "test"
111
  },
112
  ),
113
  datasets.SplitGenerator(
114
  name=datasets.Split.VALIDATION,
115
  gen_kwargs={
116
- "metadata_path": "validation_metadata.csv",
117
- "split": "validation",
118
  },
119
  ),
120
  ]
121
 
122
  def _generate_examples(self, metadata_path):
 
123
  metadata_df = pd.read_csv(metadata_path)
124
 
125
  for index, row in metadata_df.iterrows():
126
  example = {
127
- "id": index,
128
- "audio": row["audio"],
129
- "transcription": row["transcription"]
 
 
 
 
 
 
130
  }
131
  yield index, example
 
14
  # limitations under the License.
15
  """ Common Voice Dataset"""
16
 
17
+ from datasets import AutomaticSpeechRecognition
18
 
 
19
 
20
  import datasets
21
+ import os
22
  import pandas as pd
23
 
24
 
 
39
 
40
  _HOMEPAGE = "https://huggingface.co/datasets/CAiRE/ASCEND"
41
 
42
+ DEFAULT_CONFIG_NAME = "train"
43
+
44
+ _URL = "https://huggingface.co/datasets/CAiRE/ASCEND/raw/main/"
45
+ _URLS = {
46
+ "train": _URL + "train_metadata.csv",
47
+ "test": _URL + "test_metadata.csv",
48
+ "validation": _URL + "validation_metadata.csv",
49
+ }
50
+
51
 
52
  class ASCENDConfig(datasets.BuilderConfig):
53
  """BuilderConfig for ASCEND."""
 
84
  def _info(self):
85
  features = datasets.Features(
86
  {
87
+ "id": datasets.Value("string"),
88
  "path": datasets.Value("string"),
89
  "audio": datasets.Audio(sampling_rate=16_000),
90
  "transcription": datasets.Value("string"),
 
105
  )
106
 
107
  def _split_generators(self, dl_manager):
108
+ downloaded_files = dl_manager.download_and_extract(_URLS)
109
+
110
  return [
111
  datasets.SplitGenerator(
112
  name=datasets.Split.TRAIN,
113
  gen_kwargs={
114
+ "metadata_path": downloaded_files["train"]
 
115
  },
116
  ),
117
  datasets.SplitGenerator(
118
  name=datasets.Split.TEST,
119
  gen_kwargs={
120
+ "metadata_path": downloaded_files["test"]
 
121
  },
122
  ),
123
  datasets.SplitGenerator(
124
  name=datasets.Split.VALIDATION,
125
  gen_kwargs={
126
+ "metadata_path": downloaded_files["validation"]
 
127
  },
128
  ),
129
  ]
130
 
131
  def _generate_examples(self, metadata_path):
132
+ print(metadata_path)
133
  metadata_df = pd.read_csv(metadata_path)
134
 
135
  for index, row in metadata_df.iterrows():
136
  example = {
137
+ "id": str(index).zfill(5),
138
+ "path": row["file_name"],
139
+ "audio": row["file_name"],
140
+ "transcription": row["transcription"],
141
+ "duration": row["duration"],
142
+ "language": row["language"],
143
+ "original_speaker_id": row["original_speaker_id"],
144
+ "session_id": row["session_id"],
145
+ "topic": row["topic"],
146
  }
147
  yield index, example
ASCEND.py.lock ADDED
File without changes
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"train": {"description": "ASCEND (A Spontaneous Chinese-English Dataset) introduces a high-quality resource of spontaneous multi-turn conversational dialogue Chinese-English code-switching corpus collected in Hong Kong. ASCEND consists of 10.62 hours of spontaneous speech with a total of ~12.3K utterances. The corpus is split into 3 sets: training, validation, and test with a ratio of 8:1:1 while maintaining a balanced gender proportion on each set.\n", "citation": "@inproceedings{lovenia2021ascend,\n title = {ASCEND: A Spontaneous Chinese-English Dataset for Code-switching in Multi-turn Conversation},\n author = {Lovenia, Holy and Cahyawijaya, Samuel and Winata, Genta Indra and Xu, Peng and Yan, Xu and Liu, Zihan and Frieske, Rita and Yu, Tiezheng and Dai, Wenliang and Barezi, Elham J and others},\n booktitle = {Proceedings of the International Conference on Language Resources and Evaluation, {LREC} 2022, 20-25 June 2022, Lu Palais du Pharo, France},\n publisher = {European Language Resources Association},\n year = {2022},\n pages = {}\n}\n", "homepage": "https://huggingface.co/datasets/CAiRE/ASCEND", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "path": {"dtype": "string", "id": null, "_type": "Value"}, "audio": {"sampling_rate": 16000, "mono": true, "decode": true, "id": null, "_type": "Audio"}, "transcription": {"dtype": "string", "id": null, "_type": "Value"}, "duration": {"dtype": "float32", "id": null, "_type": "Value"}, "language": {"dtype": "string", "id": null, "_type": "Value"}, "original_speaker_id": {"dtype": "int64", "id": null, "_type": "Value"}, "session_id": {"dtype": "int64", "id": null, "_type": "Value"}, "topic": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": [{"task": "automatic-speech-recognition", "audio_column": "audio", "transcription_column": "transcription"}], "builder_name": "ascend", "config_name": "train", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1869212, "num_examples": 9869, "dataset_name": "ascend"}, "test": {"name": "test", "num_bytes": 233050, "num_examples": 1315, "dataset_name": "ascend"}, "validation": {"name": "validation", "num_bytes": 209322, "num_examples": 1130, "dataset_name": "ascend"}}, "download_checksums": {"https://huggingface.co/datasets/CAiRE/ASCEND/raw/main/train_metadata.csv": {"num_bytes": 1081181, "checksum": "4cbdf90fe9bf53640bfc285e2539b468a6e412daeb17c36a1b5da478cd9f5b29"}, "https://huggingface.co/datasets/CAiRE/ASCEND/raw/main/test_metadata.csv": {"num_bytes": 127658, "checksum": "15689bc1c1a0bc29b250f63221576392b627da9cc1d80e51bb1a422118b9732c"}, "https://huggingface.co/datasets/CAiRE/ASCEND/raw/main/validation_metadata.csv": {"num_bytes": 118552, "checksum": "6e53e362991b23ffa49ed991c6062a51d8f286747f341e566c897c02bee72459"}}, "download_size": 1327391, "post_processing_size": null, "dataset_size": 2311584, "size_in_bytes": 3638975}, "validation": {"description": "ASCEND (A Spontaneous Chinese-English Dataset) introduces a high-quality resource of spontaneous multi-turn conversational dialogue Chinese-English code-switching corpus collected in Hong Kong. ASCEND consists of 10.62 hours of spontaneous speech with a total of ~12.3K utterances. The corpus is split into 3 sets: training, validation, and test with a ratio of 8:1:1 while maintaining a balanced gender proportion on each set.\n", "citation": "@inproceedings{lovenia2021ascend,\n title = {ASCEND: A Spontaneous Chinese-English Dataset for Code-switching in Multi-turn Conversation},\n author = {Lovenia, Holy and Cahyawijaya, Samuel and Winata, Genta Indra and Xu, Peng and Yan, Xu and Liu, Zihan and Frieske, Rita and Yu, Tiezheng and Dai, Wenliang and Barezi, Elham J and others},\n booktitle = {Proceedings of the International Conference on Language Resources and Evaluation, {LREC} 2022, 20-25 June 2022, Lu Palais du Pharo, France},\n publisher = {European Language Resources Association},\n year = {2022},\n pages = {}\n}\n", "homepage": "https://huggingface.co/datasets/CAiRE/ASCEND", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "path": {"dtype": "string", "id": null, "_type": "Value"}, "audio": {"sampling_rate": 16000, "mono": true, "decode": true, "id": null, "_type": "Audio"}, "transcription": {"dtype": "string", "id": null, "_type": "Value"}, "duration": {"dtype": "float32", "id": null, "_type": "Value"}, "language": {"dtype": "string", "id": null, "_type": "Value"}, "original_speaker_id": {"dtype": "int64", "id": null, "_type": "Value"}, "session_id": {"dtype": "int64", "id": null, "_type": "Value"}, "topic": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": [{"task": "automatic-speech-recognition", "audio_column": "audio", "transcription_column": "transcription"}], "builder_name": "ascend", "config_name": "validation", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1869212, "num_examples": 9869, "dataset_name": "ascend"}, "test": {"name": "test", "num_bytes": 233050, "num_examples": 1315, "dataset_name": "ascend"}, "validation": {"name": "validation", "num_bytes": 209322, "num_examples": 1130, "dataset_name": "ascend"}}, "download_checksums": {"https://huggingface.co/datasets/CAiRE/ASCEND/raw/main/train_metadata.csv": {"num_bytes": 1081181, "checksum": "4cbdf90fe9bf53640bfc285e2539b468a6e412daeb17c36a1b5da478cd9f5b29"}, "https://huggingface.co/datasets/CAiRE/ASCEND/raw/main/test_metadata.csv": {"num_bytes": 127658, "checksum": "15689bc1c1a0bc29b250f63221576392b627da9cc1d80e51bb1a422118b9732c"}, "https://huggingface.co/datasets/CAiRE/ASCEND/raw/main/validation_metadata.csv": {"num_bytes": 118552, "checksum": "6e53e362991b23ffa49ed991c6062a51d8f286747f341e566c897c02bee72459"}}, "download_size": 1327391, "post_processing_size": null, "dataset_size": 2311584, "size_in_bytes": 3638975}, "test": {"description": "ASCEND (A Spontaneous Chinese-English Dataset) introduces a high-quality resource of spontaneous multi-turn conversational dialogue Chinese-English code-switching corpus collected in Hong Kong. ASCEND consists of 10.62 hours of spontaneous speech with a total of ~12.3K utterances. The corpus is split into 3 sets: training, validation, and test with a ratio of 8:1:1 while maintaining a balanced gender proportion on each set.\n", "citation": "@inproceedings{lovenia2021ascend,\n title = {ASCEND: A Spontaneous Chinese-English Dataset for Code-switching in Multi-turn Conversation},\n author = {Lovenia, Holy and Cahyawijaya, Samuel and Winata, Genta Indra and Xu, Peng and Yan, Xu and Liu, Zihan and Frieske, Rita and Yu, Tiezheng and Dai, Wenliang and Barezi, Elham J and others},\n booktitle = {Proceedings of the International Conference on Language Resources and Evaluation, {LREC} 2022, 20-25 June 2022, Lu Palais du Pharo, France},\n publisher = {European Language Resources Association},\n year = {2022},\n pages = {}\n}\n", "homepage": "https://huggingface.co/datasets/CAiRE/ASCEND", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "path": {"dtype": "string", "id": null, "_type": "Value"}, "audio": {"sampling_rate": 16000, "mono": true, "decode": true, "id": null, "_type": "Audio"}, "transcription": {"dtype": "string", "id": null, "_type": "Value"}, "duration": {"dtype": "float32", "id": null, "_type": "Value"}, "language": {"dtype": "string", "id": null, "_type": "Value"}, "original_speaker_id": {"dtype": "int64", "id": null, "_type": "Value"}, "session_id": {"dtype": "int64", "id": null, "_type": "Value"}, "topic": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": [{"task": "automatic-speech-recognition", "audio_column": "audio", "transcription_column": "transcription"}], "builder_name": "ascend", "config_name": "test", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1869212, "num_examples": 9869, "dataset_name": "ascend"}, "test": {"name": "test", "num_bytes": 233050, "num_examples": 1315, "dataset_name": "ascend"}, "validation": {"name": "validation", "num_bytes": 209322, "num_examples": 1130, "dataset_name": "ascend"}}, "download_checksums": {"https://huggingface.co/datasets/CAiRE/ASCEND/raw/main/train_metadata.csv": {"num_bytes": 1081181, "checksum": "4cbdf90fe9bf53640bfc285e2539b468a6e412daeb17c36a1b5da478cd9f5b29"}, "https://huggingface.co/datasets/CAiRE/ASCEND/raw/main/test_metadata.csv": {"num_bytes": 127658, "checksum": "15689bc1c1a0bc29b250f63221576392b627da9cc1d80e51bb1a422118b9732c"}, "https://huggingface.co/datasets/CAiRE/ASCEND/raw/main/validation_metadata.csv": {"num_bytes": 118552, "checksum": "6e53e362991b23ffa49ed991c6062a51d8f286747f341e566c897c02bee72459"}}, "download_size": 1327391, "post_processing_size": null, "dataset_size": 2311584, "size_in_bytes": 3638975}}