code: def add_column_counts(doc, doc_blocks, model, batch_size):
      for i in range(0, len(doc_blocks), batch_size):
          batch = range(i, min(i + batch_size, len(doc_blocks)))
          rgb_images = []
          bboxes = []
          words = []
          for pnum in batch:
              page = doc[pnum]
              rgb_image, page_bboxes, page_words = get_inference_data(
                  page, doc_blocks[pnum]
              )
              rgb_images.append(rgb_image)
              bboxes.append(page_bboxes)
              words.append(page_words)
  
          predictions = batch_inference(
              rgb_images, bboxes, words, model
          )
          for pnum, prediction in zip(batch, predictions):
              doc_blocks[pnum].column_count = prediction
  
file_path: pdf-to-markdown/marker/ordering.py
imports: from copy import deepcopy
  from typing import List
  import torch
  import sys, os
  from marker.extract_text import convert_single_page
  from transformers import LayoutLMv3ForSequenceClassification, LayoutLMv3Processor
  from PIL import Image
  import io
  from marker.schema import Page
  from marker.settings import settings
label_desc: Use image node_id 4 for calling a global function with example usage: add_column_counts(doc, doc_blocks, model, batch_size) without return types