amphora commited on
Commit
939175d
1 Parent(s): ff114f8

Update csatqa.py

Browse files
Files changed (1) hide show
  1. csatqa.py +15 -4
csatqa.py CHANGED
@@ -16,7 +16,7 @@ _HOMEPAGE = "https://huggingface.co/HAERAE-HUB"
16
 
17
  _LICENSE = "Proprietary"
18
 
19
- split_names = ["all","WR", "GR", "RCS", "RCSS", "RCH", "LI"]
20
 
21
  class CSATQAConfig(datasets.BuilderConfig):
22
  def __init__(self, **kwargs):
@@ -55,10 +55,10 @@ class CSATQA(datasets.GeneratorBasedBuilder):
55
  )
56
 
57
  def _split_generators(self, dl_manager):
58
- train_path = dl_manager.download_and_extract("./data/csatqa_eval.json")
59
  return [
60
  datasets.SplitGenerator(
61
- name=datasets.Split.TRAIN,
62
  gen_kwargs={
63
  "filepath": train_path,
64
  },
@@ -70,7 +70,18 @@ class CSATQA(datasets.GeneratorBasedBuilder):
70
  buffer = []
71
  for key, row in enumerate(f):
72
  data = json.loads(row)
73
- if data["Category"] == self.config.name:
 
 
 
 
 
 
 
 
 
 
 
74
  buffer.append({
75
  "question": data["question"],
76
  "context" : data["context"],
 
16
 
17
  _LICENSE = "Proprietary"
18
 
19
+ split_names = ["full","WR", "GR", "RCS", "RCSS", "RCH", "LI"]
20
 
21
  class CSATQAConfig(datasets.BuilderConfig):
22
  def __init__(self, **kwargs):
 
55
  )
56
 
57
  def _split_generators(self, dl_manager):
58
+ train_path = dl_manager.download_and_extract("./data/csatqa.json")
59
  return [
60
  datasets.SplitGenerator(
61
+ name=datasets.Split.TEST,
62
  gen_kwargs={
63
  "filepath": train_path,
64
  },
 
70
  buffer = []
71
  for key, row in enumerate(f):
72
  data = json.loads(row)
73
+ if self.config.name == "full":
74
+ buffer.append({
75
+ "question": data["question"],
76
+ "context" : data["context"],
77
+ "option#1": data["option#1"],
78
+ "option#2": data["option#2"],
79
+ "option#3": data["option#3"],
80
+ "option#4": data["option#4"],
81
+ "option#5": data["option#5"],
82
+ "gold": data["gold"]})
83
+
84
+ elif data["Category"] == self.config.name:
85
  buffer.append({
86
  "question": data["question"],
87
  "context" : data["context"],