Datasets:

Languages:
Thai
ArXiv:
License:

Fix conditional logic in _info and _load_hf_data_from_remote for correct label assignment and data fetching

#1
Files changed (1) hide show
  1. mtop_intent_classification.py +10 -6
mtop_intent_classification.py CHANGED
@@ -50,8 +50,8 @@ _URL = "https://huggingface.co/datasets/mteb/"
50
 
51
 
52
  _SUPPORTED_TASKS = [Tasks.INTENT_CLASSIFICATION]
53
- _SOURCE_VERSION = "1.0.0"
54
- _SEACROWD_VERSION = "2024.06.20"
55
 
56
 
57
  class MTOPIntentClassificationDataset(datasets.GeneratorBasedBuilder):
@@ -95,9 +95,9 @@ class MTOPIntentClassificationDataset(datasets.GeneratorBasedBuilder):
95
  )
96
 
97
  elif self.config.schema == "seacrowd_text":
98
- if self.config.subset_id == "domain":
99
  labels = DOMAIN_LABELS
100
- elif self.config.subset_id == "intent":
101
  labels = INTENT_LABELS
102
  else:
103
  raise ValueError(f"Received unexpected schema name {self.config.name}")
@@ -117,9 +117,13 @@ class MTOPIntentClassificationDataset(datasets.GeneratorBasedBuilder):
117
 
118
  def _load_hf_data_from_remote(self, split: str) -> datasets.DatasetDict:
119
  """Load dataset from HuggingFace."""
120
- if self.config.subset_id not in ("domain", "intent"):
 
 
 
 
121
  raise ValueError(f"Received unexpected schema name {self.config.name}")
122
- HF_REMOTE_REF = "/".join(_URL.split("/")[-2:]) + f"mtop_{self.config.subset_id}"
123
  _hf_dataset_source = datasets.load_dataset(HF_REMOTE_REF, "th", split=split)
124
  return _hf_dataset_source
125
 
 
50
 
51
 
52
  _SUPPORTED_TASKS = [Tasks.INTENT_CLASSIFICATION]
53
+ _SOURCE_VERSION = "1.0.1"
54
+ _SEACROWD_VERSION = "2025.04.22"
55
 
56
 
57
  class MTOPIntentClassificationDataset(datasets.GeneratorBasedBuilder):
 
95
  )
96
 
97
  elif self.config.schema == "seacrowd_text":
98
+ if self.config.subset_id.endswith("domain"):
99
  labels = DOMAIN_LABELS
100
+ elif self.config.subset_id.endswith("intent"):
101
  labels = INTENT_LABELS
102
  else:
103
  raise ValueError(f"Received unexpected schema name {self.config.name}")
 
117
 
118
  def _load_hf_data_from_remote(self, split: str) -> datasets.DatasetDict:
119
  """Load dataset from HuggingFace."""
120
+ if self.config.subset_id.endswith("domain"):
121
+ subset = "domain"
122
+ elif self.config.subset_id.endswith("intent"):
123
+ subset = "intent"
124
+ else:
125
  raise ValueError(f"Received unexpected schema name {self.config.name}")
126
+ HF_REMOTE_REF = f"mteb/mtop_{subset}"
127
  _hf_dataset_source = datasets.load_dataset(HF_REMOTE_REF, "th", split=split)
128
  return _hf_dataset_source
129