code: def predict_block_types(encodings, layoutlm_model, batch_size):
      all_predictions = []
      for i in range(0, len(encodings), batch_size):
          batch_start = i
          batch_end = min(i + batch_size, len(encodings))
          batch = encodings[batch_start:batch_end]
  
          model_in = {}
          for k in [
              "bbox",
              "input_ids",
              "attention_mask",
              "pixel_values",
          ]:
              model_in[k] = torch.stack([b[k] for b in batch]).to(
                  layoutlm_model.device
              )
  
          model_in["pixel_values"] = model_in["pixel_values"].to(
              layoutlm_model.dtype
          )
  
          with torch.inference_mode():
              outputs = layoutlm_model(**model_in)
              logits = outputs.logits
  
          predictions = logits.argmax(-1).squeeze().tolist()
          if len(predictions) == settings.LAYOUT_MODEL_MAX:
              predictions = [predictions]
          all_predictions.extend(predictions)
      return all_predictions
  
imports: from concurrent.futures import ThreadPoolExecutor
  from typing import List
  from transformers import LayoutLMv3ForTokenClassification
  from marker.bbox import unnormalize_box
  from transformers.models.layoutlmv3.image_processing_layoutlmv3 import normalize_box
  import io
  from PIL import Image
  from transformers import LayoutLMv3Processor
  import numpy
  from marker.settings import settings
  from marker.schema import Page, BlockType
  import torch
  from math import isclose
label_desc: Use image node_id 6 for calling a global function with example usage: predict_block_types(encodings, layoutlm_model, batch_size) and returns: all_predictions