Update scripts to use data.zip instead of local data.
Browse files- CLISTER.py +13 -11
- data.zip +2 -2
CLISTER.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
import os
|
| 2 |
import json
|
| 3 |
import random
|
| 4 |
|
|
@@ -44,6 +43,9 @@ _HOMEPAGE = "https://gitlab.inria.fr/codeine/clister"
|
|
| 44 |
|
| 45 |
_LICENSE = "unknown"
|
| 46 |
|
|
|
|
|
|
|
|
|
|
| 47 |
class CLISTER(datasets.GeneratorBasedBuilder):
|
| 48 |
|
| 49 |
DEFAULT_CONFIG_NAME = "source"
|
|
@@ -76,8 +78,8 @@ class CLISTER(datasets.GeneratorBasedBuilder):
|
|
| 76 |
|
| 77 |
def _split_generators(self, dl_manager):
|
| 78 |
|
| 79 |
-
data_dir =
|
| 80 |
-
|
| 81 |
return [
|
| 82 |
datasets.SplitGenerator(
|
| 83 |
name=datasets.Split.TRAIN,
|
|
@@ -110,7 +112,7 @@ class CLISTER(datasets.GeneratorBasedBuilder):
|
|
| 110 |
all_res = []
|
| 111 |
|
| 112 |
key = 0
|
| 113 |
-
|
| 114 |
# Load JSON file
|
| 115 |
f_json = open(json_file)
|
| 116 |
data_map = json.load(f_json)
|
|
@@ -133,25 +135,25 @@ class CLISTER(datasets.GeneratorBasedBuilder):
|
|
| 133 |
key += 1
|
| 134 |
|
| 135 |
if split != "test":
|
| 136 |
-
|
| 137 |
ids = [r["id"] for r in all_res]
|
| 138 |
-
|
| 139 |
random.seed(4)
|
| 140 |
random.shuffle(ids)
|
| 141 |
random.shuffle(ids)
|
| 142 |
random.shuffle(ids)
|
| 143 |
-
|
| 144 |
train, validation = np.split(ids, [int(len(ids)*0.8333)])
|
| 145 |
-
|
| 146 |
if split == "train":
|
| 147 |
allowed_ids = list(train)
|
| 148 |
elif split == "validation":
|
| 149 |
allowed_ids = list(validation)
|
| 150 |
-
|
| 151 |
for r in all_res:
|
| 152 |
if r["id"] in allowed_ids:
|
| 153 |
yield r["id"], r
|
| 154 |
else:
|
| 155 |
-
|
| 156 |
for r in all_res:
|
| 157 |
-
yield r["id"], r
|
|
|
|
|
|
|
| 1 |
import json
|
| 2 |
import random
|
| 3 |
|
|
|
|
| 43 |
|
| 44 |
_LICENSE = "unknown"
|
| 45 |
|
| 46 |
+
_URL = "data.zip"
|
| 47 |
+
|
| 48 |
+
|
| 49 |
class CLISTER(datasets.GeneratorBasedBuilder):
|
| 50 |
|
| 51 |
DEFAULT_CONFIG_NAME = "source"
|
|
|
|
| 78 |
|
| 79 |
def _split_generators(self, dl_manager):
|
| 80 |
|
| 81 |
+
data_dir = dl_manager.download_and_extract(_URL).rstrip("/")
|
| 82 |
+
|
| 83 |
return [
|
| 84 |
datasets.SplitGenerator(
|
| 85 |
name=datasets.Split.TRAIN,
|
|
|
|
| 112 |
all_res = []
|
| 113 |
|
| 114 |
key = 0
|
| 115 |
+
|
| 116 |
# Load JSON file
|
| 117 |
f_json = open(json_file)
|
| 118 |
data_map = json.load(f_json)
|
|
|
|
| 135 |
key += 1
|
| 136 |
|
| 137 |
if split != "test":
|
| 138 |
+
|
| 139 |
ids = [r["id"] for r in all_res]
|
| 140 |
+
|
| 141 |
random.seed(4)
|
| 142 |
random.shuffle(ids)
|
| 143 |
random.shuffle(ids)
|
| 144 |
random.shuffle(ids)
|
| 145 |
+
|
| 146 |
train, validation = np.split(ids, [int(len(ids)*0.8333)])
|
| 147 |
+
|
| 148 |
if split == "train":
|
| 149 |
allowed_ids = list(train)
|
| 150 |
elif split == "validation":
|
| 151 |
allowed_ids = list(validation)
|
| 152 |
+
|
| 153 |
for r in all_res:
|
| 154 |
if r["id"] in allowed_ids:
|
| 155 |
yield r["id"], r
|
| 156 |
else:
|
| 157 |
+
|
| 158 |
for r in all_res:
|
| 159 |
+
yield r["id"], r
|
data.zip
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3cc1341af046106cda69082185bc911076d29a3f18ac28866f72d73a3d97fe85
|
| 3 |
+
size 70776
|