take off split name
Browse files
NLVR2.py
CHANGED
|
@@ -95,19 +95,19 @@ class NLVR2Dataset(datasets.GeneratorBasedBuilder):
|
|
| 95 |
return [
|
| 96 |
datasets.SplitGenerator(
|
| 97 |
name=datasets.Split.TRAIN,
|
| 98 |
-
gen_kwargs={"files_paths": [files_path[self.config.name]["train"]], "images_paths": [train_img_path]
|
| 99 |
),
|
| 100 |
datasets.SplitGenerator(
|
| 101 |
name=datasets.Split.VALIDATION,
|
| 102 |
-
gen_kwargs={"files_paths": [files_path[self.config.name]["validation"]], "images_paths": [validation_img_path]
|
| 103 |
),
|
| 104 |
datasets.SplitGenerator(
|
| 105 |
name=datasets.Split.TEST,
|
| 106 |
-
gen_kwargs={"files_paths": [files_path[self.config.name]["test1"], files_path[self.config.name]["test2"]], "images_paths": [test1_img_path, test2_img_path]
|
| 107 |
),
|
| 108 |
]
|
| 109 |
|
| 110 |
-
def _generate_examples(self, files_paths, images_paths
|
| 111 |
idx = 0
|
| 112 |
for i, files_path in enumerate(files_paths):
|
| 113 |
for line in open(files_path).readlines():
|
|
@@ -115,7 +115,7 @@ class NLVR2Dataset(datasets.GeneratorBasedBuilder):
|
|
| 115 |
common_img_identifier = ex["identifier"].split("-")
|
| 116 |
left_img_identifier = f"{common_img_identifier[0]}-{common_img_identifier[1]}-{common_img_identifier[2]}-img0.png"
|
| 117 |
right_img_identifier = f"{common_img_identifier[0]}-{common_img_identifier[1]}-{common_img_identifier[2]}-img1.png"
|
| 118 |
-
if
|
| 119 |
directory = str(ex["directory"])
|
| 120 |
left_image_path = str(os.path.join(images_paths[i], directory, left_img_identifier))
|
| 121 |
right_image_path = str(os.path.join(images_paths[i], directory, right_img_identifier))
|
|
|
|
| 95 |
return [
|
| 96 |
datasets.SplitGenerator(
|
| 97 |
name=datasets.Split.TRAIN,
|
| 98 |
+
gen_kwargs={"files_paths": [files_path[self.config.name]["train"]], "images_paths": [train_img_path]},
|
| 99 |
),
|
| 100 |
datasets.SplitGenerator(
|
| 101 |
name=datasets.Split.VALIDATION,
|
| 102 |
+
gen_kwargs={"files_paths": [files_path[self.config.name]["validation"]], "images_paths": [validation_img_path]},
|
| 103 |
),
|
| 104 |
datasets.SplitGenerator(
|
| 105 |
name=datasets.Split.TEST,
|
| 106 |
+
gen_kwargs={"files_paths": [files_path[self.config.name]["test1"], files_path[self.config.name]["test2"]], "images_paths": [test1_img_path, test2_img_path]},
|
| 107 |
),
|
| 108 |
]
|
| 109 |
|
| 110 |
+
def _generate_examples(self, files_paths, images_paths):
|
| 111 |
idx = 0
|
| 112 |
for i, files_path in enumerate(files_paths):
|
| 113 |
for line in open(files_path).readlines():
|
|
|
|
| 115 |
common_img_identifier = ex["identifier"].split("-")
|
| 116 |
left_img_identifier = f"{common_img_identifier[0]}-{common_img_identifier[1]}-{common_img_identifier[2]}-img0.png"
|
| 117 |
right_img_identifier = f"{common_img_identifier[0]}-{common_img_identifier[1]}-{common_img_identifier[2]}-img1.png"
|
| 118 |
+
if common_img_identifier[0] == "train":
|
| 119 |
directory = str(ex["directory"])
|
| 120 |
left_image_path = str(os.path.join(images_paths[i], directory, left_img_identifier))
|
| 121 |
right_image_path = str(os.path.join(images_paths[i], directory, right_img_identifier))
|