Hieu Nguyen commited on
Commit
a117a45
1 Parent(s): c398ea4

Update dataset features to be written to .json

Browse files
Files changed (1) hide show
  1. deep-research.py +4 -4
deep-research.py CHANGED
@@ -91,9 +91,9 @@ class NewDataset(datasets.GeneratorBasedBuilder):
91
  # if self.config.name == "train": # This is the name of the configuration selected in BUILDER_CONFIGS above
92
  features = datasets.Features(
93
  {
94
- "id": datasets.Value("string"),
95
- "title": datasets.Value("string"),
96
- "context": datasets.Value("string"),
97
  "question": datasets.Value("string"),
98
  "answers": datasets.features.Sequence(
99
  {"text": datasets.Value("string"), "answer_start": datasets.Value("int32"),}
@@ -142,7 +142,7 @@ class NewDataset(datasets.GeneratorBasedBuilder):
142
  def _generate_examples(self, filepath):
143
  # TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
144
  # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
145
- with open(filepath) as f:
146
  for key, row in enumerate(f):
147
  data = json.loads(row)
148
  for article in data["data"]:
 
91
  # if self.config.name == "train": # This is the name of the configuration selected in BUILDER_CONFIGS above
92
  features = datasets.Features(
93
  {
94
+ "identification": datasets.Value("string"),
95
+ "title_text": datasets.Value("string"),
96
+ "context_text": datasets.Value("string"),
97
  "question": datasets.Value("string"),
98
  "answers": datasets.features.Sequence(
99
  {"text": datasets.Value("string"), "answer_start": datasets.Value("int32"),}
 
142
  def _generate_examples(self, filepath):
143
  # TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
144
  # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
145
+ with open(filepath, encoding="utf-8") as f:
146
  for key, row in enumerate(f):
147
  data = json.loads(row)
148
  for article in data["data"]: