wza commited on
Commit
493d1f4
1 Parent(s): bb7927b

Update TimeTravel.py

Browse files
Files changed (1) hide show
  1. TimeTravel.py +11 -9
TimeTravel.py CHANGED
@@ -153,13 +153,15 @@ 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
- if row.split():
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
- }
 
 
 
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
+ try:
157
  data = json.loads(row)
158
+ except:
159
+ print(row)
160
+ yield key, {
161
+ "story_id": data["story_id"],
162
+ "premise": data["premise"],
163
+ "initial": data["initial"],
164
+ "counterfactual": data["counterfactual"],
165
+ "original_ending": data["original_ending"],
166
+ "edited_ending": data["edited_ending"],
167
+ }