update
Browse files- the-vault.py +14 -14
the-vault.py
CHANGED
@@ -34,11 +34,17 @@ for lang in _LANG_TO_EXTENSION:
|
|
34 |
|
35 |
|
36 |
_LANG_CONFIGS = ["all"] + list(_LANG_TO_EXTENSION.keys())
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
class TheVaultConfig(datasets.BuilderConfig):
|
39 |
"""BuilderConfig for The Vault dataset."""
|
40 |
|
41 |
-
def __init__(self, *args, languages=["all"],
|
42 |
"""BuilderConfig for the GitHub Code dataset.
|
43 |
Args:
|
44 |
languages (:obj:`List[str]`): List of languages to load.
|
@@ -46,15 +52,15 @@ class TheVaultConfig(datasets.BuilderConfig):
|
|
46 |
"""
|
47 |
super().__init__(
|
48 |
*args,
|
49 |
-
name=
|
50 |
**kwargs,
|
51 |
)
|
52 |
|
53 |
languages = set(languages)
|
54 |
|
55 |
assert all([language in _LANG_CONFIGS for language in languages]), f"Language not in {_LANG_CONFIGS}."
|
56 |
-
if
|
57 |
-
assert
|
58 |
|
59 |
if "all" in languages:
|
60 |
assert len(languages)==1, f"Passed 'all' together with other languages. {languages}"
|
@@ -63,14 +69,8 @@ class TheVaultConfig(datasets.BuilderConfig):
|
|
63 |
self.filter_languages = True
|
64 |
|
65 |
self.languages = set(languages)
|
66 |
-
self.
|
67 |
-
|
68 |
|
69 |
-
num_shard_split = {
|
70 |
-
'small': 2,
|
71 |
-
'medium': 4
|
72 |
-
}
|
73 |
-
splits = ["all"] + list(num_shard_split.keys())
|
74 |
|
75 |
class TheVault(datasets.GeneratorBasedBuilder):
|
76 |
"""The Vault dataset."""
|
@@ -106,8 +106,8 @@ class TheVault(datasets.GeneratorBasedBuilder):
|
|
106 |
)
|
107 |
|
108 |
def _split_generators(self, dl_manager):
|
109 |
-
print(self.config.
|
110 |
-
if self.config.
|
111 |
generators = []
|
112 |
for split in num_shard_split:
|
113 |
num_shards = num_shard_split[split]
|
|
|
34 |
|
35 |
|
36 |
_LANG_CONFIGS = ["all"] + list(_LANG_TO_EXTENSION.keys())
|
37 |
+
|
38 |
+
num_shard_split = {
|
39 |
+
'train/small': 2,
|
40 |
+
'train/medium': 4
|
41 |
+
}
|
42 |
+
splits = ["all"] + list(num_shard_split.keys())
|
43 |
+
|
44 |
class TheVaultConfig(datasets.BuilderConfig):
|
45 |
"""BuilderConfig for The Vault dataset."""
|
46 |
|
47 |
+
def __init__(self, *args, languages=["all"], split_set= "all", **kwargs):
|
48 |
"""BuilderConfig for the GitHub Code dataset.
|
49 |
Args:
|
50 |
languages (:obj:`List[str]`): List of languages to load.
|
|
|
52 |
"""
|
53 |
super().__init__(
|
54 |
*args,
|
55 |
+
name= split_set.replace("/", "_") + "_" + "+".join(languages),
|
56 |
**kwargs,
|
57 |
)
|
58 |
|
59 |
languages = set(languages)
|
60 |
|
61 |
assert all([language in _LANG_CONFIGS for language in languages]), f"Language not in {_LANG_CONFIGS}."
|
62 |
+
if split_set != "all":
|
63 |
+
assert split_set in num_shard_split, "split_set {} not in {}.".format(split_set, list(num_shard_split.keys()))
|
64 |
|
65 |
if "all" in languages:
|
66 |
assert len(languages)==1, f"Passed 'all' together with other languages. {languages}"
|
|
|
69 |
self.filter_languages = True
|
70 |
|
71 |
self.languages = set(languages)
|
72 |
+
self.split_set= split_set
|
|
|
73 |
|
|
|
|
|
|
|
|
|
|
|
74 |
|
75 |
class TheVault(datasets.GeneratorBasedBuilder):
|
76 |
"""The Vault dataset."""
|
|
|
106 |
)
|
107 |
|
108 |
def _split_generators(self, dl_manager):
|
109 |
+
print(self.config.split_set)
|
110 |
+
if self.config.split_set == "all":
|
111 |
generators = []
|
112 |
for split in num_shard_split:
|
113 |
num_shards = num_shard_split[split]
|