Chesscorner commited on
Commit
4fad638
·
verified ·
1 Parent(s): 23f1316

Update chess_ground-targz.py

Browse files
Files changed (1) hide show
  1. chess_ground-targz.py +7 -9
chess_ground-targz.py CHANGED
@@ -52,13 +52,11 @@ class ChessGroundTargz(datasets.GeneratorBasedBuilder):
52
 
53
  def _generate_examples(self, filepath):
54
  idx = 0
55
- try:
56
- with open(filepath, encoding="utf-8") as fp:
57
- for line in fp:
58
- if line.strip(): # Skip empty lines
59
- obj = json.loads(line)
60
- yield idx, obj
61
- idx += 1
62
- except json.JSONDecodeError:
63
- raise ValueError(f"File {filepath} is not a valid JSONL file.")
64
 
 
52
 
53
  def _generate_examples(self, filepath):
54
  idx = 0
55
+ # open the file and read the lines
56
+ with open(filepath, encoding="utf-8") as fp:
57
+ for line in fp:
58
+ # load json line
59
+ obj = json.loads(line)
60
+ yield idx, obj
61
+ idx += 1
 
 
62