feat
Browse files- VieGLUE.py +4 -9
VieGLUE.py
CHANGED
@@ -490,8 +490,8 @@ predictions for this dataset."""
|
|
490 |
_VERSION = datasets.Version("1.2.0", "")
|
491 |
|
492 |
|
493 |
-
class
|
494 |
-
"""BuilderConfig for
|
495 |
|
496 |
def __init__(
|
497 |
self,
|
@@ -523,7 +523,7 @@ class VieGLUEConfig(datasets.BuilderConfig):
|
|
523 |
of the label and processing it to the form required by the label feature
|
524 |
**kwargs: keyword arguments forwarded to super.
|
525 |
"""
|
526 |
-
super(
|
527 |
version=datasets.Version("1.0.0", ""), **kwargs
|
528 |
)
|
529 |
self.text_features = text_features
|
@@ -542,7 +542,7 @@ class VNExpress(datasets.GeneratorBasedBuilder):
|
|
542 |
VERSION = _VERSION
|
543 |
DEFAULT_CONFIG_NAME = "mnli"
|
544 |
|
545 |
-
BUILDER_CONFIGS = [
|
546 |
|
547 |
def _info(self):
|
548 |
features = {f: datasets.Value("string") for f in self.config.text_features}
|
@@ -599,13 +599,10 @@ class VNExpress(datasets.GeneratorBasedBuilder):
|
|
599 |
def _generate_examples(self, files, urls, stage, config):
|
600 |
id_ = 0
|
601 |
features = config.text_features
|
602 |
-
# print(config)
|
603 |
-
# print(features)
|
604 |
|
605 |
if not isinstance(files, list):
|
606 |
files = [files]
|
607 |
for path, url in zip(files, urls):
|
608 |
-
# print(f"Loading file from {url}...")
|
609 |
for file in os.listdir(path):
|
610 |
if file.startswith("._"):
|
611 |
continue
|
@@ -614,8 +611,6 @@ class VNExpress(datasets.GeneratorBasedBuilder):
|
|
614 |
continue
|
615 |
with open(file_path) as f:
|
616 |
all_samples = json.load(f)
|
617 |
-
# print(f"Loaded {len(all_samples)} samples from {file_path}")
|
618 |
-
# print(f"Sample: {all_samples[0]}")
|
619 |
for sample in all_samples:
|
620 |
if sample["label"] is None or sample["label"] == "":
|
621 |
sample["label"] = -1
|
|
|
490 |
_VERSION = datasets.Version("1.2.0", "")
|
491 |
|
492 |
|
493 |
+
class ViGLUEConfig(datasets.BuilderConfig):
|
494 |
+
"""BuilderConfig for ViGLUE."""
|
495 |
|
496 |
def __init__(
|
497 |
self,
|
|
|
523 |
of the label and processing it to the form required by the label feature
|
524 |
**kwargs: keyword arguments forwarded to super.
|
525 |
"""
|
526 |
+
super(ViGLUEConfig, self).__init__(
|
527 |
version=datasets.Version("1.0.0", ""), **kwargs
|
528 |
)
|
529 |
self.text_features = text_features
|
|
|
542 |
VERSION = _VERSION
|
543 |
DEFAULT_CONFIG_NAME = "mnli"
|
544 |
|
545 |
+
BUILDER_CONFIGS = [ViGLUEConfig(**config) for config in SUBSET_KWARGS.values()]
|
546 |
|
547 |
def _info(self):
|
548 |
features = {f: datasets.Value("string") for f in self.config.text_features}
|
|
|
599 |
def _generate_examples(self, files, urls, stage, config):
|
600 |
id_ = 0
|
601 |
features = config.text_features
|
|
|
|
|
602 |
|
603 |
if not isinstance(files, list):
|
604 |
files = [files]
|
605 |
for path, url in zip(files, urls):
|
|
|
606 |
for file in os.listdir(path):
|
607 |
if file.startswith("._"):
|
608 |
continue
|
|
|
611 |
continue
|
612 |
with open(file_path) as f:
|
613 |
all_samples = json.load(f)
|
|
|
|
|
614 |
for sample in all_samples:
|
615 |
if sample["label"] is None or sample["label"] == "":
|
616 |
sample["label"] = -1
|