wza commited on
Commit
d4b5708
·
1 Parent(s): 5e578ef

Update TimeTravel.py

Browse files
Files changed (1) hide show
  1. TimeTravel.py +10 -9
TimeTravel.py CHANGED
@@ -153,12 +153,13 @@ class TimeTravel(datasets.GeneratorBasedBuilder):
153
  # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
154
  with open(filepath, encoding="utf-8") as f:
155
  for key, row in enumerate(f):
156
- data = json.loads(row)
157
- yield key, {
158
- "story_id": data["story_id"],
159
- "premise": data["premise"],
160
- "initial": data["initial"],
161
- "counterfactual": data["counterfactual"],
162
- "original_ending": data["original_ending"],
163
- "edited_ending": data["edited_ending"],
164
- }
 
 
153
  # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
154
  with open(filepath, encoding="utf-8") as f:
155
  for key, row in enumerate(f):
156
+ if row:
157
+ data = json.loads(row)
158
+ yield key, {
159
+ "story_id": data["story_id"],
160
+ "premise": data["premise"],
161
+ "initial": data["initial"],
162
+ "counterfactual": data["counterfactual"],
163
+ "original_ending": data["original_ending"],
164
+ "edited_ending": data["edited_ending"],
165
+ }