Leyo commited on
Commit
a57f9d0
·
1 Parent(s): 081f072

take off split name

Browse files
Files changed (1) hide show
  1. NLVR2.py +5 -5
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], "split_name": "train"},
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], "split_name": "dev"},
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], "split_name": "test"},
107
  ),
108
  ]
109
 
110
- def _generate_examples(self, files_paths, images_paths, split_name):
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 split_name == "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))
 
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))