Datasets:
Commit ·
4f61c9c
1
Parent(s): 7a2647a
Fixed Bug in loading script
Browse files- lextreme.py +7 -5
lextreme.py
CHANGED
|
@@ -68,7 +68,7 @@ class LextremeConfig(datasets.BuilderConfig):
|
|
| 68 |
hf_hub_name: `string`, huggingface dataset identifier
|
| 69 |
hf_hub_name: `string`, the language of the dataset (either multilingual or a single language ISO code)
|
| 70 |
config_name: `string`, huggingface dataset config name
|
| 71 |
-
label_level: `string`, the label level (only necessary for
|
| 72 |
label_classes: `list[string]`, the list of classes if the label is
|
| 73 |
categorical. If not provided, then the label will be of type
|
| 74 |
`datasets.Value('float32')`.
|
|
@@ -4070,10 +4070,12 @@ class LEXTREME(datasets.GeneratorBasedBuilder):
|
|
| 4070 |
def _generate_examples(self, split):
|
| 4071 |
"""This function returns the examples in the raw (text) form."""
|
| 4072 |
# we can just do this, since all our datasets are available on the huggingface hub
|
| 4073 |
-
|
| 4074 |
-
|
| 4075 |
-
|
| 4076 |
-
|
|
|
|
|
|
|
| 4077 |
for id, item in enumerate(dataset):
|
| 4078 |
# In case we have a class label and not just a string: convert it back to the string
|
| 4079 |
label_col = self.config.label_col
|
|
|
|
| 68 |
hf_hub_name: `string`, huggingface dataset identifier
|
| 69 |
hf_hub_name: `string`, the language of the dataset (either multilingual or a single language ISO code)
|
| 70 |
config_name: `string`, huggingface dataset config name
|
| 71 |
+
label_level: `string`, the label level (only necessary for multi_eurlex)
|
| 72 |
label_classes: `list[string]`, the list of classes if the label is
|
| 73 |
categorical. If not provided, then the label will be of type
|
| 74 |
`datasets.Value('float32')`.
|
|
|
|
| 4070 |
def _generate_examples(self, split):
|
| 4071 |
"""This function returns the examples in the raw (text) form."""
|
| 4072 |
# we can just do this, since all our datasets are available on the huggingface hub
|
| 4073 |
+
if "multi_eurlex" in self.config.config_name:
|
| 4074 |
+
dataset = datasets.load_dataset(self.config.hf_hub_name, self.config.config_name, split=split,
|
| 4075 |
+
label_level=self.config.label_level)
|
| 4076 |
+
else:
|
| 4077 |
+
dataset = datasets.load_dataset(self.config.hf_hub_name, self.config.config_name, split=split)
|
| 4078 |
+
|
| 4079 |
for id, item in enumerate(dataset):
|
| 4080 |
# In case we have a class label and not just a string: convert it back to the string
|
| 4081 |
label_col = self.config.label_col
|