jayliqinzhang commited on
Commit
0b40ec6
1 Parent(s): 82d4921

Upload mumospee_small.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. mumospee_small.py +8 -8
mumospee_small.py CHANGED
@@ -22,11 +22,12 @@ _SPLITS = ["train", "validation", "test"]
22
 
23
  # BuilderConfig class for your dataset
24
  class MumospeeDatasetConfig(datasets.BuilderConfig):
25
- def __init__(self, split, language=None, tag=None, **kwargs):
26
  super().__init__(**kwargs)
27
  self.split = split
28
  self.language = language
29
  self.tag = tag
 
30
 
31
 
32
  class MumospeeDataset(datasets.GeneratorBasedBuilder):
@@ -39,6 +40,7 @@ class MumospeeDataset(datasets.GeneratorBasedBuilder):
39
  name="default",
40
  version=datasets.Version("1.0.0"),
41
  description=_DESCRIPTION,
 
42
  split=None,
43
  language=None,
44
  tag=None
@@ -101,8 +103,6 @@ class MumospeeDataset(datasets.GeneratorBasedBuilder):
101
 
102
  #===
103
 
104
-
105
-
106
  # If no split is provided, return all splits.
107
  if self.config.split is None:
108
  return [
@@ -134,6 +134,7 @@ class MumospeeDataset(datasets.GeneratorBasedBuilder):
134
 
135
  language = self.config.language
136
  tag = self.config.tag
 
137
 
138
  all_splits=[]
139
  # If split is None, generate examples for all splits
@@ -164,12 +165,11 @@ class MumospeeDataset(datasets.GeneratorBasedBuilder):
164
 
165
 
166
  for i, row in data_split.iterrows():
167
-
168
-
169
- external_url = row["url"]
170
 
171
- # Use dl_manager to download the external file
172
- local_file = dl_manager.download(external_url+"?download=true")
 
 
173
 
174
  yield i, {
175
  "path": row["path"],
 
22
 
23
  # BuilderConfig class for your dataset
24
  class MumospeeDatasetConfig(datasets.BuilderConfig):
25
+ def __init__(self, split, download_audio=None, language=None, tag=None, **kwargs):
26
  super().__init__(**kwargs)
27
  self.split = split
28
  self.language = language
29
  self.tag = tag
30
+ self.download_audio = download_audio
31
 
32
 
33
  class MumospeeDataset(datasets.GeneratorBasedBuilder):
 
40
  name="default",
41
  version=datasets.Version("1.0.0"),
42
  description=_DESCRIPTION,
43
+ download_audio=None,
44
  split=None,
45
  language=None,
46
  tag=None
 
103
 
104
  #===
105
 
 
 
106
  # If no split is provided, return all splits.
107
  if self.config.split is None:
108
  return [
 
134
 
135
  language = self.config.language
136
  tag = self.config.tag
137
+ download_audio = self.config.download_audio
138
 
139
  all_splits=[]
140
  # If split is None, generate examples for all splits
 
165
 
166
 
167
  for i, row in data_split.iterrows():
 
 
 
168
 
169
+ # download the url file
170
+ if download_audio:
171
+ external_url = row["url"]
172
+ dl_manager.download(external_url+"?download=true")
173
 
174
  yield i, {
175
  "path": row["path"],