albertvillanova HF staff commited on
Commit
2962e06
1 Parent(s): ad22bfa

Skip missing JSON files (#6)

Browse files

- Skip missing JSON files (d1ca539b4851b068c0e38d0f6b7b4a93434cad1c)

Files changed (1) hide show
  1. hybrid_qa.py +7 -4
hybrid_qa.py CHANGED
@@ -139,10 +139,13 @@ class HybridQa(datasets.GeneratorBasedBuilder):
139
  table_file_path = os.path.join(tables_path, f"{table_id}.json")
140
  url_data_path = os.path.join(requests_path, f"{table_id}.json")
141
 
142
- with open(table_file_path, encoding="utf-8") as f:
143
- table = json.load(f)
144
- with open(url_data_path, encoding="utf-8") as f:
145
- url_data = json.load(f)
 
 
 
146
 
147
  table["header"] = [header[0] for header in table["header"]]
148
 
 
139
  table_file_path = os.path.join(tables_path, f"{table_id}.json")
140
  url_data_path = os.path.join(requests_path, f"{table_id}.json")
141
 
142
+ try:
143
+ with open(table_file_path, encoding="utf-8") as f:
144
+ table = json.load(f)
145
+ with open(url_data_path, encoding="utf-8") as f:
146
+ url_data = json.load(f)
147
+ except KeyError: # Some JSON files were not properly added to the GitHub repo: filenames with ':', '"'
148
+ continue
149
 
150
  table["header"] = [header[0] for header in table["header"]]
151