Datasets:
License:
jayliqinzhang
commited on
Commit
•
c55b167
1
Parent(s):
421aac0
Upload mumospee_small.py with huggingface_hub
Browse files- 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
|
78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
else:
|
80 |
-
adapted_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"
|
149 |
-
print(f"
|
150 |
-
|
151 |
-
|
152 |
-
|
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
|