test
Browse files- the-vault-function.py +13 -5
the-vault-function.py
CHANGED
@@ -2,7 +2,6 @@ import os
|
|
2 |
|
3 |
import pyarrow as pa
|
4 |
import pyarrow.parquet as pq
|
5 |
-
|
6 |
import datasets
|
7 |
|
8 |
_REPO_NAME = 'Fsoft-AIC/the-vault'
|
@@ -49,6 +48,7 @@ class TheVaultFunctionConfig(datasets.BuilderConfig):
|
|
49 |
def __init__(self, *args, languages=["all"], split_set= ["all"], **kwargs):
|
50 |
"""BuilderConfig for the GitHub Code dataset.
|
51 |
Args:
|
|
|
52 |
languages (:obj:`List[str]`): List of languages to load.
|
53 |
**kwargs: keyword arguments forwarded to super.
|
54 |
"""
|
@@ -62,10 +62,14 @@ class TheVaultFunctionConfig(datasets.BuilderConfig):
|
|
62 |
split_set = set([split.lower() for split in split_set])
|
63 |
|
64 |
assert all([language in _LANG_CONFIGS for language in languages]), f"languages {languages} contains language not in {_LANG_CONFIGS}."
|
65 |
-
assert all([split in _SPLIT_CONFIGS for split in split_set]), "split_set {} contains element not in {}."
|
66 |
|
67 |
if "all" in split_set:
|
68 |
assert len(split_set)==1, f"Passed 'all' together with other split sets. {split_set}"
|
|
|
|
|
|
|
|
|
69 |
|
70 |
if "all" in languages:
|
71 |
assert len(languages)==1, f"Passed 'all' together with other languages. {languages}"
|
@@ -115,15 +119,19 @@ class TheVaultFunction(datasets.GeneratorBasedBuilder):
|
|
115 |
print(self.config.split_set)
|
116 |
|
117 |
generators = []
|
118 |
-
split_set = self.config.split_set
|
119 |
-
languages = self.config.languages
|
|
|
120 |
if "all" in split_set:
|
121 |
split_set = _SPLIT_CONFIGS[1:]
|
|
|
|
|
|
|
|
|
122 |
|
123 |
if "all" in languages:
|
124 |
languages = _LANG_CONFIGS[1:]
|
125 |
|
126 |
-
print(languages)
|
127 |
for split in split_set:
|
128 |
for language in languages:
|
129 |
num_shards = num_shard_split[f"{split}/{language}"]
|
|
|
2 |
|
3 |
import pyarrow as pa
|
4 |
import pyarrow.parquet as pq
|
|
|
5 |
import datasets
|
6 |
|
7 |
_REPO_NAME = 'Fsoft-AIC/the-vault'
|
|
|
48 |
def __init__(self, *args, languages=["all"], split_set= ["all"], **kwargs):
|
49 |
"""BuilderConfig for the GitHub Code dataset.
|
50 |
Args:
|
51 |
+
split_set (:obj:`List[str]`): List of split set to load.
|
52 |
languages (:obj:`List[str]`): List of languages to load.
|
53 |
**kwargs: keyword arguments forwarded to super.
|
54 |
"""
|
|
|
62 |
split_set = set([split.lower() for split in split_set])
|
63 |
|
64 |
assert all([language in _LANG_CONFIGS for language in languages]), f"languages {languages} contains language not in {_LANG_CONFIGS}."
|
65 |
+
assert all([split in _SPLIT_CONFIGS for split in split_set]), f"split_set {split_set} contains element not in {_SPLIT_CONFIGS}."
|
66 |
|
67 |
if "all" in split_set:
|
68 |
assert len(split_set)==1, f"Passed 'all' together with other split sets. {split_set}"
|
69 |
+
elif "train" in split_set:
|
70 |
+
for split in split_set:
|
71 |
+
if "train" in split and split != "train":
|
72 |
+
raise f"Split set 'train' already contains '{split}'. Please only include one."
|
73 |
|
74 |
if "all" in languages:
|
75 |
assert len(languages)==1, f"Passed 'all' together with other languages. {languages}"
|
|
|
119 |
print(self.config.split_set)
|
120 |
|
121 |
generators = []
|
122 |
+
split_set = list(self.config.split_set)
|
123 |
+
languages = list(self.config.languages)
|
124 |
+
print(languages)
|
125 |
if "all" in split_set:
|
126 |
split_set = _SPLIT_CONFIGS[1:]
|
127 |
+
|
128 |
+
if "train" in split_set:
|
129 |
+
split_set.remove('train')
|
130 |
+
split_set.extend(["train/small", "train/medium"])
|
131 |
|
132 |
if "all" in languages:
|
133 |
languages = _LANG_CONFIGS[1:]
|
134 |
|
|
|
135 |
for split in split_set:
|
136 |
for language in languages:
|
137 |
num_shards = num_shard_split[f"{split}/{language}"]
|