ravishekhar commited on
Commit
68dbe8a
·
verified ·
1 Parent(s): 3c3ee3d

Update OasisSimp/dataset.py

Browse files
Files changed (1) hide show
  1. OasisSimp/dataset.py +8 -7
OasisSimp/dataset.py CHANGED
@@ -25,14 +25,15 @@ class OasisSimp(GeneratorBasedBuilder):
25
  )
26
 
27
  def _split_generators(self, dl_manager):
28
- """Define splits using your current JSONL files"""
29
- base_path = "." # files are in the root of the repo
30
- lang = self.config.name.upper() # e.g., EN, SI, PS, TA, TH
31
 
32
- validation_file = os.path.join(base_path, f"OasisSimp-{lang}_valid.jsonl")
33
- test_file = os.path.join(base_path, f"OasisSimp-{lang}_test.jsonl")
 
34
 
35
- # Check if files exist
36
  if not os.path.exists(validation_file):
37
  raise FileNotFoundError(f"{validation_file} not found")
38
  if not os.path.exists(test_file):
@@ -59,6 +60,6 @@ class OasisSimp(GeneratorBasedBuilder):
59
  try:
60
  row = json.loads(line)
61
  yield row["id"], row
62
- except json.JSONDecodeError as e:
63
  print(f"Skipping invalid JSON line in {filepath}: {line}")
64
  continue
 
25
  )
26
 
27
  def _split_generators(self, dl_manager):
28
+ """Define splits using your current JSONL files in subfolders"""
29
+ base_path = "." # root folder
30
+ lang = self.config.name.upper() # EN, SI, PS, TA, TH
31
 
32
+ # Point to subfolder
33
+ validation_file = os.path.join(base_path, f"OasisSimp-{lang}", f"OasisSimp-{lang}_valid.jsonl")
34
+ test_file = os.path.join(base_path, f"OasisSimp-{lang}", f"OasisSimp-{lang}_test.jsonl")
35
 
36
+ # Check files exist
37
  if not os.path.exists(validation_file):
38
  raise FileNotFoundError(f"{validation_file} not found")
39
  if not os.path.exists(test_file):
 
60
  try:
61
  row = json.loads(line)
62
  yield row["id"], row
63
+ except json.JSONDecodeError:
64
  print(f"Skipping invalid JSON line in {filepath}: {line}")
65
  continue