HugoLaurencon commited on
Commit
4088711
·
1 Parent(s): a51e504
Files changed (1) hide show
  1. ScienceQA.py +19 -15
ScienceQA.py CHANGED
@@ -63,20 +63,20 @@ class ScienceQADataset(datasets.GeneratorBasedBuilder):
63
  def _info(self):
64
  features = datasets.Features(
65
  {
66
- #"question": datasets.Value("string"),
67
- #"choices": datasets.Sequence(datasets.Value("string")),
68
- #"answer": datasets.Value("int32"),
69
- #"hint": datasets.Value("string"),
70
  "image": datasets.Image(),
71
- #"task": datasets.Value("string"),
72
- #"grade": datasets.Value("string"),
73
- #"subject": datasets.Value("string"),
74
- #"topic": datasets.Value("string"),
75
- #"category": datasets.Value("string"),
76
- #"skill": datasets.Value("string"),
77
- #"lecture": datasets.Value("string"),
78
- #"solution": datasets.Value("string"),
79
- #"split": datasets.Value("string"),
80
  }
81
  )
82
  return datasets.DatasetInfo(
@@ -115,8 +115,12 @@ class ScienceQADataset(datasets.GeneratorBasedBuilder):
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
- pid_splits = {"train": ["1"], "val": ["7"], "test": ["5"]}
119
- problems = {"1": {"image": "image.png"}, "5": {"image": "image.png"}, "7": {"image": "image.png"}}
 
 
 
 
120
 
121
  for idx, key in enumerate(pid_splits[split_name]):
122
  example = problems[key]
 
63
  def _info(self):
64
  features = datasets.Features(
65
  {
66
+ "question": datasets.Value("string"),
67
+ "choices": datasets.Sequence(datasets.Value("string")),
68
+ "answer": datasets.Value("int32"),
69
+ "hint": datasets.Value("string"),
70
  "image": datasets.Image(),
71
+ "task": datasets.Value("string"),
72
+ "grade": datasets.Value("string"),
73
+ "subject": datasets.Value("string"),
74
+ "topic": datasets.Value("string"),
75
+ "category": datasets.Value("string"),
76
+ "skill": datasets.Value("string"),
77
+ "lecture": datasets.Value("string"),
78
+ "solution": datasets.Value("string"),
79
+ "split": datasets.Value("string"),
80
  }
81
  )
82
  return datasets.DatasetInfo(
 
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]