MrPotato commited on
Commit
2f74e61
·
1 Parent(s): 491aaba

Upload docbank.py

Browse files
Files changed (1) hide show
  1. docbank.py +8 -0
docbank.py CHANGED
@@ -247,12 +247,20 @@ class Docbank(datasets.GeneratorBasedBuilder):
247
  continue
248
 
249
  for chunk_id, index in enumerate(range(0, len(tokens), self.CHUNK_SIZE)):
 
250
  split_tokens = tokens[index:index + self.CHUNK_SIZE]
251
  split_bboxes = bboxes[index:index + self.CHUNK_SIZE]
252
  split_rgbs = rgbs[index:index + self.CHUNK_SIZE]
253
  split_fonts = fonts[index:index + self.CHUNK_SIZE]
254
  split_labels = labels[index:index + self.CHUNK_SIZE]
255
 
 
 
 
 
 
 
 
256
  yield key, {
257
  "id": f"{f_id}_{chunk_id}",
258
  'input_ids': split_tokens,
 
247
  continue
248
 
249
  for chunk_id, index in enumerate(range(0, len(tokens), self.CHUNK_SIZE)):
250
+
251
  split_tokens = tokens[index:index + self.CHUNK_SIZE]
252
  split_bboxes = bboxes[index:index + self.CHUNK_SIZE]
253
  split_rgbs = rgbs[index:index + self.CHUNK_SIZE]
254
  split_fonts = fonts[index:index + self.CHUNK_SIZE]
255
  split_labels = labels[index:index + self.CHUNK_SIZE]
256
 
257
+ if len(split_tokens) > self.CHUNK_SIZE:
258
+ print('Err')
259
+ print(key)
260
+ print(f_id)
261
+ print(split_tokens)
262
+
263
+
264
  yield key, {
265
  "id": f"{f_id}_{chunk_id}",
266
  'input_ids': split_tokens,