Fix conditional logic in _info and _load_hf_data_from_remote for correct label assignment and data fetching
#1
by
HarshalGoyal916
- opened
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.
|
54 |
-
_SEACROWD_VERSION = "
|
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
|
99 |
labels = DOMAIN_LABELS
|
100 |
-
elif self.config.subset_id
|
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
|
|
|
|
|
|
|
|
|
121 |
raise ValueError(f"Received unexpected schema name {self.config.name}")
|
122 |
-
HF_REMOTE_REF = "/
|
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 |
|