nbroad HF staff commited on
Commit
fb266f1
1 Parent(s): 6c6d3ac

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +7 -1
utils.py CHANGED
@@ -212,7 +212,13 @@ def tokenize(
212
 
213
 
214
  def collate_fn(examples, tokenizer=None, padding=None, device=None):
215
- batch = {k: [] for k in examples[0].keys()}
 
 
 
 
 
 
216
 
217
  for example in examples:
218
  for k, v in example.items():
 
212
 
213
 
214
  def collate_fn(examples, tokenizer=None, padding=None, device=None):
215
+ try:
216
+ keys = examples[0].keys()
217
+ except KeyError:
218
+ print(examples)
219
+ else:
220
+ batch = {k: [] for k in examples[0].keys()}
221
+
222
 
223
  for example in examples:
224
  for k, v in example.items():