anand-s commited on
Commit
cb2c56d
·
verified ·
1 Parent(s): 97816bb

Update test_repo.py

Browse files
Files changed (1) hide show
  1. test_repo.py +3 -1
test_repo.py CHANGED
@@ -66,13 +66,14 @@ class TestRepo(datasets.GeneratorBasedBuilder):
66
 
67
  def _generate_examples(self, directory, split):
68
  # Iterate over each file in the directory
 
69
  for filename in os.listdir(directory):
70
  filepath = os.path.join(directory, filename)
71
  if filepath.endswith(".jsonl"):
72
  with open(filepath, encoding="utf-8") as f:
73
  for key, row in enumerate(f):
74
  data = json.loads(row)
75
- yield key, {
76
  "prompt": data.get("prompt", ""),
77
  "question": data["question"],
78
  "options": data["options"],
@@ -81,3 +82,4 @@ class TestRepo(datasets.GeneratorBasedBuilder):
81
  "num_options": data.get("num_options", ""),
82
  "question_type": data.get("question_type", ""),
83
  }
 
 
66
 
67
  def _generate_examples(self, directory, split):
68
  # Iterate over each file in the directory
69
+ key_idx = 0
70
  for filename in os.listdir(directory):
71
  filepath = os.path.join(directory, filename)
72
  if filepath.endswith(".jsonl"):
73
  with open(filepath, encoding="utf-8") as f:
74
  for key, row in enumerate(f):
75
  data = json.loads(row)
76
+ yield key_idx, {
77
  "prompt": data.get("prompt", ""),
78
  "question": data["question"],
79
  "options": data["options"],
 
82
  "num_options": data.get("num_options", ""),
83
  "question_type": data.get("question_type", ""),
84
  }
85
+ key_idx +=1