Spaces:
Runtime error
Runtime error
Update utils.py
Browse files
utils.py
CHANGED
@@ -212,7 +212,13 @@ def tokenize(
|
|
212 |
|
213 |
|
214 |
def collate_fn(examples, tokenizer=None, padding=None, device=None):
|
215 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
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():
|