HugoLaurencon commited on
Commit
cf9aa66
·
1 Parent(s): 42054eb
Files changed (1) hide show
  1. ScienceQA.py +14 -8
ScienceQA.py CHANGED
@@ -55,6 +55,13 @@ _SUB_FOLDER_OR_FILE_NAME = {
55
  "test": "test",
56
  }
57
 
 
 
 
 
 
 
 
58
 
59
  class ScienceQADataset(datasets.GeneratorBasedBuilder):
60
 
@@ -113,14 +120,13 @@ class ScienceQADataset(datasets.GeneratorBasedBuilder):
113
  ]
114
 
115
  def _generate_examples(self, pid_splits_path, problems_path, images_path, split_name):
116
- #pid_splits = json.load(open(pid_splits_path, "r"))
117
- #problems = json.load(open(problems_path, "r"))
118
-
119
- #pid_splits = {"train": ["1"], "val": ["7"], "test": ["5"]}
120
- #problems = {"1": {"image": "image.png"}, "5": {"image": "image.png"}, "7": {"image": "image.png"}}
121
-
122
- pid_splits = json.load(open("/gpfswork/rech/cnw/urd43gx/pid_splits.json", "r"))
123
- problems = json.load(open("/gpfswork/rech/cnw/urd43gx/problems.json", "r"))
124
 
125
  for idx, key in enumerate(pid_splits[split_name]):
126
  example = problems[key]
 
55
  "test": "test",
56
  }
57
 
58
+ # For some reasons I couldn't open these files after downloading them (successfully) with datasets
59
+ # so I downloaded these files on JZ and hard coded the paths...
60
+ JZ_FOLDER_PATH = {
61
+ "pid_splits": "/gpfswork/rech/cnw/urd43gx/ScienceQA/pid_splits.json",
62
+ "problems": "/gpfswork/rech/cnw/urd43gx/ScienceQA/problems.json",
63
+ }
64
+
65
 
66
  class ScienceQADataset(datasets.GeneratorBasedBuilder):
67
 
 
120
  ]
121
 
122
  def _generate_examples(self, pid_splits_path, problems_path, images_path, split_name):
123
+ # Ideal solution would be this:
124
+ # pid_splits = json.load(open(pid_splits_path, "r"))
125
+ # problems = json.load(open(problems_path, "r"))
126
+ # But for some reasons I couldn't open these files after downloading them (successfully) with datasets
127
+ # so I downloaded these files on JZ and hard coded the paths...
128
+ pid_splits = json.load(open(JZ_FOLDER_PATH["pid_splits"], "r"))
129
+ problems = json.load(open(JZ_FOLDER_PATH["problems"], "r"))
 
130
 
131
  for idx, key in enumerate(pid_splits[split_name]):
132
  example = problems[key]