jayliqinzhang commited on
Commit
c55b167
1 Parent(s): 421aac0

Upload mumospee_small.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. mumospee_small.py +15 -16
mumospee_small.py CHANGED
@@ -74,15 +74,16 @@ class MumospeeDataset(datasets.GeneratorBasedBuilder):
74
  and all the elements within the list are accpeted.
75
  """
76
 
77
- if arg and isinstance(arg, str):
78
- adapted_arg = [arg]
 
 
 
 
 
 
79
  else:
80
- adapted_arg = arg
81
-
82
- for aa in adapted_arg:
83
- if aa not in accepted_arg:
84
- raise ValueError(f"Invalid input: '{aa}'. Accepted values are: {', '.join(accepted_arg)}.")
85
-
86
 
87
  return adapted_arg
88
 
@@ -141,18 +142,16 @@ class MumospeeDataset(datasets.GeneratorBasedBuilder):
141
 
142
  data_split = data[data["split"] == split]
143
 
144
-
145
  language_list = self._adapt_args(language, _LANGUAGES)
146
  tag_list = self._adapt_args(tag, _TAGS)
147
 
148
- print(f"input language are : {language_list}")
149
- print(f"input tag are {tag_list}")
150
- if language_list:
151
- data_split = data_split[data_split["language"].isin(language_list)]
152
- if tag_list:
153
- data_split = data_split[data_split["tag"].isin(tag_list)]
154
 
155
-
156
  if data_split.empty:
157
  print(f"No data found for split='{split}', language='{language}', tag='{tag}'. Returning None.")
158
  return # This exits the generator without yielding any examples
 
74
  and all the elements within the list are accpeted.
75
  """
76
 
77
+ if arg:
78
+ if isinstance(arg, str):
79
+ adapted_arg = [arg]
80
+ else:
81
+ adapted_arg = arg
82
+ for aa in adapted_arg:
83
+ if aa not in accepted_arg:
84
+ raise ValueError(f"Invalid input: '{aa}'. Accepted values are: {', '.join(accepted_arg)}.")
85
  else:
86
+ adapted_arg = accepted_arg
 
 
 
 
 
87
 
88
  return adapted_arg
89
 
 
142
 
143
  data_split = data[data["split"] == split]
144
 
145
+
146
  language_list = self._adapt_args(language, _LANGUAGES)
147
  tag_list = self._adapt_args(tag, _TAGS)
148
 
149
+ print(f"Following langauges will be loaded: {language_list}")
150
+ print(f"Following dataset will be loaded: {tag_list}")
151
+
152
+ data_split = data_split[data_split["language"].isin(language_list)]
153
+ data_split = data_split[data_split["tag"].isin(tag_list)]
 
154
 
 
155
  if data_split.empty:
156
  print(f"No data found for split='{split}', language='{language}', tag='{tag}'. Returning None.")
157
  return # This exits the generator without yielding any examples