Datasets:

Multilinguality:
multilingual
Size Categories:
100K<n<1M
Annotations Creators:
expert-generated
ArXiv:
License:
system HF staff commited on
Commit
4ed64d8
1 Parent(s): 2ad9180

Update files from the datasets library (from 1.16.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.16.0

Files changed (2) hide show
  1. covost2.py +10 -15
  2. dummy/en_de/1.0.0/dummy_data.zip +2 -2
covost2.py CHANGED
@@ -87,10 +87,7 @@ class Covost2(datasets.GeneratorBasedBuilder):
87
 
88
  @property
89
  def manual_download_instructions(self):
90
- return """\
91
- You should download the Common Voice v4 dataset from https://commonvoice.mozilla.org/en/datasets.
92
- and unpack it to a path `{COVOST_ROOT}/{SOURCE_LANG_ID}` and then pass the `{COVOST_ROOT}` path as `data_dir`
93
- via `datasets.load_dataset('covost2', data_dir="path/to/covost_root")`
94
  """
95
 
96
  def _info(self):
@@ -111,29 +108,27 @@ class Covost2(datasets.GeneratorBasedBuilder):
111
 
112
  def _split_generators(self, dl_manager):
113
  data_root = os.path.abspath(os.path.expanduser(dl_manager.manual_dir))
 
114
  source_lang, target_lang = self.config.name.split("_")
115
- source_path = os.path.join(data_root, source_lang)
116
 
117
- if not os.path.exists(source_path):
118
  raise FileNotFoundError(
119
- "{} does not exist. Make sure you insert a manual dir via "
120
- "`datasets.load_dataset('covost2', data_dir=...)` that includes files uncompressed files from the "
121
- "COVOST2 archive. Manual download instructions: {}".format(
122
- data_root, self.manual_download_instructions
123
- )
124
  )
125
 
126
  covost_url = COVOST_URL_TEMPLATE.format(src_lang=source_lang, tgt_lang=target_lang)
127
  extracted_path = dl_manager.download_and_extract(covost_url)
128
 
129
  covost_tsv_path = os.path.join(extracted_path, f"covost_v2.{source_lang}_{target_lang}.tsv")
130
- cv_tsv_path = os.path.join(source_path, "validated.tsv")
131
 
132
  return [
133
  datasets.SplitGenerator(
134
  name=datasets.Split.TRAIN,
135
  gen_kwargs={
136
- "source_path": source_path,
137
  "covost_tsv_path": covost_tsv_path,
138
  "cv_tsv_path": cv_tsv_path,
139
  "split": "train",
@@ -142,7 +137,7 @@ class Covost2(datasets.GeneratorBasedBuilder):
142
  datasets.SplitGenerator(
143
  name=datasets.Split.VALIDATION,
144
  gen_kwargs={
145
- "source_path": source_path,
146
  "covost_tsv_path": covost_tsv_path,
147
  "cv_tsv_path": cv_tsv_path,
148
  "split": "dev",
@@ -151,7 +146,7 @@ class Covost2(datasets.GeneratorBasedBuilder):
151
  datasets.SplitGenerator(
152
  name=datasets.Split.TEST,
153
  gen_kwargs={
154
- "source_path": source_path,
155
  "covost_tsv_path": covost_tsv_path,
156
  "cv_tsv_path": cv_tsv_path,
157
  "split": "test",
 
87
 
88
  @property
89
  def manual_download_instructions(self):
90
+ return f"""Please download the Common Voice Corpus 4 in {self.config.name.split('_')[0]} from https://commonvoice.mozilla.org/en/datasets and unpack it with `tar xvzf {self.config.name.split('_')[0]}.tar`. Make sure to pass the path to the directory in which you unpacked the downloaded file as `data_dir`: `datasets.load_dataset('covost2', data_dir="path/to/dir")`
 
 
 
91
  """
92
 
93
  def _info(self):
 
108
 
109
  def _split_generators(self, dl_manager):
110
  data_root = os.path.abspath(os.path.expanduser(dl_manager.manual_dir))
111
+
112
  source_lang, target_lang = self.config.name.split("_")
 
113
 
114
+ if not os.path.exists(data_root):
115
  raise FileNotFoundError(
116
+ f"You are trying to load the {self.config.name} speech translation dataset. "
117
+ f"It is required that you manually download the input speech data {source_lang}. "
118
+ f"Manual download instructions: {self.manual_download_instructions}"
 
 
119
  )
120
 
121
  covost_url = COVOST_URL_TEMPLATE.format(src_lang=source_lang, tgt_lang=target_lang)
122
  extracted_path = dl_manager.download_and_extract(covost_url)
123
 
124
  covost_tsv_path = os.path.join(extracted_path, f"covost_v2.{source_lang}_{target_lang}.tsv")
125
+ cv_tsv_path = os.path.join(data_root, "validated.tsv")
126
 
127
  return [
128
  datasets.SplitGenerator(
129
  name=datasets.Split.TRAIN,
130
  gen_kwargs={
131
+ "source_path": data_root,
132
  "covost_tsv_path": covost_tsv_path,
133
  "cv_tsv_path": cv_tsv_path,
134
  "split": "train",
 
137
  datasets.SplitGenerator(
138
  name=datasets.Split.VALIDATION,
139
  gen_kwargs={
140
+ "source_path": data_root,
141
  "covost_tsv_path": covost_tsv_path,
142
  "cv_tsv_path": cv_tsv_path,
143
  "split": "dev",
 
146
  datasets.SplitGenerator(
147
  name=datasets.Split.TEST,
148
  gen_kwargs={
149
+ "source_path": data_root,
150
  "covost_tsv_path": covost_tsv_path,
151
  "cv_tsv_path": cv_tsv_path,
152
  "split": "test",
dummy/en_de/1.0.0/dummy_data.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:663b332443195cec14657b0c654c8efcc7d6f5171fca9e7a459d58a3e6cfd739
3
- size 1784
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:300f32538934c2596b9468ceb03762fcb2b7da933479c880b15b65e14d85b603
3
+ size 1772