Skip to content

Commit

Permalink
update config_helper.py - fix load_dataset function
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelCahyawijaya committed Sep 7, 2023
1 parent 2af59d5 commit 39363d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion nusacrowd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
from .utils.constants import Tasks
from .config_helper import list_datasets, load_dataset, load_datasets, list_benchmarks, load_benchmark

__version__ = "0.1.0"
__version__ = "0.1.1"
7 changes: 3 additions & 4 deletions nusacrowd/config_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,14 +654,13 @@ def list_datasets(self, with_config=False):

def load_dataset(self, dataset_name, schema='nusantara'):
try:
return [
helper.load_dataset()
for helper in self.filtered(
for helper in sorted(self.filtered(
lambda x: (
(dataset_name == x.dataset_name) and
(x.is_nusantara_schema if schema == 'nusantara' else not x.is_nusantara_schema)
)
)][0]
), key=lambda x: len(x.config.name)):
return helper.load_dataset()
except:
raise ValueError(f"Couldn't find dataset with name=`{dataset_name}` and schema=`{schema}`")

Expand Down

0 comments on commit 39363d0

Please sign in to comment.